CloudXMRECView class

A Flutter widget that displays a CloudX MREC (Medium Rectangle) 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:

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

With controller for auto-refresh control:

final controller = CloudXAdViewController();

CloudXMRECView(
  placementName: 'home_mrec',
  controller: controller,
)

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

Constructors

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

Properties

controller CloudXAdViewController?
Optional controller for programmatic control over the MREC 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 MREC (defaults to 250)
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 MREC (defaults to 300)
final

Methods

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