Home > Blockchain >  Flutter: How to fix a container at the Bottom over all the screens on the App
Flutter: How to fix a container at the Bottom over all the screens on the App

Time:08-25

I want to use Ad mob on my app, but I want to use the same ad for all screens on my app. So one ad at the bottom of the screen, that dosn't change by navigating through the app.

How can I do that?

CodePudding user response:

You can use bottomSheet and place the widget based on your need.

return Scaffold(
  bottomSheet: showWidget ? Text("ad-banner") : null,

CodePudding user response:

You can do this with Expanded widget like this

return Scaffold(
      appBar: AppBar(
        title: Text("Header"),
      ),
      body: Column(
        children: <Widget>[
          Expanded(
            child: Container(
              alignment: Alignment.center,
              child: Text("Hello"),
            ),
          ),
          Container(
            height: 50,
            width: double.maxFinite,
            decoration: BoxDecoration(
              color: Colors.deepOrange,
            ),
            child: Row(
              mainAxisSize: MainAxisSize.max,
              mainAxisAlignment: MainAxisAlignment.spaceEvenly,
              children: <Widget>[
                IconButton(icon: Icon(Icons.arrow_left), onPressed: (){},),
                IconButton(icon: Icon(Icons.arrow_upward), onPressed: (){},),
              ],
            ),
          )
        ],
      ),
    );
  • Related