[英]how to place ads below or above BottomNavigationBar in Flutter
I want to place google_mobile_ads' Banner Ad just above or below the BottomNavigationBar in Flutter.我想在 Flutter 的 BottomNavigationBar 上方或下方放置 google_mobile_ads 的横幅广告。
I tried to place the BottomNavigationBar in Container ad add Margin, but there is no option to add 2 childs inside the Container.我尝试将 BottomNavigationBar 放置在 Container 广告添加边距中,但没有选项可以在 Container 内添加 2 个子项。
I tried to add a Column widget inside the bottomnavigationbar but the column goes to the up top of the page.我试图在底部导航栏中添加一个 Column 小部件,但该列转到页面的顶部。
Any ideas on how I can make place for google_mobile_ads just above or below the bottomnavigationbar?关于如何在底部导航栏上方或下方放置 google_mobile_ads 的任何想法?
I can share the code, but I need advise or guidance or pointers on how it can be achieved.我可以分享代码,但我需要关于如何实现它的建议或指导或指针。
Wrap in a column in MaterialApp and expand Scaffold body to fill Ad to the bottom在 MaterialApp 中包裹一列并展开 Scaffold body 以将 Ad 填充到底部
MaterialApp:
Column(:[
Expanded(Scaffold),
AdWidget,
])
There are many ways to achieve this.有很多方法可以实现这一目标。 one would be to separate your scaffold and Ad container like this:一种是将脚手架和广告容器分开,如下所示:
return Column(
children:[
Expanded(child: Scaffold(),
SizedBox(height: 50, child: AdContainer())
]
)
another way would be to add it in the bottom nav bar:另一种方法是将其添加到底部导航栏中:
bottomNavigationBar: SizedBox(
height = 200,
child: Column(
children: [
BottomNav(),
AdContainer()
]
)
)
That's how I dealt with it我就是这样处理的
bottomNavigationBar: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.end,
children: [
AdvertisementWidget(),
BottomNavigationBar(),
],
)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.