showPdaAd method
- required Map<
String, dynamic> ad, - required String cliUbid,
- NativeAdType? adType,
- required double width,
- double? height,
- double? imageHeight,
- bool layoutHorizontal = false,
- double mediaRatio = 0.6,
- double? plaItemWidth,
- double? plaItemHeight,
- NativeAdStyle? plaCustomStyle,
- Widget? plaCustomCtaView,
- Widget? plaCustomBadgeView,
- String? plaAdLabelText,
- String? adLabelText,
- Alignment? adLabelAlignment,
- Widget? customCtaView,
- Widget? customBadgeView,
- NativeAdStyle? customStyle,
- void onAdClicked()?,
- void onAdLoaded()?,
- void onProductClicked(
- dynamic
Creates a PDA (Product Display Ad) widget.
ad - Required ad data containing PDA information
adType - Optional type of native ad (affects PLA layout)
width - Required width of the PDA in logical pixels
height - Optional height of the PDA in logical pixels
imageHeight - Optional height of the media section
layoutHorizontal - Optional horizontal layout (media left, PLA right). Default: false (vertical)
mediaRatio - Optional media to PLA ratio for horizontal layout (0.0-1.0). Default: 0.6
plaItemWidth - Optional width of individual PLA items. Default: auto-calculated
plaItemHeight - Optional height of individual PLA items. Default: auto-calculated
plaCustomStyle - Optional custom styling for PLA items
plaCustomCtaView - Optional custom CTA view for PLA items
plaCustomBadgeView - Optional custom badge view for PLA items
plaAdLabelText - Optional label text for PLA items
cliUbid - Required client unique identifier for PLA tracking
adLabelText - Optional label text displayed on the 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 ad
onAdClicked - Optional callback triggered when the ad is clicked
onAdLoaded - Optional callback triggered when the ad loads
onProductClicked - Optional callback triggered when a product is clicked
Returns a Widget that displays the PDA advertisement
Implementation
@override
Widget showPdaAd({
required Map<String, dynamic> ad,
required String cliUbid,
NativeAdType? adType,
required double width,
double? height,
double? imageHeight,
bool layoutHorizontal = false,
double mediaRatio = 0.6,
double? plaItemWidth,
double? plaItemHeight,
NativeAdStyle? plaCustomStyle,
Widget? plaCustomCtaView,
Widget? plaCustomBadgeView,
String? plaAdLabelText,
String? adLabelText,
Alignment? adLabelAlignment,
Widget? customCtaView,
Widget? customBadgeView,
NativeAdStyle? customStyle,
void Function(Map<String, dynamic>)? onAdClicked,
void Function(Map<String, dynamic>)? onAdLoaded,
void Function(dynamic)? onProductClicked,
}) {
final alignment = adLabelAlignment ?? Alignment.topLeft;
// Create custom style from parameters
final customNativeStyle = PDAAdCustomStyle(
nativeAdWidth: plaItemWidth,
nativeAdHeight: plaItemHeight,
nativeStyle: plaCustomStyle ?? customStyle,
ctaButton: plaCustomCtaView ?? customCtaView,
pdaProductStyle: layoutHorizontal
? PdaProductStyle.horizontal
: PdaProductStyle.vertical,
nativeAdAppear: onAdLoaded != null
? (nativeAd) => onAdLoaded(nativeAd.toMap())
: null,
nativeAdClicked: onAdClicked != null
? (nativeAd) => onAdClicked(nativeAd.toMap())
: null,
);
// Create settings
final settings = PDAAdSettings(
width: width,
height: height,
adStyle: layoutHorizontal
? PdaProductStyle.horizontal
: PdaProductStyle.vertical,
adLabelText: plaAdLabelText ?? adLabelText,
adLabelAlignment: alignment,
badge: plaCustomBadgeView ?? customBadgeView,
pdaAdCustomStyle: customNativeStyle,
);
return PdaAdView(
ad: ad,
config: _config,
settings: settings,
width: width,
height: height,
onAdClicked: onAdClicked,
onAdLoaded: onAdLoaded,
onProductClicked: onProductClicked,
);
}