Added an initial loading screens where the status of the user is checked (logged in or not) and added a dummy home screen to implement the redirectioning of a user in case his logged in already
This commit is contained in:
parent
09e8e14fb6
commit
b2fdcdbc4f
3 changed files with 53 additions and 1 deletions
|
|
@ -1,16 +1,41 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'screens/home_screen.dart';
|
||||
import 'screens/login_screen.dart';
|
||||
import 'screens/initial_loading_screen.dart';
|
||||
|
||||
class App extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
title: 'Do more',
|
||||
//home: Text('Start'),
|
||||
home: LoginScreen(),
|
||||
onGenerateRoute: routes,
|
||||
theme: ThemeData(
|
||||
canvasColor: Color.fromRGBO(23, 25, 29, 1.0),
|
||||
fontFamily: 'IBM Plex Sans',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Route routes(RouteSettings settings) {
|
||||
final List<String> routeTokens = settings.name.split('/');
|
||||
|
||||
if (settings.name == '/') {
|
||||
return MaterialPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return InitialLoadingScreen();
|
||||
},
|
||||
);
|
||||
} else if (routeTokens.first == 'login') {
|
||||
return MaterialPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return LoginScreen();
|
||||
},
|
||||
);
|
||||
} else if (routeTokens.first == 'home') {
|
||||
return MaterialPageRoute(builder: (BuildContext context) {
|
||||
return HomeScreen();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue