58 lines
1.6 KiB
Dart
58 lines
1.6 KiB
Dart
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> {
|
|
void _goToNext() {
|
|
Navigator.pushReplacementNamed(context, widget.nextRoute);
|
|
}
|
|
|
|
@override
|
|
void initState() {
|
|
log.d("Initing WelcomePage...");
|
|
super.initState();
|
|
Future.delayed(widget.timeout, _goToNext);
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext build) {
|
|
SystemChrome.setEnabledSystemUIOverlays([]);
|
|
log.d("Building WelcomePage...");
|
|
return Container(
|
|
color: Colors.green[300],
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: <Widget>[
|
|
Center(
|
|
child: Text("Welcome to BotZ",
|
|
textAlign: TextAlign.center,
|
|
style: TextStyle(
|
|
fontWeight: FontWeight.bold,
|
|
fontSize: 15.0,
|
|
color: Colors.blue[700]))),
|
|
FlatButton(
|
|
color: Colors.green[350],
|
|
textColor: Colors.black,
|
|
padding: EdgeInsets.all(8.0),
|
|
splashColor: Colors.greenAccent,
|
|
child: Text("Go"),
|
|
onPressed: _goToNext)
|
|
]));
|
|
}
|
|
}
|