Native Ad builder and placeholders - bdlukaa/native_admob_flutter GitHub Wiki
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.
controller
CAN save the ad state. The NativeAd
does NOT need to be rendered on the screen
Note: The 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 |
---|