简体   繁体   English

Flutter Mobile 或 Web 应用程序有什么区别?

[英]What is the difference between a Flutter Mobile or Web app?

Are there any specific configuration in Flutter platform that should be changed for Mobile or Web apps before deployment? Flutter 平台中是否有任何特定配置需要在部署前针对 Mobile 或 Web 应用程序进行更改? Or it's just about defining different size screens and make it more responsive in our flutter code, not more?或者它只是定义不同尺寸的屏幕并使其在我们的 flutter 代码中更具响应性,而不是更多?

I like to know what is the difference to write a mobile Flutter code or web Flutter code?我想知道写手机 Flutter 代码或 web Flutter 代码有什么区别?

First of all, Flutter supports web but only from version 2.xx you don't need any specific configuration but you do need to customize it to PC and phone sizes.首先,Flutter 支持 web 但仅从 2.xx 版本开始,您不需要任何特定配置,但您需要根据 PC 和手机尺寸对其进行自定义。 for this, you can build a class and check in runtime if the platform is mobile or web like this:为此,您可以构建一个 class 并在运行时检查平台是否为移动平台或 web,如下所示:

import 'package:flutter/foundation.dart' show kIsWeb;

if (kIsWeb) {
  // running on the web!
} else {
  // NOT running on the web! You can check for additional platforms here.
}

If you are considering building a web app, consider the time it will take for the site to load because flutter draws on canvas and it weighs 2MB.如果您正在考虑构建 web 应用程序,请考虑加载站点所需的时间,因为 flutter 使用 canvas 并且重 2MB。 Or it is possible to run on an HTML engine but it sucks for now或者可以在 HTML 引擎上运行,但现在很糟糕

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM