flutter - Flutter 从 firebase_admob 切换到 google_mobile_ads
问题描述
我有一个Flutter移动应用程序(Android和IOS)。我正在尝试从 firebase_admob 切换到google_mobile_ads。
在firebase_admob中,我曾经使用下面的构建器在底部显示横幅广告。无论用户导航到哪里,以下代码都会将横幅广告粘贴在我的应用程序底部。
home: Dashboard(),
builder: (context, widget) {
return new Padding(
child: widget,
padding: new EdgeInsets.only(bottom: paddingBottom),
);
},
切换到google_mobile_ads后,我相应地更改了代码并尝试将横幅粘贴在底部,但是当我转到其他屏幕时,广告消失了。firebase_admob之前没有发生这种情况。
home: Dashboard(),
builder: (context, widget) {
if (!_loadingAnchoredBanner) {
_loadingAnchoredBanner = true;
_createAnchoredBanner(context);
}
return (_anchoredBanner != null) ?
Container(
color: Colors.green,
width: _anchoredBanner.size.width.toDouble(),
height: _anchoredBanner.size.height.toDouble(),
child: AdWidget(ad: _anchoredBanner),
): Container();
},
现在,它根本不显示仪表板屏幕,而是在应用程序启动时仅在屏幕中央显示横幅广告。请帮忙。
解决方案
推荐阅读
- javascript - 由于 axios 获取请求,无法编译 vue.js 应用程序
- google-cloud-platform - 我可以在特定的 GCP 网络上训练和提供 Google Cloud ML 模型吗?
- hibernate - 如何让 JPA 与 Hibernate 提供程序自动扫描实体类
- python-3.x - 使用 pyqt5 读取特定值时更改 QLCDNumber 颜色
- c# - TextAlign 不适用于 Controls.Find
- excel - Excel - 根据标准对数据集中的值求和
- ios - UITableView 单元格中的 UIStackView 导致滚动时抖动
- sockets - Alpakka UDP:如何通过已经绑定的套接字响应接收到的数据报?
- javascript - 模拟 Tab 键按下 (Ember.js)
- django - Django memoize 每个请求