From 55e8c828a40acb7e93a98980c43e20173d3569ce Mon Sep 17 00:00:00 2001 From: Lynnesbian Date: Wed, 30 Sep 2020 13:02:05 +1000 Subject: [PATCH] nicer looking splash screen, removed unintentional addition of back (to splash screen) button --- lib/main.dart | 2 +- lib/pages/main_page.dart | 8 +------- lib/pages/splash.dart | 28 ++++++++++++++++++++++------ 3 files changed, 24 insertions(+), 14 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index 486944b..04e440d 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -34,7 +34,7 @@ void main() { title: "Buypeeb Mobile", theme: ThemeData( - primarySwatch: Colors.orange, + primarySwatch: Colors.pink, ), ) ), diff --git a/lib/pages/main_page.dart b/lib/pages/main_page.dart index 390b896..77c7e59 100644 --- a/lib/pages/main_page.dart +++ b/lib/pages/main_page.dart @@ -9,13 +9,7 @@ class RouteHome extends StatelessWidget { // This widget is the root of your application. @override Widget build(BuildContext context) { - return MaterialApp( - title: "Buypeeb", - theme: ThemeData( - primarySwatch: Colors.orange, - ), - home: MainPage(), - ); + return MainPage(); } } diff --git a/lib/pages/splash.dart b/lib/pages/splash.dart index bce4e67..a9c6fc8 100644 --- a/lib/pages/splash.dart +++ b/lib/pages/splash.dart @@ -10,11 +10,9 @@ class RouteSplash extends StatefulWidget { } class _RouteSplashState extends State { - bool _ready = false; - _loadUserSettings() async { // sleep for a bit to "simulate" loading - await Future.delayed(Duration(seconds: 1)); + await Future.delayed(Duration(seconds: 2)); // add some random stuff to the listings var listings = context.read(); var _rng = new Random(); @@ -28,8 +26,11 @@ class _RouteSplashState extends State { } setState(() { - _ready = true; - Navigator.pushNamed(context, '/'); + Navigator.pushNamedAndRemoveUntil( + context, + '/', + (Route route) => false, + ); }); } @@ -43,7 +44,22 @@ class _RouteSplashState extends State { Widget build(BuildContext context) { return Scaffold( body: Center( - child: CircularProgressIndicator(), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + margin: const EdgeInsets.all(12.0), + child: Text( + "Buypeeb Mobile", + style: TextStyle( + fontSize: 36.0, + fontWeight: FontWeight.w200 + ), + ), + ), + CircularProgressIndicator(), + ] + ) ) ); }