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

View File

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