NativeAdCarouselWidget class
A Flutter widget that displays a carousel of Native Ads using NativeAd objects.
This widget creates a scrollable carousel (horizontal or vertical) of native product ads, each displaying product information like name, price, image, and other details.
Example usage:
NativeAdCarouselWidget(
nativeAds: listOfNativeAds,
config: osmosConfig,
cliUbid: "user123",
scrollDirection: Axis.horizontal,
nativeAdType: NativeAdType.verticalLarge,
height: 300,
width: 200,
nativeAdHeight: 250,
nativeAdWidth: 180,
customStyle: customNativeAdStyle,
onAdClicked: (ad) {
print('Native Ad clicked: $ad');
},
onViewLoad: (ad) {
print('Native Ad loaded: $ad');
},
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- NativeAdCarouselWidget
Constructors
-
NativeAdCarouselWidget({Key? key, required List<
NativeAd> nativeAds, required OsmosConfig config, required String cliUbid, required Axis scrollDirection, required NativeAdType nativeAdType, double? height, double? width, double nativeAdHeight = 250, double nativeAdWidth = 180, NativeAdStyle? customStyle, Widget? customCtaView, Widget? customBadgeView, String? adLabelText, Alignment adLabelAlignment = Alignment.topLeft, ScrollController? scrollController, void onAdClicked(Map<String, dynamic> )?, void onViewLoad(Map<String, dynamic> )?}) -
const
Properties
- adLabelAlignment → Alignment
-
Alignment for ad label
final
- adLabelText → String?
-
Ad label text (e.g., "Sponsored")
final
- cliUbid → String
-
Client unique identifier for tracking
final
- config → OsmosConfig
-
Configuration object for Osmos
final
- customBadgeView → Widget?
-
Custom badge view widget
final
- customCtaView → Widget?
-
Custom CTA view widget
final
- customStyle → NativeAdStyle?
-
Custom styling for native ads
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- height → double?
-
Height of the carousel container
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- nativeAdHeight → double
-
Height of individual native ads
final
-
nativeAds
→ List<
NativeAd> -
List of NativeAd objects to display in the carousel
final
- nativeAdType → NativeAdType
-
Type of native ad (horizontal/vertical with size variants)
final
- nativeAdWidth → double
-
Width of individual native ads
final
-
onAdClicked
→ void Function(Map<
String, dynamic> )? -
Callback when an ad is clicked
final
-
onViewLoad
→ void Function(Map<
String, dynamic> )? -
Callback when an ad view is loaded/visible
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scrollController → ScrollController?
-
External scroll controller (optional)
final
- scrollDirection → Axis
-
Scroll direction - horizontal or vertical
final
- width → double?
-
Width of the carousel container
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< NativeAdCarouselWidget> -
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