简体   繁体   English

Flutter:如何在浏览器中运行Web版本时停止显示移动应用程序

[英]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.

相关问题 Flutter Web 应用程序无法在移动浏览器上运行。 如果在移动浏览器上运行flutter代码,如何调试错误? - Flutter web app not working on mobile browser. How to debug the error if running flutter code on mobile browser? 如何在 flutter web 应用程序的移动浏览器中禁用旋转 - how to disable rotation in mobile browser in flutter web app 如何知道我的 Flutter Web 应用程序是在移动设备还是桌面设备上运行 - How to know if my flutter web app is running on mobile or desktop 在 Flutter Web 中调整浏览器页面大小时如何停止调整小部件的大小 - How to stop resizing of widgets when resizing browser page in Flutter Web 如何将 Flutter 移动应用迁移到 Flutter Web - How to migrate flutter mobile app to flutter web 运行时的设备/浏览器详细信息 Flutter Web - Device/Browser Details when running Flutter Web 如何将 Flutter 移动应用程序转换为 Web 应用程序 - How to convert Flutter Mobile app to Web App 我应该如何在 Flutter mobile 和 web 版本的应用程序之间做出一些区别? - How should I make some differences between Flutter mobile and web version of my app? 当应用程序不在 Play 商店或应用程序商店时,如何自动将 Flutter Mobile 应用程序更新到更新版本? - How to automatically update a Flutter Mobile app to newer version when the application is not on play store or app store? 如何在单击 flutter web 应用程序 url 时建议 Flutter Mobile 应用程序? - How to suggest Flutter Mobile app on clicking flutter web app url?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM