showVerticalAd method
Widget
showVerticalAd({
- required Map<
String, dynamic> adData, - NativeAdType? adType,
- required double width,
- double? height,
- String? adLabelText,
- Alignment? adLabelAlignment,
- Widget? customCtaView,
- Widget? customBadgeView,
- NativeAdStyle? customStyle,
- void onAdClick()?,
- void onViewAppeared()?,
override
Creates a vertical native ad widget.
adData - Required ad metadata to display the native ad
adType - Optional type of native ad (vertical variant)
width - Required width of the native ad in logical pixels
height - Optional height of the native ad in logical pixels
adLabelText - Optional label text displayed on the native ad
adLabelAlignment - Optional Flutter Alignment for the label text
customCtaView - Optional custom call-to-action view
customBadgeView - Optional custom badge view
customStyle - Optional custom styling for the native ad
onAdClick - Optional callback triggered when the ad is clicked
onViewAppeared - Optional callback triggered when the ad appears
Returns a Widget that displays the vertical native advertisement
Implementation
@override
Widget showVerticalAd({
required Map<String, dynamic> adData,
NativeAdType? adType,
required double width,
double? height,
String? adLabelText,
Alignment? adLabelAlignment,
Widget? customCtaView,
Widget? customBadgeView,
NativeAdStyle? customStyle,
void Function(Map)? onAdClick,
void Function(Map, String)? onViewAppeared,
}) {
final finalAdType = adType ?? _determineVerticalAdType(width, height);
final alignment = adLabelAlignment ?? Alignment.topLeft;
return NativeAdVerticalView(
adType: finalAdType,
width: width,
height: height,
adLabelText: adLabelText,
adLabelAlignment: alignment,
customCtaView: customCtaView,
customBadgeView: customBadgeView,
customStyle: customStyle,
onAdClicked: onAdClick != null ? (ad) => onAdClick(ad) : null,
onAdLoaded:
onViewAppeared != null ? (ad) => onViewAppeared(ad, '') : null,
ad: adData,
config: _config,
);
}