成功登录后,用户重定向到主页,但当用户单击浏览器后退按钮时,它很容易重定向到登录屏幕。我应该怎么做才能禁用向后重定向?
class SecondPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
/// Hope WillPopScope will do the job for you.
return WillPopScope(
onWillPop: () async => null,
child: Scaffold(
body: Center(
child: Text('asd'),
),
),
);
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6835 次 |
| 最近记录: |