showFullScreen method
dynamic
showFullScreen({
- required BuildContext context,
- String action = "default",
- required dynamic onJobComplete(),
- bool showLoader = true,
Implementation
showFullScreen({
required BuildContext context,
String action = "default",
required Function() onJobComplete,
bool showLoader = true,
}) async {
SharedPreferences preferences = await SharedPreferences.getInstance();
bool isSub = NavigationService.navigatorKey.currentContext!
.read<IapProvider>()
.isSubscribed;
if (isSub) {
dog.i("You are Subscribed", tag: "SubScribed");
onJobComplete();
return;
}
if (showLoader) {
NavigationService.navigatorKey.currentContext!
.read<LoaderProvider>()
.isAdLoading = true;
}
FullScreenEngine().showAds(
onTimeOut: () {
if (showLoader) {
NavigationService.navigatorKey.currentContext!
.read<LoaderProvider>()
.isAdLoading = false;
}
},
context: context,
onJobComplete: () {
dog.i("Abrt Timer on Job Done =========>", tag: "Timer");
timer?.cancel();
if (showLoader) {
NavigationService.navigatorKey.currentContext!
.read<LoaderProvider>()
.isAdLoading = false;
}
int count = preferences.getInt("adCount") ?? 0;
preferences.setInt("adCount", count + 1);
DelayAlertHelper.showDialog(context: context);
onJobComplete();
},
);
dog.i("Started Timer of 10 Seconds =========>", tag: "Timer");
timer = Timer.periodic(const Duration(seconds: 10), (timer) {
dog.i("Condition No Response Ad 10 Second Loader Close =========>",
tag: "Timer");
timer.cancel();
if (showLoader) {
NavigationService.navigatorKey.currentContext!
.read<LoaderProvider>()
.isAdLoading = false;
}
});
}