|  |  | @ -11,8 +11,10 @@ import 'package:mohem_flutter_app/extensions/string_extensions.dart'; | 
			
		
	
		
		
			
				
					
					|  |  |  | import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; |  |  |  | import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; | 
			
		
	
		
		
			
				
					
					|  |  |  | import 'package:mohem_flutter_app/main.dart'; |  |  |  | import 'package:mohem_flutter_app/main.dart'; | 
			
		
	
		
		
			
				
					
					|  |  |  | import 'package:mohem_flutter_app/models/itg/advertisement.dart' as ads; |  |  |  | import 'package:mohem_flutter_app/models/itg/advertisement.dart' as ads; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; | 
			
		
	
		
		
			
				
					
					|  |  |  | import 'package:mohem_flutter_app/widgets/button/default_button.dart'; |  |  |  | import 'package:mohem_flutter_app/widgets/button/default_button.dart'; | 
			
		
	
		
		
			
				
					
					|  |  |  | import 'package:mohem_flutter_app/widgets/my_video_progress_indicator.dart'; |  |  |  | import 'package:mohem_flutter_app/widgets/my_video_progress_indicator.dart'; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import 'package:url_launcher/url_launcher.dart'; | 
			
		
	
		
		
			
				
					
					|  |  |  | import 'package:video_player/video_player.dart'; |  |  |  | import 'package:video_player/video_player.dart'; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | class ITGAdsScreen extends StatefulWidget { |  |  |  | class ITGAdsScreen extends StatefulWidget { | 
			
		
	
	
		
		
			
				
					|  |  | @ -31,6 +33,8 @@ class _ITGAdsScreenState extends State<ITGAdsScreen> { | 
			
		
	
		
		
			
				
					
					|  |  |  |   bool isAudio = false; |  |  |  |   bool isAudio = false; | 
			
		
	
		
		
			
				
					
					|  |  |  |   String ext = ''; |  |  |  |   String ext = ''; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   bool isTextURL = false; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   // late File imageFile; |  |  |  |   // late File imageFile; | 
			
		
	
		
		
			
				
					
					|  |  |  |   late String imageUrl; |  |  |  |   late String imageUrl; | 
			
		
	
		
		
			
				
					
					|  |  |  |   ads.Advertisement? advertisementData; |  |  |  |   ads.Advertisement? advertisementData; | 
			
		
	
	
		
		
			
				
					|  |  | @ -45,23 +49,27 @@ class _ITGAdsScreenState extends State<ITGAdsScreen> { | 
			
		
	
		
		
			
				
					
					|  |  |  |   late CountdownTimerController timerController; |  |  |  |   late CountdownTimerController timerController; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   void checkFileType() { |  |  |  |   void checkFileType() { | 
			
		
	
		
		
			
				
					
					|  |  |  |     String? rFile = advertisementData!.viewAttachFileColl!.first.base64String; |  |  |  |     if (advertisementData!.viewAttachFileColl!.first.contentType!.toLowerCase() == "text") { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |     try { |  |  |  |       isTextURL = true; | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |       rFile = advertisementData!.viewAttachFileColl!.where((element) => element.languageId == AppState().getLanguageID(context)).toList().first.base64String; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     } catch (ex) {} |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     String? rFileExt = advertisementData!.viewAttachFileColl!.first.fileName; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     ext = "." + rFileExt!.split(".").last.toLowerCase(); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     if (ext == ".png" || ext == ".jpg" || ext == ".jpeg" || ext == ".gif") { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       //  await processImage(); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       imageUrl = rFile!; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       isImage = true; |  |  |  |  | 
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |     } else { |  |  |  |     } else { | 
			
		
	
		
		
			
				
					
					|  |  |  |       if (ext == ".aac") { |  |  |  |       String? rFile = advertisementData!.viewAttachFileColl!.first.base64String; | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         isAudio = true; |  |  |  |       try { | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         rFile = advertisementData!.viewAttachFileColl!.where((element) => element.languageId == AppState().getLanguageID(context)).toList().first.base64String; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       } catch (ex) {} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       String? rFileExt = advertisementData!.viewAttachFileColl!.first.fileName; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       ext = "." + rFileExt!.split(".").last.toLowerCase(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       if (ext == ".png" || ext == ".jpg" || ext == ".jpeg" || ext == ".gif") { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         //  await processImage(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         imageUrl = rFile!; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         isImage = true; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       } else { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         if (ext == ".aac") { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |           isAudio = true; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         isVideo = true; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         _futureController = createVideoPlayer(rFile!); | 
			
		
	
		
		
			
				
					
					|  |  |  |       } |  |  |  |       } | 
			
		
	
		
		
			
				
					
					|  |  |  |       isVideo = true; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       _futureController = createVideoPlayer(rFile!); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     // advertisementData?.actionButtonsColl!.forEach((element) { |  |  |  |     // advertisementData?.actionButtonsColl!.forEach((element) { | 
			
		
	
	
		
		
			
				
					|  |  | @ -132,7 +140,17 @@ class _ITGAdsScreenState extends State<ITGAdsScreen> { | 
			
		
	
		
		
			
				
					
					|  |  |  |       timerController = CountdownTimerController(endTime: DateTime.now().millisecondsSinceEpoch + 1000 * videoDuration, onEnd: onTimerEnd); |  |  |  |       timerController = CountdownTimerController(endTime: DateTime.now().millisecondsSinceEpoch + 1000 * videoDuration, onEnd: onTimerEnd); | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |     return Scaffold( |  |  |  |     return Scaffold( | 
			
		
	
		
		
			
				
					
					|  |  |  |       backgroundColor: Colors.black, |  |  |  |       backgroundColor: isTextURL ? Colors.white : Colors.black, | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       appBar: isTextURL | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |           ? AppBar( | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |               centerTitle: true, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |               automaticallyImplyLeading: false, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |               backgroundColor: Colors.white, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |               title: (AppState().isArabic(context) ? advertisementData!.advertisementTitleAr! : advertisementData!.advertisementTitleAr!).toText24(color: MyColors.darkTextColor, isBold: true), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |               //advertisementData!.viewAttachFileColl!.first.base64String!.toText24(color: MyColors.darkTextColor, isBold: true), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             ) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |           : null, | 
			
		
	
		
		
			
				
					
					|  |  |  |       body: Stack( |  |  |  |       body: Stack( | 
			
		
	
		
		
			
				
					
					|  |  |  |         children: [ |  |  |  |         children: [ | 
			
		
	
		
		
			
				
					
					|  |  |  |           if (isVideo) |  |  |  |           if (isVideo) | 
			
		
	
	
		
		
			
				
					|  |  | @ -346,6 +364,42 @@ class _ITGAdsScreenState extends State<ITGAdsScreen> { | 
			
		
	
		
		
			
				
					
					|  |  |  |                 ], |  |  |  |                 ], | 
			
		
	
		
		
			
				
					
					|  |  |  |               ), |  |  |  |               ), | 
			
		
	
		
		
			
				
					
					|  |  |  |             ), |  |  |  |             ), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |           if (isTextURL) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             SingleChildScrollView( | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |               padding: const EdgeInsets.all(21), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |               child: Column( | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 crossAxisAlignment: CrossAxisAlignment.start, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 mainAxisSize: MainAxisSize.min, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 children: [ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                   (AppState().isArabic(context) ? advertisementData!.viewAttachFileColl![0].base64String! : advertisementData!.viewAttachFileColl![1].base64String!) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                       .toText16(color: MyColors.darkTextColor), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                   24.height, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                   ListView.separated( | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     itemCount: advertisementData!.actionButtonsColl?.length ?? 0, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     separatorBuilder: (cxt, index) => 16.height, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     shrinkWrap: true, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     physics: const NeverScrollableScrollPhysics(), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     padding: EdgeInsets.zero, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     itemBuilder: (cxt, index) => DefaultButton( | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                       AppState().isArabic(context) ? advertisementData!.actionButtonsColl![index].btnTextAr : advertisementData!.actionButtonsColl![index].btnTextEn, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                       () async { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         if (advertisementData!.actionButtonsColl![index].actionValue.toLowerCase() == "skip") { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                           Navigator.pop(context); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         } else { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                           Uri uri = Uri.parse(advertisementData!.actionButtonsColl![index].iconOrImage); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                           if (await canLaunchUrl(uri)) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             await launchUrl(uri); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             Navigator.pop(context); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                           } else { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             Utils.showToast('Could not launch'); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                           } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                       }, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     ), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                   ), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 ], | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |               ), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             ), | 
			
		
	
		
		
			
				
					
					|  |  |  |         ], |  |  |  |         ], | 
			
		
	
		
		
			
				
					
					|  |  |  |       ), |  |  |  |       ), | 
			
		
	
		
		
			
				
					
					|  |  |  |     ); |  |  |  |     ); | 
			
		
	
	
		
		
			
				
					|  |  | 
 |