Skip to content

[Feature Request] Aligning/Centering native template ads #1324

@pawdom-dev

Description

@pawdom-dev

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

  1. Use native_template_example https://github.com/googleads/googleads-mobile-flutter/blob/main/samples/admob/native_template_example/

  2. 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!))), ),

  3. run the app

  4. 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

Image

Metadata

Metadata

Assignees

Labels

feature requestFeature request covers a product enhancementnative adIssues related to Native Adp3-low

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions