sakebook / flutter_native_ads

Show AdMob Native Ads use PlatformView
https://pub.dev/packages/native_ads
Apache License 2.0
66 stars 32 forks source link

Ios UIKitView Click Area Issue #35

Open cadinz opened 4 years ago

cadinz commented 4 years ago

Duplicate click events while using UIKitView.

Here's how it's reproduced. When you place a native ad in the widget, use Drawer, and click where the ad is located to move to a screen such as "Navigator.push()" the url will launch.

In addition, the same thing happens when you try to move a screen by attaching a widget such as "GestureDetector" over a native ad.

Below is a code that can reproduce the problem.

class TextPage extends StatefulWidget { @override _TextPageState createState() => _TextPageState(); }

class _TextPageState extends State {

@override Widget build(BuildContext context) { return MaterialApp( home: Scaffold( drawer: Drawer(child: Column( children: [ CupertinoButton( onPressed: (){ Navigator.push(context, MaterialPageRoute(builder: (context){ return Center(child: Container(color: Colors.red,)); })); }, child: Container(height: 100,color: LocalizedStrings.next()), ), CupertinoButton( onPressed: (){ Navigator.push(context, MaterialPageRoute(builder: (context){ return Center(child: Container(color: Colors.red,)); })); }, child: Container(height: 100,color: LocalizedStrings.next()), ), CupertinoButton( onPressed: (){ Navigator.push(context, MaterialPageRoute(builder: (context){ return Center(child: Container(color: Colors.red,)); })); }, child: Container(height: 100,color: LocalizedStrings.next()), ), CupertinoButton( onPressed: (){ Navigator.push(context, MaterialPageRoute(builder: (context){ return Center(child: Container(color: Colors.red,)); })); }, child: Container(height: 100,color: LocalizedStrings.next()), ), CupertinoButton( onPressed: (){ Navigator.push(context, MaterialPageRoute(builder: (context){ return Center(child: Container(color: Colors.red,)); })); }, child: Container(height: 100,color: LocalizedStrings.next()), ), ], ),), appBar: AppBar( title: const Text('NativeAds example app'), ), body: Center( child: Container( height: ScreenUtil().setWidth(600), child: NativeAdView( androidParam: AndroidParam() ..placementId = "" // test ..packageName = "" ..layoutName = "" ..attributionText = "AD", iosParam: IOSParam() ..placementId = "ca-app-pub-3940256099942544/3986624511" // test ..bundleId = "com.dubberss.koo.dub2" ..layoutName = "UnifiedNativeAdView" ..attributionText = "AD", onAdImpression: () => print("onAdImpression!!!"), onAdClicked: () => print("onAdClicked!!!"), onAdFailedToLoad: (Map<String, dynamic> error) => print("onAdFailedToLoad!!! $error"), )), )), ); }

@override void initState() {} }

I think there is a problem when you click on the screen and use "Navigator.push" etc