Flutterfire: [firebase_admob] How to hide the ad when the current scaffold contains a bottomNavigationBar

Created on 30 Dec 2019  路  2Comments  路  Source: FirebaseExtended/flutterfire

Describe the bug
The ad is showing on top of my bottomNavigationBar so the application is unusable.

To Reproduce
Steps to reproduce the behavior:

  1. Use firebase AdMob create a banner ad
  2. 'Show ad like this:
BannerAd smartSizeBanner = BannerAd(
  adUnitId: config.bannerUnitId,
  size: AdSize.smartBanner,
  listener: (MobileAdEvent event) {
    print("BannerAd event is $event");
    FirebaseAnalytics().logEvent(name: event.toString());
  },
);
smartSizeBanner.load();
smartSizeBanner.show(
   anchorType: AnchorType.bottom
);
  1. Use a scaffold to show a bottomNavigationBar:
Widget build(BuildContext context) {
  return Scaffold(
    ...
    bottomNavigationBar: BottomNavigationBar(...),
    ...
  );
}

Expected behavior
Maybe hide the ad when the current scaffold contains a bottomNavigationBar, or move the ad above the bottomNavigationBar

question

Most helpful comment

The show method has anchorOffset parameter that you can use in this case

    banner.show(
              anchorOffset: 60.0,
              anchorType: AnchorType.bottom,
              horizontalCenterOffset: 0.0,
            );

All 2 comments

The show method has anchorOffset parameter that you can use in this case

    banner.show(
              anchorOffset: 60.0,
              anchorType: AnchorType.bottom,
              horizontalCenterOffset: 0.0,
            );

Thanks, it works perfectly

Was this page helpful?
0 / 5 - 0 ratings