MultiAdWidget class
A Flutter widget that displays a banner ad using platform views for Android and iOS.
This widget renders a native banner ad using a UiKitView on iOS and an PlatformViewLink on Android.
It also communicates with the native platform to receive ad events like onAdClicked and onAdAppear.
Example usage:
BannerAdWidget(
adData: adMap,
height: 250,
width: 300,
onAdClick: (ad) {
print('Ad clicked: $ad');
},
onViewAppeared: (ad, ubid) {
print('Ad appeared: $ad, cliUbid: $ubid');
},
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- MultiAdWidget
Constructors
-
MultiAdWidget({Key? key, required Map<
String, dynamic> adData, double? height, double? width, void onViewAppeared(Map? adData, String? trackingId)?, void onAdClick(Map? adData, Map? clickedItemData, String? destinationUrl)?, String? adLabelText, String? adLabelAlignment, required OsmosConfig config}) -
Creates a MultiAdWidget.
const
Properties
-
adData
→ Map<
String, dynamic> -
The ad data required to render the banner ad.
Must include keys like
elements,uclid, and optionallycliUbid.final - adLabelAlignment → String?
-
final
- adLabelText → String?
-
Optional adLabelText of the banner ad to add label to the banner ad
final
- config → OsmosConfig
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- height → double?
-
Optional height of the banner ad in logical pixels.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- onAdClick → void Function(Map? adData, Map? clickedItemData, String? destinationUrl)?
-
Optional callback triggered when the ad is clicked.
final
- onViewAppeared → void Function(Map? adData, String? trackingId)?
-
Optional callback triggered when the ad view appears on the screen.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- width → double?
-
Optional width of the banner ad in logical pixels.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< MultiAdWidget> -
Creates the mutable state for this widget at a given location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited