|
|
|
|
@ -1,8 +1,3 @@
|
|
|
|
|
import 'dart:convert';
|
|
|
|
|
import 'dart:io' as Io;
|
|
|
|
|
import 'dart:io';
|
|
|
|
|
import 'dart:typed_data';
|
|
|
|
|
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter_countdown_timer/index.dart';
|
|
|
|
|
import 'package:lottie/lottie.dart';
|
|
|
|
|
@ -17,7 +12,6 @@ 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';
|
|
|
|
|
|
|
|
|
|
class ITGAdsScreen extends StatefulWidget {
|
|
|
|
|
@ -51,6 +45,10 @@ class _ITGAdsScreenState extends State<ITGAdsScreen> {
|
|
|
|
|
|
|
|
|
|
void checkFileType() {
|
|
|
|
|
String? rFile = advertisementData!.viewAttachFileColl!.first.base64String;
|
|
|
|
|
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") {
|
|
|
|
|
@ -65,8 +63,8 @@ class _ITGAdsScreenState extends State<ITGAdsScreen> {
|
|
|
|
|
_futureController = createVideoPlayer(rFile!);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// advertisementData?.actionButtonsColl!.forEach((element) {
|
|
|
|
|
advertisementData?.actionButtonsColl!.removeWhere((element1) => element1.actionButtonId == advertisementData?.skipButtonId);
|
|
|
|
|
// advertisementData?.actionButtonsColl!.forEach((element) {
|
|
|
|
|
advertisementData?.actionButtonsColl!.removeWhere((element1) => element1.actionButtonId == advertisementData?.skipButtonId);
|
|
|
|
|
//});
|
|
|
|
|
|
|
|
|
|
// setState(() {});
|
|
|
|
|
@ -264,26 +262,29 @@ class _ITGAdsScreenState extends State<ITGAdsScreen> {
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
if (isImage)
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
children: [
|
|
|
|
|
Image.network(imageUrl),
|
|
|
|
|
50.height,
|
|
|
|
|
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);
|
|
|
|
|
DashboardApiClient().setAdvertisementViewed(masterID!, advertisementData!.advertisementId!, "Like").then((value) {
|
|
|
|
|
logger.d(value);
|
|
|
|
|
});
|
|
|
|
|
} catch (ex) {
|
|
|
|
|
logger.wtf(ex);
|
|
|
|
|
Utils.handleException(ex, context, null);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
SingleChildScrollView(
|
|
|
|
|
padding: const EdgeInsets.only(top: 60, left: 12, right: 12),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
children: [
|
|
|
|
|
Image.network(imageUrl),
|
|
|
|
|
50.height,
|
|
|
|
|
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);
|
|
|
|
|
DashboardApiClient().setAdvertisementViewed(masterID!, advertisementData!.advertisementId!, "Like").then((value) {
|
|
|
|
|
logger.d(value);
|
|
|
|
|
});
|
|
|
|
|
} catch (ex) {
|
|
|
|
|
logger.wtf(ex);
|
|
|
|
|
Utils.handleException(ex, context, null);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
|