2019-08-22 02:46:07 +02:00
|
|
|
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<WelcomePage> {
|
2019-08-27 10:49:23 +02:00
|
|
|
void _goToNext() async {
|
|
|
|
// Restore overlays to exit fullscreen mode
|
|
|
|
await SystemChrome.setEnabledSystemUIOverlays(SystemUiOverlay.values);
|
2019-08-22 02:46:07 +02:00
|
|
|
Navigator.pushReplacementNamed(context, widget.nextRoute);
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
log.d("Initing WelcomePage...");
|
|
|
|
super.initState();
|
2019-08-27 10:49:23 +02:00
|
|
|
SystemChrome.setEnabledSystemUIOverlays([]);
|
2019-08-22 02:46:07 +02:00
|
|
|
Future.delayed(widget.timeout, _goToNext);
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext build) {
|
|
|
|
log.d("Building WelcomePage...");
|
2019-08-27 10:49:23 +02:00
|
|
|
return Material(
|
|
|
|
color: Theme.of(context).primaryColor,
|
2019-08-22 02:46:07 +02:00
|
|
|
child: Column(
|
2019-08-27 10:49:23 +02:00
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
2019-08-22 02:46:07 +02:00
|
|
|
children: <Widget>[
|
|
|
|
Center(
|
|
|
|
child: Text("Welcome to BotZ",
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
style: TextStyle(
|
|
|
|
fontWeight: FontWeight.bold,
|
2019-08-27 10:49:23 +02:00
|
|
|
fontSize: 35.0,
|
|
|
|
color: Colors.black))),
|
|
|
|
Image.asset('images/simple_logo.png',
|
|
|
|
width: MediaQuery.of(context).size.width * 0.7),
|
2019-08-22 02:46:07 +02:00
|
|
|
FlatButton(
|
2019-08-27 10:49:23 +02:00
|
|
|
color: Colors.green[750],
|
2019-08-22 02:46:07 +02:00
|
|
|
textColor: Colors.black,
|
|
|
|
padding: EdgeInsets.all(8.0),
|
|
|
|
splashColor: Colors.greenAccent,
|
|
|
|
child: Text("Go"),
|
|
|
|
onPressed: _goToNext)
|
|
|
|
]));
|
|
|
|
}
|
|
|
|
}
|