diff --git a/Frontend/lib/mih_components/mih_package_components/mih_banner_ad.dart b/Frontend/lib/mih_components/mih_package_components/mih_banner_ad.dart index 95a43efb..b84bc754 100644 --- a/Frontend/lib/mih_components/mih_package_components/mih_banner_ad.dart +++ b/Frontend/lib/mih_components/mih_package_components/mih_banner_ad.dart @@ -13,6 +13,7 @@ class _MihBannerAdState extends State { BannerAd? _bannerAd; bool _isBannerAdLoaded = false; final adUnitId = AppEnviroment.bannerAdUnitId; + String errorMessage = ''; void _loadBannerAd() { _bannerAd = BannerAd( @@ -28,6 +29,9 @@ class _MihBannerAdState extends State { }, onAdFailedToLoad: (ad, err) { debugPrint('BannerAd failed to load: $err'); + setState(() { + errorMessage = 'Failed to load ad: ${err.message}'; + }); ad.dispose(); // Dispose the ad to free resources }, onAdOpened: (Ad ad) => debugPrint('$ad opened.'), @@ -60,7 +64,9 @@ class _MihBannerAdState extends State { width: _bannerAd!.size.width.toDouble(), height: _bannerAd!.size.height.toDouble(), child: AdWidget(ad: _bannerAd!)) - : SizedBox(), + : SizedBox( + child: Text(errorMessage), + ), ], ); } diff --git a/Frontend/pubspec.yaml b/Frontend/pubspec.yaml index 342415f1..3ce6d797 100644 --- a/Frontend/pubspec.yaml +++ b/Frontend/pubspec.yaml @@ -1,7 +1,7 @@ name: mzansi_innovation_hub description: "" publish_to: 'none' # Remove this line if you wish to publish to pub.dev -version: 1.1.12+83 +version: 1.1.12+84 environment: sdk: '>=3.5.3 <4.0.0'