0

我正在使用最新版本的google_mobile_ads: 0.13.0.

最小的可重现代码:

class _FooPageState extends State<FooPage> {
  BannerAd _bannerAd;

  @override
  void initState() {
    super.initState();
    _bannerAd = BannerAd(
      adUnitId: BannerAd.testAdUnitId,
      size: AdSize.largeBanner,
      request: AdRequest(),
      listener: BannerAdListener(),
    );
    _bannerAd.load();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text('Banner Ad')),
      body: Column(
        children: [
          Container(height: 100, color: Colors.blue),
          SizedBox(
            width: _bannerAd.size.width.toDouble(),
            height: _bannerAd.size.height.toDouble(),
            child: AdWidget(ad: _bannerAd),
          ),
        ],
      ),
    );
  }
}

这是输出,您可以看到AppBar' 的文本不可见,如果我删除ColumnAdWidget直接使用 ,它会按预期工作。

在此处输入图像描述

4

0 回答 0