use many pub in different page
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'classes/ad_helper.dart';
|
||||
import 'dart:convert';
|
||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||
|
||||
import 'classes/ad_helper.dart';
|
||||
import 'package:google_mobile_ads/google_mobile_ads.dart';
|
||||
|
||||
import 'dart:io';
|
||||
@@ -39,6 +39,7 @@ class LoginDemo extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _LoginDemoState extends State<LoginDemo> with ShowAlertDialog {
|
||||
BannerAd? _bannerAd;
|
||||
TextEditingController inputPseudo = TextEditingController();
|
||||
TextEditingController inputPassword = TextEditingController();
|
||||
Future<void> _login(BuildContext context) async {
|
||||
@@ -134,18 +135,16 @@ class _LoginDemoState extends State<LoginDemo> with ShowAlertDialog {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
AdHelper.loadBannerAd(setState);
|
||||
AdHelper.createBannerAd(() => setState(() {})).then((ad) {
|
||||
setState(() {
|
||||
_bannerAd = ad;
|
||||
});
|
||||
});
|
||||
|
||||
_checkLocationPermission();
|
||||
start();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
AdHelper.disposeAd(); // Dispose of ad when the widget is removed
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
Future<void> _checkLocationPermission() async {
|
||||
PermissionStatus status = await Permission.location.status;
|
||||
|
||||
@@ -196,6 +195,13 @@ class _LoginDemoState extends State<LoginDemo> 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: Center(
|
||||
@@ -266,12 +272,6 @@ class _LoginDemoState extends State<LoginDemo> with ShowAlertDialog {
|
||||
Navigator.push(
|
||||
context, MaterialPageRoute(builder: (_) => AddProfile()));
|
||||
}),
|
||||
if (AdHelper.isBannerAdLoaded)
|
||||
SizedBox(
|
||||
height: AdHelper.bannerAd!.size.height.toDouble(),
|
||||
width: AdHelper.bannerAd!.size.width.toDouble(),
|
||||
child: AdWidget(ad: AdHelper.bannerAd!),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
Reference in New Issue
Block a user