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

github_client_app 在判断用户未登录,如何直接跳转到login页面? #11

Open
Spring8848 opened this issue Feb 26, 2020 · 0 comments

Comments

@Spring8848
Copy link

在home_page.dart中,我想在判断用户未登录后,直接跳转到login路由,修改代码如下:
//注释掉原代码中的return,添加 Navigator.of(context).pushNamed("login");
if (!userModel.isLogin) {
Navigator.of(context).pushNamed("login");
// return Center(
// child: RaisedButton(
// child: Text(GmLocalizations.of(context).login),
// onPressed: () => Navigator.of(context).pushNamed("login"),
// ),
// );
}
但由于body部分必须要return一个widget,所以上述代码报错。
请问如果要实现上述意图,代码如何操作,谢谢?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant