flutterfirebase-admob

How to position Firebase Admob on the bottom after keyboard is closed in Flutter?


I am using firebase_admob package. I use the following code and manage to make the Admob banner show on top of keyboard.

    @override
      Widget build(BuildContext context) {
        myBanner.show(
          anchorOffset: MediaQuery.of(context).viewInsets.bottom, anchorType: AnchorType.bottom)
        );

    return Scaffold(
      //Other codes
        );
    }

However, when the keyboard is closed, the banner won't move to bottom. How to solve this?


Solution

  • Problem solved by using [admob_flutter] package which can simply add the banner as a widget and we can position it anywhere we want.

    AdmobBanner(
      adUnitId: getBannerAdUnitId(),
      adSize: AdmobBannerSize.BANNER,
    )