[英]Flutter: How to stop showing mobile App when running the Web version in browser
I am building an application using Flutter in both the Mobile and Web platforms.我正在移动和 Web 平台上使用 Flutter 构建应用程序。 I have a few different UI to show from Web to Mobile.
从 Web 到 Mobile,我有几个不同的用户界面要显示。 In the Web version running on the chrome when I change the size of the browser, it shows the mobile app pages.
在 chrome 上运行的 Web 版本中,当我更改浏览器的大小时,它显示了移动应用程序页面。
How to stop this, so that the Web version should not show the mobile version when the browser layout gets changed.如何阻止它,以便 Web 版本在浏览器布局更改时不显示移动版本。
I assume that you check the size of the layout like:我假设您检查布局的大小,例如:
if (layoutSize <= someValue) {
switchToSmallerLayout();
}
You can try to do like this if you want to prevent switching on mobile devices如果你想防止打开移动设备,你可以尝试这样做
bool get _isMobile => Platform.isIOS || Platform.isAndroid;
if (layoutSize <= someValue && !_isMobile) {
switchToSmallerLayout();
}
This should solve your problem.这应该可以解决您的问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.