native method
Implementation
Widget native(Function callBack, MyAds type) {
if (admodel?.isnativeenable ?? false) {
if (admodel?.issdkads ?? false) {
if (admodel?.isfacebook ?? false) {
return FacebookNativeAd(
placementId: (getNativeAdType(type) == "1") ? (admodel
?.fBnativebannerAd ?? '') : (admodel?.fBnativeAd ?? ''),
adType: getNativeAdType(type) == "1"
? NativeAdType.NATIVE_BANNER_AD
: NativeAdType.NATIVE_AD,
width: double.infinity,
backgroundColor: (admodel?.iscustomeads ?? false)
? HexColor
.fromHex(
admodel?.customBackgroundColor ?? '')
: null,
titleColor:
(admodel?.iscustomeads ?? false) ? HexColor.fromHex(
admodel?.customTitleColor ?? '') : null,
descriptionColor:
(admodel?.iscustomeads ?? false) ? HexColor.fromHex(
admodel?.customTitleColor ?? '') : null,
buttonColor:
(admodel?.iscustomeads ?? false) ? HexColor.fromHex(
admodel?.customButtoncolor ?? '') : null,
buttonTitleColor:
(admodel?.iscustomeads ?? false) ? HexColor.fromHex(
admodel?.customTextcolor ?? '') : null,
buttonBorderColor:
(admodel?.iscustomeads ?? false) ? HexColor.fromHex(
admodel?.customButtoncolor ?? '') : null,
isMediaCover: true,
keepAlive: true,
//set true if you do not want adview to refresh on widget rebuild
keepExpandedWhileLoading: false,
// set false if you want to collapse the native ad view when the ad is loading
expandAnimationDuraion: 300,
//in milliseconds. Expands the adview with animation when ad is loaded
listener: (result, value) {
callBack.call();
print("Native Ad: $result --> $value");
},
);
} else {
return NativeExample(
colors: {
'background': admodel?.customBackgroundColor,
'button': admodel?.customButtoncolor,
'title': admodel?.customTitleColor,
'text': admodel?.customTextcolor,
},
nativeType: getNativeAdType(type),
isCustomeads: admodel?.iscustomeads ?? false,
ids: (admodel?.isadmobad ?? false)
? admodel?.admobnativeAd
: admodel?.nativeAd);
}
} else {
return BlurViewWidget(
viewId: DateTime
.now()
.microsecondsSinceEpoch
.toString(),
type: getNativeAdType(type),
onBlurViewWidgetCreated: (controller) {
callBack.call();
},
);
}
}
return Container();
}