CloudXBannerView class

A Flutter widget that displays a CloudX banner ad.

This widget handles the entire ad lifecycle automatically:

  • Creates and loads the ad on initialization
  • Displays the ad using platform views (AndroidView/UiKitView)
  • Cleans up resources on disposal

Basic usage:

CloudXBannerView(
  placementName: 'home_banner',
  listener: CloudXAdViewListener(
    onAdLoaded: (ad) => print('Banner loaded'),
    onAdDisplayed: (ad) => print('Banner displayed'),
    onAdHidden: (ad) => print('Banner hidden'),
    onAdClicked: (ad) => print('Banner clicked'),
    onAdLoadFailed: (error) => print('Banner load failed: $error'),
    onAdDisplayFailed: (error) => print('Banner display failed: $error'),
    onAdExpanded: (ad) => print('Banner expanded'),
    onAdCollapsed: (ad) => print('Banner collapsed'),
  ),
)

With controller for auto-refresh control:

final controller = CloudXAdViewController();

CloudXBannerView(
  placementName: 'home_banner',
  controller: controller,
)

// Control auto-refresh:
controller.startAutoRefresh();
controller.stopAutoRefresh();
Inheritance

Constructors

CloudXBannerView({required String placementName, Key? key, CloudXAdViewListener? listener, double? width, double? height, CloudXAdViewController? controller})
const

Properties

controller CloudXAdViewController?
Optional controller for programmatic control over the banner ad. Use this to start/stop auto-refresh.
final
hashCode int
The hash code for this object.
no setterinherited
height double?
Optional height for the banner (defaults to 50)
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
listener CloudXAdViewListener?
Optional listener for ad lifecycle events
final
placementName String
The placement name from your CloudX dashboard
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
width double?
Optional width for the banner (defaults to 320)
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<CloudXBannerView>
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