-
Notifications
You must be signed in to change notification settings - Fork 342
Description
Step 1: Describe your environment
native_template_example % flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.27.4, on macOS 15.4 24E248 darwin-x64)
[✓] Android toolchain - develop for Android devices (Android SDK version 36.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 16.3)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2024.1)
[✓] IntelliJ IDEA Community Edition (version 2023.3.4)
[✓] VS Code (version 1.99.0)
[✓] Connected device (2 available)
[✓] Network resources
• No issues found!
Plugin Version
6.0.0
Step 2: Describe the problem
AdWidget with child NativeAd takes all the space of its parent and loaded native ad is align to the top.
I like to have possibility to align/center NativeAd in AdWidget or know size of loaded native Ad to make native ads look good in UI.
Steps to Reproduce
-
Use native_template_example https://github.com/googleads/googleads-mobile-flutter/blob/main/samples/admob/native_template_example/
-
replace
SizedBox( height: MediaQuery.of(context).size.width * _adAspectRatioMedium, width: MediaQuery.of(context).size.width, child: AdWidget(ad: _nativeAd!), ),
with
SizedBox( height: MediaQuery.of(context).size.width * _adAspectRatioMedium, width: MediaQuery.of(context).size.width, child: Container( color: Colors.lightBlue, child: Center(child: AdWidget(ad: _nativeAd!))), ), -
run the app
-
use flutter inspector and click in lightBlue Container
Expected results:
Native Ad is centred in lightBlue Container
Actual results:
AndroidViewSurface takes all free space and ad is align to the top