flutter_native_admob
flutter_native_admob copied to clipboard
about numberAds parameter
Hi,
I'd like to ask about numberAds param. It's hard for me to figure out how to use it.
I thought it would cache 4 ads and show the cache with the index Isn't this how it's supposed to work? I put up my code below.
There are not much of docs or example around it.
Thanks for the awesome project.
import 'package:flutter/material.dart';
import 'package:flutter_native_admob/flutter_native_admob.dart';
import 'package:flutter_native_admob/native_admob_controller.dart';
class AdmobPage4 extends StatefulWidget {
@override
_AdmobPage4State createState() => _AdmobPage4State();
}
class _AdmobPage4State extends State<AdmobPage4> {
static const _adUnitID = "ca-app-pub-5046562646162404/5259802678";
NativeAdmobController _nativeAdController;
@override
void initState() {
_nativeAdController = NativeAdmobController();
_nativeAdController.setAdUnitID(_adUnitID, numberAds: 4);
_nativeAdController.setTestDeviceIds(["C3F8FA9E55B3AE3C8D581B59F724E8B0"]);
super.initState();
}
@override
void dispose() {
_nativeAdController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: ListView.builder(
itemCount: 200,
itemBuilder: (context, index) {
if (index % 2 == 0) {
int idx = (index / 2).floor();
return Container(
height: 330,
padding: EdgeInsets.all(10),
margin: EdgeInsets.only(bottom: 20.0),
child: NativeAdmob(
numberAds: idx,
loading: Container(color: Colors.red),
adUnitID: _adUnitID,
controller: _nativeAdController,
),
);
}
return Container(
margin: EdgeInsets.only(bottom: 20.0),
height: 200.0,
color: Colors.green,
);
},
),
),
);
}
}
Hey Did you get your answer. Because I am also didn't able to get what this numberAds do.
not really. I don't think it works properly. should we reopen and get some answers?
Yes please reopened it because I want to show different ads on each impression
any update on this?