import 'package:flutter/material.dart'; import 'package:logger/logger.dart'; import 'package:flutter/services.dart'; var log = Logger(); class WelcomePage extends StatefulWidget { WelcomePage( {@required this.nextRoute, this.timeout = const Duration(seconds: 5), Key key}) : assert(nextRoute != null), super(key: key); final String nextRoute; final Duration timeout; WelcomePageState createState() => WelcomePageState(); } class WelcomePageState extends State { void _goToNext() async { // Restore overlays to exit fullscreen mode await SystemChrome.setEnabledSystemUIOverlays(SystemUiOverlay.values); Navigator.pushReplacementNamed(context, widget.nextRoute); } @override void initState() { log.d("Initing WelcomePage..."); super.initState(); SystemChrome.setEnabledSystemUIOverlays([]); Future.delayed(widget.timeout, _goToNext); } @override Widget build(BuildContext build) { log.d("Building WelcomePage..."); return Material( color: Theme.of(context).primaryColor, child: Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Center( child: Text("Welcome to BotZ", textAlign: TextAlign.center, style: TextStyle( fontWeight: FontWeight.bold, fontSize: 35.0, color: Colors.black))), Image.asset('images/simple_logo.png', width: MediaQuery.of(context).size.width * 0.7), FlatButton( color: Colors.green[750], textColor: Colors.black, padding: EdgeInsets.all(8.0), splashColor: Colors.greenAccent, child: Text("Go"), onPressed: _goToNext) ])); } }