feature/publicite #37

Merged
v4l3n71n merged 5 commits from feature/publicite into main 2025-02-23 21:20:25 +00:00
2 changed files with 39 additions and 3 deletions
Showing only changes of commit 47c014cdda - Show all commits

View File

@ -21,7 +21,12 @@ import 'MapboxPages.dart';
import 'ListItemByOrganizers.dart';
import 'EditEvent.dart';
void main() {
import '../classes/ad_helper.dart';
import 'package:google_mobile_ads/google_mobile_ads.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await MobileAds.instance.initialize();
initializeDateFormatting("fr_FR", null).then((_) => (const MyApp()));
}
@ -69,6 +74,8 @@ class ItemMenu extends StatefulWidget {
}
class _ItemMenuState extends State<ItemMenu> with ShowAlertDialog {
BannerAd? _bannerAd;
String listUser = "";
String eventName = "";
String eventStartDate = "";
@ -84,6 +91,11 @@ class _ItemMenuState extends State<ItemMenu> with ShowAlertDialog {
@override
void initState() {
super.initState();
AdHelper.createBannerAd(() => setState(() {})).then((ad) {
setState(() {
_bannerAd = ad;
});
});
_getEventInfos();
}
@ -174,6 +186,12 @@ class _ItemMenuState extends State<ItemMenu> with ShowAlertDialog {
body: SingleChildScrollView(
child: Column(
children: <Widget>[
_bannerAd == null
? SizedBox.shrink()
: SizedBox(
height: _bannerAd!.size.height.toDouble(),
width: _bannerAd!.size.width.toDouble(),
child: AdWidget(ad: _bannerAd!)),
Padding(
padding: const EdgeInsets.only(top: 60.0),
child: Image.network(

View File

@ -16,7 +16,12 @@ import '../classes/eventAdded.dart';
import '../variable/globals.dart' as globals;
void main() {
import '../classes/ad_helper.dart';
import 'package:google_mobile_ads/google_mobile_ads.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await MobileAds.instance.initialize();
runApp(MyApp());
}
@ -45,6 +50,8 @@ class UpdateeventImage extends StatefulWidget {
class _UpdateeventImageState extends State<UpdateeventImage>
with ShowAlertDialog, ShowEventDialog {
BannerAd? _bannerAd;
TextEditingController inputName = TextEditingController();
TextEditingController inputDate = TextEditingController();
@ -308,8 +315,13 @@ class _UpdateeventImageState extends State<UpdateeventImage>
@override
void initState() {
start();
super.initState();
AdHelper.createBannerAd(() => setState(() {})).then((ad) {
setState(() {
_bannerAd = ad;
});
});
start();
}
final _formKey = GlobalKey<FormState>();
@ -426,6 +438,12 @@ class _UpdateeventImageState extends State<UpdateeventImage>
child: SingleChildScrollView(
child: Column(
children: <Widget>[
_bannerAd == null
? SizedBox.shrink()
: SizedBox(
height: _bannerAd!.size.height.toDouble(),
width: _bannerAd!.size.width.toDouble(),
child: AdWidget(ad: _bannerAd!)),
Padding(
padding: const EdgeInsets.only(top: 60.0),
child: Center(