Banner Placement
Banner is a fixed-purpose ad slot. Natively, Banner and Feed are the same widget with a different format, so BannerPlacementConfig takes the same fields as FeedPlacementConfig. The widget takes no space until the ad fills, and collapses to 0 on a no-fill or a timeout.
The plugin's example app, shipped with the teads_flutter package, includes a working screen for this format. Use it as a reference while you set up this placement.
Example
BannerPlacement(
config: BannerPlacementConfig(
widgetId: 'MB_10', // Provided by your Teads account manager
installationKey: 'YOUR_INSTALLATION_KEY',
articleUrl: 'https://example.com/article/123',
),
onReady: () => debugPrint('Banner ready'),
onFailed: (TeadsAdError error) => debugPrint('Banner failed: ${error.reason}'),
)
Toggling dark mode at runtime
BannerPlacementConfig.darkMode only sets the value the banner is constructed with. To change it on a loaded banner, hold a BannerController:
class _BannerScreenState extends State<BannerScreen> {
final _controller = BannerController();
bool _darkMode = false;
Widget build(BuildContext context) {
return Column(
children: [
BannerPlacement(config: bannerConfig, controller: _controller),
Switch(
value: _darkMode,
onChanged: (value) {
setState(() => _darkMode = value);
_controller.toggleDarkMode(value);
},
),
],
);
}
}
Calls made before the banner has loaded are buffered and applied as soon as it does.
Rotation
Nothing to set up on either platform. Since 1.2.0 the iOS Banner re-measures itself when
its width changes, so a rotation needs no forwarding. An existing
TeadsFlutterPlugin.forwardViewWillTransition call from an earlier version is harmless.
Best Practices
The native SDK's test-display flag is a process-wide singleton, and the plugin does not yet guard against multiple concurrent Banner placements — the last one created wins. Keep to one live BannerPlacement at a time.
Pointing a Banner at a Feed widget ID (such as MB_1) serves a feed, which looks like a broken banner.
No widget may cover the placement — not even a transparent overlay. It breaks viewability measurement.
Configuration
Every BannerPlacementConfig field and BannerPlacement/BannerController member is in Settings.
Ad Lifecycle Listener
Banner shares the Media/Interstitial callbacks: onReady, onFailed, onClicked, onClickedOrganic and onEvent. See Placement Events Listener.
Checklist
- ✅ Ensure Brand Safety is enabled: pass the real
articleUrl - ✅ Ensure you comply with privacy legal requirements (GDPR/CCPA/GPP)
- ✅ Comply with app-ads.txt
- ✅ Handle
onFailed - ✅ Test with the IDs in Test PIDs and Configurations