freestar-archive / freestarcapital-freestar_flutter_plugin

Other
4 stars 2 forks source link

Sometimes a Banner Ad isn't centered horizontally (Android, iOS) #2

Open alien190 opened 3 years ago

alien190 commented 3 years ago

Banner Ad widget:

class BannerWidget extends StatefulWidget {
  BannerWidget({Key? key}) : super(key: key);

  @override
  BannerWidgetState createState() => _BannerWidgetState();
}

class _BannerWidgetState extends State<BannerWidget> {
  final BannerAd _bannerAd;

  _BannerWidgetState()
      : _bannerAd = BannerAd.from(
          null,
          BannerAd.AD_SIZE_BANNER_320x50,
          null,
          true,
        );

  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Container(
      width: 320,
      height: 50,
      child: _bannerAd,
    );
  }
}

Usage:

Column(
    mainAxisSize: MainAxisSize.max,
    children: [
      Expanded(
        child: ScreenContnet(),
      ),
      SafeArea(
        top: false,
        left: false,
        right: false,
        child: BannerWidget(),
      ),
    ],
  );

iOS 14.5 simulator iPad Pro (12 9-inch) (5th generation) Simulator Screen Shot - iPad Pro (12 9-inch) (5th generation)

Sony Xperia XZ1 Compact Android 9 Physical Android device

elkhalifte commented 3 years ago

Try out this

Center(
    child: _bannerAd
)
alien190 commented 3 years ago

@elkhalifte thanks, I have tried, result is the same. Moreover, a banner may be centered or not centered randomly and unpredictable. It doesn't depend on the Flutter layout.

elkhalifte commented 3 years ago

i have made changes to this plugin. please check if this works so i could make pull request

add this to your pubspec.yaml dependencies

freestar_flutter_plugin:
    git:
      url: https://github.com/elkhalifte/freestar_flutter_plugin.git
kkawai commented 3 years ago

Hello! Thank you for your feedback and potential fix. Just FYI we've pushed out a new update to our flutter plugin which fixes the banner alignment issue. Please check it out when you get a chance.

On Tue, Sep 21, 2021 at 5:22 AM elkhalifte @.***> wrote:

i have made changes to this plugin. please check if this works so i could make pull request

add this to your pubspec.yaml dependencies

freestar_flutter_plugin: git: url: https://github.com/elkhalifte/freestar_flutter_plugin.git

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/freestarcapital/freestar_flutter_plugin/issues/2#issuecomment-923932385, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACZSJAACY3WSJX26JHZENDUDB2KDANCNFSM5B3LYGSA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.