简体   繁体   中英

How to show interstitial ads every 3 clicks in flutter dart

我每次点击按钮时都使用 Ironsource 广告和插页式广告,这对我的用户不利,我希望广告每 3 次点击显示一次。

You can set this by custom way,like Define a local variable for count.

Var clickCount=0;

Then,

RaisedButton(
 shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)),
 onPressed: () {
setState(() { 
clickCount=clickCount+1;
If(clickCount>2){
//call your code here.


//after your action performe.
//again you will set count zero.
//clickCount=0;
}
 });
},
 child: Text("Button"),
 )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM