Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update WelcomePage.dart #61

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 17 additions & 16 deletions lib/page/WelcomePage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,28 @@ class WelcomePage extends StatefulWidget {
class _WelcomePageState extends State<WelcomePage> {

bool hadInit = false;

Future<Null> _navigator() async {
///防止多次进入
Store<GSYState> store = StoreProvider.of(context);
CommonUtils.initStatusBarHeight(context);
final res = await UserDao.initUserInfo(store);
if (res != null && res.result) {
NavigatorUtils.goHome(context);
} else {
NavigatorUtils.goLogin(context);
}
}

@override
void didChangeDependencies() {
super.didChangeDependencies();
if(hadInit) {
return;
if (!hadInit) {
hadInit = true;

///防止多次进入
_navigator();
}
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
Expand Down