showAd method

  1. @override
Future<void>? showAd({
  1. required BuildContext context,
  2. required Map<String, dynamic> adData,
  3. int? width,
  4. int? height,
  5. int? x,
  6. int? y,
  7. String? adLabelText,
  8. Alignment? adLabelAlignment,
  9. void onAdClicked(
    1. Map? ad
    )?,
  10. void onAdAppeared(
    1. Map? ad,
    2. String? trackingId
    )?,
})
override

Displays a picture-in-picture ad with the specified configuration.

context - Required BuildContext for calculating dimensions adData - Required ad metadata to display the PIP ad width - Optional width of the PIP ad view in pixels height - Optional height of the PIP ad view in pixels x - Optional X-axis coordinate for ad positioning y - Optional Y-axis coordinate for ad positioning adLabelText - Optional text for the ad label adLabelAlignment - Optional alignment for the ad label 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,
  int? x,
  int? y,
  String? adLabelText,
  Alignment? adLabelAlignment,
  void Function(Map? ad)? onAdClicked,
  void Function(Map? ad, String? trackingId)? onAdAppeared,
}) {
  return _pipAdView.showPipAdView(
      context: context,
      adData: adData,
      width: width,
      height: height,
      x: x,
      y: y,
      adLabelText: adLabelText,
      adLabelAlignment: AlignmentUtils.alignmentToString(adLabelAlignment),
      onAdClicked: onAdClicked,
      onAdAppeared: onAdAppeared,
      config: _config);
}