成功登录后,用户将重定向到主页,但是当用户单击浏览器的“后退”按钮时,它很容易重定向到登录屏幕。我应该怎么做才能禁用向后重定向?
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'),
),
),
);
}
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句