showAd method
- required BuildContext context,
- required Map<
String, dynamic> adData, - int? width,
- int? height,
- String? alignment,
- String? adLabelText,
- Alignment? adLabelAlignment,
- int? x,
- int? y,
- void onAdClicked(
- Map? ad
- void onAdAppeared()?,
Displays an interstitial ad with the specified configuration.
context - Required BuildContext for calculating dimensions
adData - Required ad metadata to display the interstitial ad
width - Optional width of the interstitial ad view in pixels
height - Optional height of the interstitial ad view in pixels
alignment - Optional alignment of the ad on screen (default is "CENTER")
adLabelText - Optional text for the ad label
adLabelAlignment - Optional alignment for the ad label (default is "topLeading")
x - Optional X-axis offset for custom ad positioning (default is 0)
y - Optional Y-axis offset for custom ad positioning (default is 0)
onAdClicked - Optional callback triggered when the ad is clicked
onAdAppeared - Optional callback triggered when the ad appears
Returns a Future that completes when the ad is displayed
Implementation
@override
Future<void>? showAd({
required BuildContext context,
required Map<String, dynamic> adData,
int? width,
int? height,
String? alignment,
String? adLabelText,
Alignment? adLabelAlignment,
int? x,
int? y,
void Function(Map? ad)? onAdClicked,
void Function(Map? ad, String? tracking)? onAdAppeared,
}) {
return _interstitialAdView.showInterstitialAdView(
context: context,
adData: adData,
width: width,
height: height,
alignment: alignment,
adLabelText: adLabelText,
adLabelAlignment: AlignmentUtils.alignmentToString(adLabelAlignment),
x: x,
y: y,
onAdClicked: onAdClicked,
onAdAppeared: onAdAppeared,
config: _config);
}