|  |  |  | @ -7,6 +7,7 @@ import 'package:flutter/material.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:flutter_countdown_timer/index.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:lottie/lottie.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:mohem_flutter_app/api/dashboard_api_client.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:mohem_flutter_app/app_state/app_state.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:mohem_flutter_app/classes/colors.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:mohem_flutter_app/classes/lottie_consts.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:mohem_flutter_app/classes/utils.dart'; | 
		
	
	
		
			
				
					|  |  |  | @ -15,6 +16,7 @@ import 'package:mohem_flutter_app/extensions/string_extensions.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:mohem_flutter_app/main.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:mohem_flutter_app/models/itg/advertisement.dart' as ads; | 
		
	
		
			
				|  |  |  |  | import 'package:mohem_flutter_app/widgets/button/default_button.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:path_provider/path_provider.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:video_player/video_player.dart'; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
	
		
			
				
					|  |  |  | @ -86,11 +88,6 @@ class _ITGAdsScreenState extends State<ITGAdsScreen> { | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   Future<VideoPlayerController> createVideoPlayer(String encodedBytes) async { | 
		
	
		
			
				|  |  |  |  |     try { | 
		
	
		
			
				|  |  |  |  |       // Uint8List decodedBytes = base64Decode(encodedBytes.split("base64,").last); | 
		
	
		
			
				|  |  |  |  |       // Directory appDocumentsDirectory = await getApplicationDocumentsDirectory(); // 1 | 
		
	
		
			
				|  |  |  |  |       // File file = Io.File("${appDocumentsDirectory.path}/myAdsVideo.mp4"); | 
		
	
		
			
				|  |  |  |  |       // file.writeAsBytesSync(decodedBytes); | 
		
	
		
			
				|  |  |  |  |       // VideoPlayerController controller = VideoPlayerController.file(file); | 
		
	
		
			
				|  |  |  |  |       VideoPlayerController controller = VideoPlayerController.network(advertisementData!.viewAttachFileColl!.first.base64String!); | 
		
	
		
			
				|  |  |  |  |       await controller.initialize(); | 
		
	
		
			
				|  |  |  |  |       await controller.play(); | 
		
	
	
		
			
				
					|  |  |  | @ -113,8 +110,6 @@ class _ITGAdsScreenState extends State<ITGAdsScreen> { | 
		
	
		
			
				|  |  |  |  |   @override | 
		
	
		
			
				|  |  |  |  |   void dispose() { | 
		
	
		
			
				|  |  |  |  |     if (_controller != null) _controller.dispose(); | 
		
	
		
			
				|  |  |  |  |     // player.stop(); | 
		
	
		
			
				|  |  |  |  |     // player.dispose(); | 
		
	
		
			
				|  |  |  |  |     super.dispose(); | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
	
		
			
				
					|  |  |  | @ -158,41 +153,54 @@ class _ITGAdsScreenState extends State<ITGAdsScreen> { | 
		
	
		
			
				|  |  |  |  |                       ), | 
		
	
		
			
				|  |  |  |  |                       50.height, | 
		
	
		
			
				|  |  |  |  |                       ValueListenableBuilder<bool>( | 
		
	
		
			
				|  |  |  |  |                           valueListenable: hasTimerEnded, | 
		
	
		
			
				|  |  |  |  |                           builder: (context, val, child) { | 
		
	
		
			
				|  |  |  |  |                             if (hasTimerEndedBool) { | 
		
	
		
			
				|  |  |  |  |                               return Container( | 
		
	
		
			
				|  |  |  |  |                                       padding: const EdgeInsets.all(16), decoration: Utils.containerRadius(MyColors.white, 10), child: const Icon(Icons.thumb_up, color: MyColors.gradiantEndColor)) | 
		
	
		
			
				|  |  |  |  |                                   .onPress(() { | 
		
	
		
			
				|  |  |  |  |                                 try { | 
		
	
		
			
				|  |  |  |  |                                   DashboardApiClient().setAdvertisementViewed(masterID!, advertisementData!.advertisementId!).then((value) { | 
		
	
		
			
				|  |  |  |  |                                     logger.d(value); | 
		
	
		
			
				|  |  |  |  |                         valueListenable: hasTimerEnded, | 
		
	
		
			
				|  |  |  |  |                         builder: (context, val, child) { | 
		
	
		
			
				|  |  |  |  |                           if (hasTimerEndedBool) { | 
		
	
		
			
				|  |  |  |  |                             return Row( | 
		
	
		
			
				|  |  |  |  |                               mainAxisAlignment: MainAxisAlignment.center, | 
		
	
		
			
				|  |  |  |  |                               children: [ | 
		
	
		
			
				|  |  |  |  |                                 Container( | 
		
	
		
			
				|  |  |  |  |                                         padding: const EdgeInsets.all(16), decoration: Utils.containerRadius(MyColors.white, 10), child: const Icon(Icons.thumb_up, color: MyColors.gradiantEndColor)) | 
		
	
		
			
				|  |  |  |  |                                     .onPress(() { | 
		
	
		
			
				|  |  |  |  |                                   try { | 
		
	
		
			
				|  |  |  |  |                                     Navigator.pop(context); | 
		
	
		
			
				|  |  |  |  |                                   }); | 
		
	
		
			
				|  |  |  |  |                                 } catch (ex) { | 
		
	
		
			
				|  |  |  |  |                                   logger.wtf(ex); | 
		
	
		
			
				|  |  |  |  |                                   Utils.handleException(ex, context, null); | 
		
	
		
			
				|  |  |  |  |                                 } | 
		
	
		
			
				|  |  |  |  |                               }); | 
		
	
		
			
				|  |  |  |  |                             } else { | 
		
	
		
			
				|  |  |  |  |                               return Container(); | 
		
	
		
			
				|  |  |  |  |                             } | 
		
	
		
			
				|  |  |  |  |                           }), | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |                       // DefaultButton(LocaleKeys.home.tr(), () async { | 
		
	
		
			
				|  |  |  |  |                       //   DashboardApiClient().setAdvertisementViewed(masterID!, advertisementData!.advertisementId!).then((value) { | 
		
	
		
			
				|  |  |  |  |                       //     logger.d(value); | 
		
	
		
			
				|  |  |  |  |                       //   }); | 
		
	
		
			
				|  |  |  |  |                       // }).paddingOnly(left: 50, right: 50) | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |                       // ElevatedButton( | 
		
	
		
			
				|  |  |  |  |                       //   onPressed: () async { | 
		
	
		
			
				|  |  |  |  |                       //     // DashboardApiClient().setAdvertisementViewed(widget.addMasterId, widget.advertisement!.advertisementId!).then((value) { | 
		
	
		
			
				|  |  |  |  |                       //     //   logger.d(value); | 
		
	
		
			
				|  |  |  |  |                       //     // }); | 
		
	
		
			
				|  |  |  |  |                       //   }, | 
		
	
		
			
				|  |  |  |  |                       //   child: const Text("Go To Dashboard"), | 
		
	
		
			
				|  |  |  |  |                       // ) | 
		
	
		
			
				|  |  |  |  |                                     DashboardApiClient().setAdvertisementViewed(masterID!, advertisementData!.advertisementId!, "Like").then((value) { | 
		
	
		
			
				|  |  |  |  |                                       logger.d(value); | 
		
	
		
			
				|  |  |  |  |                                     }); | 
		
	
		
			
				|  |  |  |  |                                   } catch (ex) { | 
		
	
		
			
				|  |  |  |  |                                     logger.wtf(ex); | 
		
	
		
			
				|  |  |  |  |                                     Utils.handleException(ex, context, null); | 
		
	
		
			
				|  |  |  |  |                                   } | 
		
	
		
			
				|  |  |  |  |                                 }), | 
		
	
		
			
				|  |  |  |  |                                 20.width, | 
		
	
		
			
				|  |  |  |  |                                 Container( | 
		
	
		
			
				|  |  |  |  |                                     padding: const EdgeInsets.all(16), decoration: Utils.containerRadius(MyColors.white, 10), child: const Icon(Icons.thumb_down, color: MyColors.gradiantEndColor)) | 
		
	
		
			
				|  |  |  |  |                                     .onPress(() { | 
		
	
		
			
				|  |  |  |  |                                   try { | 
		
	
		
			
				|  |  |  |  |                                     Navigator.pop(context); | 
		
	
		
			
				|  |  |  |  |                                     DashboardApiClient().setAdvertisementViewed(masterID!, advertisementData!.advertisementId!, "Dislike").then((value) { | 
		
	
		
			
				|  |  |  |  |                                       logger.d(value); | 
		
	
		
			
				|  |  |  |  |                                     }); | 
		
	
		
			
				|  |  |  |  |                                   } catch (ex) { | 
		
	
		
			
				|  |  |  |  |                                     logger.wtf(ex); | 
		
	
		
			
				|  |  |  |  |                                     Utils.handleException(ex, context, null); | 
		
	
		
			
				|  |  |  |  |                                   } | 
		
	
		
			
				|  |  |  |  |                                 }), | 
		
	
		
			
				|  |  |  |  |                               ], | 
		
	
		
			
				|  |  |  |  |                             ); | 
		
	
		
			
				|  |  |  |  |                           } else { | 
		
	
		
			
				|  |  |  |  |                             return Container(); | 
		
	
		
			
				|  |  |  |  |                           } | 
		
	
		
			
				|  |  |  |  |                         }, | 
		
	
		
			
				|  |  |  |  |                       ), | 
		
	
		
			
				|  |  |  |  |                       20.height, | 
		
	
		
			
				|  |  |  |  |                       if (advertisementData?.isOptional ?? false) | 
		
	
		
			
				|  |  |  |  |                         DefaultButton(AppState().isArabic(context) ? advertisementData?.skipButtonTextAr ?? "Skip" : advertisementData?.skipButtonTextEn ?? "Skip", () async { | 
		
	
		
			
				|  |  |  |  |                           Navigator.pop(context); | 
		
	
		
			
				|  |  |  |  |                           DashboardApiClient().setAdvertisementViewed(masterID!, advertisementData!.advertisementId!, "Skip").then((value) { | 
		
	
		
			
				|  |  |  |  |                             logger.d(value); | 
		
	
		
			
				|  |  |  |  |                           }); | 
		
	
		
			
				|  |  |  |  |                         }).paddingOnly(left: 100, right: 100) | 
		
	
		
			
				|  |  |  |  |                     ], | 
		
	
		
			
				|  |  |  |  |                   ); | 
		
	
		
			
				|  |  |  |  |                 } else { | 
		
	
	
		
			
				
					|  |  |  | @ -212,9 +220,9 @@ class _ITGAdsScreenState extends State<ITGAdsScreen> { | 
		
	
		
			
				|  |  |  |  |                 Container(padding: const EdgeInsets.all(16), decoration: Utils.containerRadius(MyColors.white, 10), child: const Icon(Icons.thumb_up, color: MyColors.gradiantEndColor)).onPress( | 
		
	
		
			
				|  |  |  |  |                   () { | 
		
	
		
			
				|  |  |  |  |                     try { | 
		
	
		
			
				|  |  |  |  |                       DashboardApiClient().setAdvertisementViewed(masterID!, advertisementData!.advertisementId!).then((value) { | 
		
	
		
			
				|  |  |  |  |                       Navigator.pop(context); | 
		
	
		
			
				|  |  |  |  |                       DashboardApiClient().setAdvertisementViewed(masterID!, advertisementData!.advertisementId!, "Like").then((value) { | 
		
	
		
			
				|  |  |  |  |                         logger.d(value); | 
		
	
		
			
				|  |  |  |  |                         Navigator.pop(context); | 
		
	
		
			
				|  |  |  |  |                       }); | 
		
	
		
			
				|  |  |  |  |                     } catch (ex) { | 
		
	
		
			
				|  |  |  |  |                       logger.wtf(ex); | 
		
	
	
		
			
				
					|  |  |  | 
 |