Flutter is so hot why don't you know about it? (superior)

Flutter is so hot why don't you know about it? (superior)

Flutter is a Google mobile UI framework for creating high-quality native interfaces that are truly cross-platform and run on both iOS and Android. Flutter is free and open source, and can be used by developers and organizations around the world.

Flutter has several features:

1. Quickly develop millisecond-level hot loading to quickly apply modifications to the app. Build native interfaces in minutes using a rich set of fully customizable components.

2. Highly expressive and flexible UI Quickly integrate features into native end user experience. The UI can be completely customized by using the layered structure, and then complete fast drawing and flexible design.

3. Native Performance Flutter components include key differences across all platforms, such as scrolling, navigation, icons, and fonts. It enables Flutter to get a full native performance experience when used on iOS and Android.

rapid development

Flutter hot reloading technology helps you quickly and easily experiment, build UI, add features, and quickly fix bugs. Experience a sub-second reload experience.

img

beautiful UI

Flutter has built-in MD design style and iOS components, and has rich gesture APIs. The smooth scrolling experience and platform identity will make users feel happy.

img

img

Modern responsive framework (Modern, reactive framework)

Utilizing the Flutter responsive framework and rich platform, layout and functional components make UI construction very simple. Use flexible and powerful APIs (2D, animation, gestures, performance, etc.) to solve various problems on the UI.

  int counter = 0;
​
  void increment() {
    // Tells the Flutter framework that state has changed,
    // so the framework can run build() and update the display.
    setState(() {
      counter++;
    });
  }
​
  Widget build(BuildContext context) {
    // This method is rerun every time setState is called.
    // The Flutter framework has been optimized to make rerunning
    // build methods fast, so that you can just rebuild anything that
    // needs updating rather than having to individually change
    // instances of widgets.
    return new Row(
      children: <Widget>[
        new RaisedButton(
          onPressed: increment,
          child: new Text('Increment'),
        ),
        new Text('Count: $counter'),
      ],
    );
  }
}
Using native features and SDKs

We use platform APIs, third-party SDKs and native code to develop APP. Flutter allows you to continue using Java, Swift, Objective-C code and use native features on iOS and Android.

Accessing platform features is simple. The following code snippet begins:

    var batteryLevel = 'unknown';
    try {
        int result = await methodChannel.invokeMethod('getBatteryLevel');
        batteryLevel = 'Battery level: $result%';
      } on PlatformException {
        batteryLevel = 'Failed to get battery level.';
      }
      setState(() {
        _batteryLevel = batteryLevel;
      });
}

Learn how to use packages, or write platform channels, use native code, APIs and SDKs.

Unified Development Standards

Flutter拥有工具及库帮助你简单快速地在iOS和Android上实现你的想法。若你还没有任何移动开发经验,那么Flutter将会是你构建漂亮的移动APP的一种简单快速的额方式。若你是有经验的iOS或者Android开发人员,那么你可以使用Flutter组件,并且继续使用已有的Java/Objective-C/Swift程序。

构建 漂亮的APP UI 丰富的2D GPU加速APIs 响应式框架 动画/动作 APIs 兼容Android Material组件及苹果组件样式

流程的编码体验 急速热加载技术 IntelliJ:重构,自动补足功能等 Dart语言及核心库 包管理

拥有App所有特性 与移动OS APIs&SDKs互操作性 Maven/Java Cocoapods/ObjC/Swift

优化 测试 Unit测试 继承测试 无设备测试

Debug IDE debug 基于网络debug 异步/唤醒感知 表达式求值程序

配置 时间线 CPU和内存 应用性能图标

部署 编译 Native ARM程序 消除无效代码

发布 App市场 Play Store

标题安装Flutter

在国内安装Flutter需要首先需要一个值得信任的国内镜像。在镜像上边保存着Flutter需要的依赖及相关库,包等。为了使用Flutter,需要使用一个备用存储位置,我们需要配置环境变量。 配置环境变量名: PUB_HOSTED_URL 和 FLUTTER_STORAGE_BASE_URL。

在windows系统中,需要在环境变量设置中添加:

PUB_HOSTED_URL : pub.flutter-io.cn FLUTTER_STORAGE_BASE_URL : storage.flutter-io.cn

然后运行Git命令(前提是安装了GitBash工具):

git clone -b dev https://github.com/flutter/flutter.git Flutter

Flutter文件夹需要注意:文件夹存放的路径上不要出现空格,否则在IDE中进行工程创建后会有警告,SDK环境路径上存在分隔符。

在clone完成之后,即Flutter Sdk下载完毕,还需要配置Flutter环境: xxxx/Flutter/bin目录下。

重新打开一个命令行,在其中输入命令

flutter doctor

进行环境及缺失的依赖检查,并下载需要的依赖。 运行效果如下图:

img

在环境及相关依赖检查完成之后,可以开始在Android Studio中进行创建工程行为。

注意:Android Studio 预览版中无法保证运行Flutter成功。因此需要使用稳定版AS,且需要3.0版本以上。

Android Studio中需要安装Flutter Plugin,Dart Plugin两个插件。

Dart SDK也需要手动安装,直接下载zip包免安装。

成功准备好IDE环境之后,就可以创建Flutter Project了,默认创建Flutter Application就可以了,按照IDE创建提示一直到最终完成。

需要注意:同样由于网络环境,直接运行Flutter Project是不可行的,UI会一直停留在Gradle正在初始化工程。这时需要修改build.gradle配置中的中央Maven库到一个可信赖的公共Maven库。 这里我修改成Ali的Maven库

buildscript {
    ext.kotlin_version = '1.1.51'
    repositories {
        maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
        google()
    }
    // ......
}
​
// ......
​
allprojects {
    repositories {
        maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
    }
    google()
}
// ......

然后再次sync工程,进行运行。

img

首个创建的Flutter Project工程结构如下:

img

文章分享自:

Guess you like

Origin juejin.im/post/7250288616533049381