Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter AdMob Banner Ad overlaps screen

I am working on a Flutter Application where I need to show an AdMob's Banner Ad. I have noticed that the banner overlaps my list view. I tried to search for the solution but I did not find anything much useful.

One solution I found is to provide fix margin of 50px at the bottom. I feel a little uncomfortable with this solution as I read somewhere that the screen size may affect this solution.

Also when I put a fake bottom bar then it also overlaps my bottom tab bar and bottom sheets.

Please see the below image for more details.

Thank you for your time.

enter image description here

like image 426
Sam Avatar asked Apr 01 '19 01:04

Sam


3 Answers

Set following params in the banner ad show() function:

bannerAd = Utils().myBanner
    ..load()
    ..show(
        anchorType: AnchorType.bottom,
        anchorOffset: 55.0);

And also need to set margin: const EdgeInsets.only(bottom: 55) on the container

like image 78
Mohammad Ashraful Kabir Avatar answered Oct 01 '22 22:10

Mohammad Ashraful Kabir


If you're using a Scaffold Widget, try using the persistentFooterButtons: parameter. Tutorial here: http://cogitas.net/show-firebase-admob-banner-ad-in-flutter/

like image 37
nemoryoliver Avatar answered Oct 01 '22 20:10

nemoryoliver


I found one solution for you my cast Banner bottom Flutter Application little bit padding. Fix it with below code.

var paddingBottom = 48.0;

new MaterialApp(
            debugShowCheckedModeBanner: false,
            title: 'Name',
            home: new MyHomePage(
              title: "NMame",
            ),
            builder: (context, widget) {
              final mediaQuery = MediaQuery.of(context);
              return new Padding(
                child: widget,
                padding: new EdgeInsets.only(bottom: paddingBottom),
              );
            },
            routes: <String, WidgetBuilder>{
                '/HomeScreen': (BuildContext context) =>
                    new MyHomePage(title: 'UPSC Question Papers')
              })

handle when the app is not getting loaded Ads

      if(event == MobileAdEvent.failedToLoad){
      setState(() {
        paddingBottom = 0.0;
      });
    }

Thank you

like image 38
Sonu Kumar Avatar answered Oct 01 '22 22:10

Sonu Kumar