Flutter Web:如何在Flutter Web应用程序中禁用浏览器的后退按钮 [英] Flutter Web: How to disable backward button of browser in flutter web application
本文介绍了Flutter Web:如何在Flutter Web应用程序中禁用浏览器的后退按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
成功登录后,用户将重定向到主页,但是当用户单击浏览器后退按钮时,它很容易重定向到登录屏幕.我应该怎么做才能禁用向后重定向?
After successfully login the user redirected to the Home page but when the user clicks on the browser back button it easily redirected to the login screen. What should I do to disable backward redirection?
推荐答案
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'),
),
),
);
}
}
这篇关于Flutter Web:如何在Flutter Web应用程序中禁用浏览器的后退按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文