1

How can I place a banner ad on the top of the top App Bar in Flutter? I have the banner ad at the bottom of the bottom app bar as shown below. I want to move it to the top, so that it becomes the first widget of the screen.

enter image description here

jdevp2
  • 371
  • 5
  • 15

2 Answers2

2

Try preferredSizeAppbar widget and increase the app bar height and use you banner.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
sahilatahar
  • 568
  • 2
  • 13
1

You can use PreferredSize or flexibleSpace,

PreferredSize
appBar: PreferredSize(
    preferredSize: Size.fromHeight(120), // change height of ads as you like
    child: Container(
        child: // here is ads
    )
)

or

flexibleSpace
appBar: AppBar(
    toolbarHeight: 120, // Set this appbar height
    flexibleSpace: Container(
        child: Text("this is add"),  // make container of your ads
    ),
    title: Text('Material App Bar'),
),
mohammad esmaili
  • 1,614
  • 2
  • 4
  • 17