navigation-drawer - Firebase Admob - 与导航抽屉重叠的横幅广告
问题描述
添加 firebase_admob 插件并启动并运行后,我注意到它覆盖了 fab 和导航抽屉。我已经使用persistentFooterButtons 修复了工厂,但我似乎找不到导航抽屉的解决方法。任何帮助深表感谢。
在下面找到一个示例实现,以在颤振中重新创建问题:
import 'package:flutter/material.dart';
import 'package:firebase_admob/firebase_admob.dart';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
title: 'Firebase AdMob',
theme: new ThemeData(
primarySwatch: Colors.blue,
),
home: new MyHomePage(title: 'AdMob Test App'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => new _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
int _counter = 0;
BannerAd myBanner;
void _incrementCounter() {
setState(() {
_counter++;
});
}
@override
void initState() {
super.initState();
myBanner = new BannerAd(
// Replace the testAdUnitId with an ad unit id from the AdMob dash.
// https://developers.google.com/admob/android/test-ads
// https://developers.google.com/admob/ios/test-ads
adUnitId: BannerAd.testAdUnitId,
size: AdSize.smartBanner,
targetingInfo: new MobileAdTargetingInfo(
// gender: MobileAdGender.unknown
),
listener: (MobileAdEvent event) {
print("BannerAd event is $event");
},
);
myBanner..load()..show(
// Banner Position
anchorType: AnchorType.bottom,
);
}
@override
void dispose() {
myBanner?.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
title: new Text(widget.title),
),
drawer: new Drawer(),
body: new Center(
child: new Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
new Text('You have pushed the button this many times:'),
new Text('$_counter', style: Theme.of(context).textTheme.display1),
],
),
),
floatingActionButton: new FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: new Icon(Icons.add),
), // This trailing comma makes auto-formatting nicer for build methods.
);
}
}
解决方案
我对此有点晚了,但遇到了同样的问题。
我的导航抽屉位于一个具有固定高度的可滚动容器中,因此它在添加上方停止并且可以滚动。可能不是完美的答案,但对我有用。
推荐阅读
- ios - 更多选项卡视图控制器选择器及其各自的视图控制器顶部的白条
- sql - 如何从给定的 json 中获取所有“url”元素
- c# - 如何使用 MVVM 模式将子元素添加到 WPF 中的网格
- collections - 创建集合 Solr 云 - 服务器错误导致:java.lang.NoClassDefFoundError: org/apache/lucene/analysis/util/TokenizerFactory
- css - 如何更改苹果支付按钮(Safari)中的边框半径
- gradle - 如何使用 Gradle 创建项目结构?
- sql - 为该特定用户授予选择权限后,视图中没有结果 - 默认用户看到结果
- c# - C# SQL Command .Fill 在 Firebird 服务器上调用时耗时过长,使用存储过程加入表
- javascript - TinyMCE 工具栏未显示
- c++ - 如何更改在 C++ 中使用 boost 库创建的共享内存的路径