/
myApp.dart
49 lines (42 loc) · 1.2 KB
/
myApp.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import 'package:flutter/material.dart';
import 'loginPage.dart';
import 'main.dart' as main;
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
title: 'Flutter Demo',
theme: new ThemeData(
primarySwatch: Colors.blue,
),
home: new MyHomePage(),
routes: <String, WidgetBuilder> {
"login" : (BuildContext context) => new LoginPage(),
}
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key}) : super(key: key);
@override
_MyHomePageState createState() => new _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
if (!main.isLoggedIn) {
return new LoginPage();
}
else {
return new Scaffold(
appBar: new AppBar(
title: new Text("Home Page"),
centerTitle: true,
),
//You can use this variable to get informations about the connected user.
//For example, check the values uid, displayName or photoUrl
body: new Text("Welcome ${main.connectedUser}")
);
}
}
}