Skip to content
This repository has been archived by the owner on Mar 12, 2022. It is now read-only.

Native Ad builder and placeholders

Bruno D'Luka edited this page Feb 8, 2021 · 4 revisions

AdBuilder

The builder of the ad. The ad won't be reloaded if the builder changes

DO:

NativeAd(
  builder: (context, child) {
    return Container(
      // Applies a blue color to the background.
      // You can use anything here to build the ad.
      // The ad won't be reloaded
      color: Colors.blue,
      child: child,
    );
  }
)

DON'T:

Container(
  color: Colors.blue,
  child: NativeAd(),
)

If you change the Container to something else (to a DecoratedBox, for example), the ad will be reloaded. You can use the builder for such things.

Note: The controller CAN save the ad state. The NativeAd does NOT need to be rendered on the screen

Loading and Error placeholders

Loading and Error placeholders will be shown when the ad is loading or has a load error, respectively.

Usage

NativeAd(
  error: Text('error'),
  loading: Text('loading'),
),

You can use the controller to have better control on Ad Events.


Next: Using the controller and listening to events