forked from yaso_meth/mih-project
speed up ad load in Mzansi Wallet
This commit is contained in:
@@ -20,12 +20,16 @@ class BuildLoyaltyCardList extends StatefulWidget {
|
||||
final AppUser signedInUser;
|
||||
final List<MIHLoyaltyCard> cardList;
|
||||
final int navIndex;
|
||||
final MihBannerAd? bannerAd;
|
||||
final void Function()? onCardViewClose;
|
||||
|
||||
const BuildLoyaltyCardList({
|
||||
super.key,
|
||||
required this.signedInUser,
|
||||
required this.cardList,
|
||||
required this.navIndex,
|
||||
this.bannerAd,
|
||||
this.onCardViewClose,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -391,9 +395,10 @@ class _BuildLoyaltyCardListState extends State<BuildLoyaltyCardList> {
|
||||
},
|
||||
),
|
||||
],
|
||||
onWindowTapClose: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
onWindowTapClose: widget.onCardViewClose ??
|
||||
() {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
windowBody: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
@@ -451,7 +456,8 @@ class _BuildLoyaltyCardListState extends State<BuildLoyaltyCardList> {
|
||||
),
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
MihBannerAd(),
|
||||
widget.bannerAd ?? SizedBox(),
|
||||
// MihBannerAd(),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_banner_ad.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_services/mih_mzansi_wallet_services.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_single_child_scroll.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_tool_body.dart';
|
||||
@@ -20,11 +21,13 @@ class MihCardFavourites extends StatefulWidget {
|
||||
|
||||
class _MihCardFavouritesState extends State<MihCardFavourites> {
|
||||
late Future<List<MIHLoyaltyCard>> cardList;
|
||||
late MihBannerAd _bannerAd;
|
||||
List<MIHLoyaltyCard> listOfCards = [];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_bannerAd = MihBannerAd();
|
||||
cardList = MIHMzansiWalletApis.getFavouriteLoyaltyCards(
|
||||
widget.signedInUser.app_id,
|
||||
);
|
||||
@@ -59,6 +62,13 @@ class _MihCardFavouritesState extends State<MihCardFavourites> {
|
||||
cardList: listOfCards,
|
||||
signedInUser: widget.signedInUser,
|
||||
navIndex: 0,
|
||||
bannerAd: _bannerAd,
|
||||
onCardViewClose: () {
|
||||
setState(() {
|
||||
_bannerAd = MihBannerAd();
|
||||
});
|
||||
Navigator.pop(context);
|
||||
},
|
||||
);
|
||||
} else {
|
||||
return const Center(
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter_speed_dial/flutter_speed_dial.dart';
|
||||
import 'package:mzansi_innovation_hub/main.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_banner_ad.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_services/mih_mzansi_wallet_services.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_services/mih_validation_services.dart';
|
||||
@@ -40,6 +41,7 @@ class _MihCardsState extends State<MihCards> {
|
||||
final FocusNode searchFocusNode = FocusNode();
|
||||
final _formKey = GlobalKey<FormState>();
|
||||
late Future<List<MIHLoyaltyCard>> cardList;
|
||||
late MihBannerAd _bannerAd;
|
||||
List<MIHLoyaltyCard> listOfCards = [];
|
||||
//bool showSelectedCardType = false;
|
||||
final ValueNotifier<String> shopName = ValueNotifier("");
|
||||
@@ -309,6 +311,7 @@ class _MihCardsState extends State<MihCards> {
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_bannerAd = MihBannerAd();
|
||||
cardList = MIHMzansiWalletApis.getLoyaltyCards(widget.signedInUser.app_id);
|
||||
shopController.addListener(shopSelected);
|
||||
cardSearchController.addListener(searchShop);
|
||||
@@ -368,6 +371,13 @@ class _MihCardsState extends State<MihCards> {
|
||||
cardList: searchShopName.value,
|
||||
signedInUser: widget.signedInUser,
|
||||
navIndex: 0,
|
||||
bannerAd: _bannerAd,
|
||||
onCardViewClose: () {
|
||||
setState(() {
|
||||
_bannerAd = MihBannerAd();
|
||||
});
|
||||
Navigator.pop(context);
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user