BotZ_app/lib/ui/welcome_page.dart

62 lines
1.9 KiB
Dart
Raw Permalink Normal View History

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);
Navigator.pushReplacementNamed(context, widget.nextRoute);
}
@override
void initState() {
log.d("Initing WelcomePage...");
super.initState();
2019-08-27 10:49:23 +02:00
SystemChrome.setEnabledSystemUIOverlays([]);
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,
child: Column(
2019-08-27 10:49:23 +02:00
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
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),
FlatButton(
2019-08-27 10:49:23 +02:00
color: Colors.green[750],
textColor: Colors.black,
padding: EdgeInsets.all(8.0),
splashColor: Colors.greenAccent,
child: Text("Go"),
onPressed: _goToNext)
]));
}
}