import 'package:breatfeeding_tracker/app/home.dart';
import 'package:flutter/material.dart';
import 'package:unity_ads_plugin/unity_ads_plugin.dart';
import 'admanager.dart';
class Start extends StatefulWidget {
const Start({super.key});
@override
State<Start> createState() => _StartState();
}
class _StartState extends State<Start> {
void _loadAd(String placementId) {
UnityAds.load(
placementId: placementId,
onComplete: (placementId) {
setState(() {
placements[placementId] = true;
});
},
onFailed: (placementId, error, message) => null,
);
}
void _showAd(String placementId) {
setState(() {
placements[placementId] = false;
});
UnityAds.showVideoAd(
placementId: placementId,
onComplete: (placementId) {
_loadAd(placementId);
},
onFailed: (placementId, error, message) {
_loadAd(placementId);
},
onStart: (placementId) => null,
onClick: (placementId) => null,
onSkipped: (placementId) {
_loadAd(placementId);
},
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
decoration: BoxDecoration(
color: Colors.pink[200],
borderRadius: BorderRadius.circular(20)
),
padding:const EdgeInsets.all(20),
margin:const EdgeInsets.all(20) ,
child: Column(
children: [
Flexible(child: Image.asset('assets/icon.png')),
SizedBox(
width: MediaQuery.sizeOf(context).width,
height: 60,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: Colors.white,
),
onPressed: () {
Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute(builder: (builder) => const Home()),
(Route<dynamic> route) => false);
},
child: const Text(
'START',
style: TextStyle(
fontWeight: FontWeight.bold, color: Colors.pink),
)),
),
],
),
),
);
}
}
Comments
Post a Comment