forked from CarGuo/gsy_github_app_flutter
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWelcomePage.dart
More file actions
65 lines (56 loc) · 1.67 KB
/
WelcomePage.dart
File metadata and controls
65 lines (56 loc) · 1.67 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_redux/flutter_redux.dart';
import 'package:gsy_github_app_flutter/common/dao/UserDao.dart';
import 'package:gsy_github_app_flutter/common/redux/GSYState.dart';
import 'package:gsy_github_app_flutter/common/style/GSYStyle.dart';
import 'package:gsy_github_app_flutter/common/utils/CommonUtils.dart';
import 'package:gsy_github_app_flutter/common/utils/NavigatorUtils.dart';
import 'package:redux/redux.dart';
/**
* 欢迎页
* Created by guoshuyu
* Date: 2018-07-16
*/
class WelcomePage extends StatefulWidget {
static final String sName = "/";
@override
_WelcomePageState createState() => _WelcomePageState();
}
class _WelcomePageState extends State<WelcomePage> {
bool hadInit = false;
@override
void didChangeDependencies() {
super.didChangeDependencies();
if(hadInit) {
return;
}
hadInit = true;
///防止多次进入
Store<GSYState> store = StoreProvider.of(context);
CommonUtils.initStatusBarHeight(context);
new Future.delayed(const Duration(seconds: 2), () {
UserDao.initUserInfo(store).then((res) {
if (res != null && res.result) {
NavigatorUtils.goHome(context);
} else {
NavigatorUtils.goLogin(context);
}
return true;
});
});
}
@override
Widget build(BuildContext context) {
return StoreBuilder<GSYState>(
builder: (context, store) {
return new Container(
color: Color(GSYColors.white),
child: new Center(
child: new Image(image: new AssetImage('static/images/welcome.png')),
),
);
},
);
}
}