谷歌开源的跨平台UI开发框架Flutter

Flutter是Google一个新的用于构建跨平台的手机App的SDK。写一份代码,在Android 和iOS平台上都可以运行。与React Native、Weex不同,React Native、Weex等一直存在一个问题,就是性能跟原生App存在很大的差异。

  • Fast Development
  • Expressive and Flexible UI
  • Native Performance

说明文档:https://flutter.dev/docs

配置Fluter环境

  1. 获取Flutter SDK
git clone https://github.com/flutter/flutter.git -b stable
  1. 配置环境变量

将获取Flutter SDK的完整的路径 D:\Users\flutter\bin 加入到path路径当中即可

  1. 检查依赖是否成功

运行cmd,输入flutter doctor

C:\Users\Admin>flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 1.22.3, on Microsoft Windows [Version 10.0.18363.1139], locale zh-CN)
  1. 查看设备

运行cmd,输入flutter devices

配置Flutter IDE

  1. 安装Android Studio
  2. 下载Flutter和Dart插件:Flutter用于开发者的工作,比如编译调试等,Dart用于编码,解析 。

打开Android Studio,选择File-settings-Plugins-Marketplace,搜索Flutter,安装重启IDE即可

创建Flutter Application

  1. 选择File>New Flutter Project,选择项目类型为Fluter Application
  2. 输入项目名称,选择配置Flutter SDK路径,点击finish创建项目
  3. 使用Flutter的热重载能力特性
    Flutter Hot Reload:提供给开发者快速修改UI,增加功能,修复bug,不需要重新启动应用,即可看到改动效果。

在Flutter项目中,Application的代码是lib/main.dart

import 'package:flutter/material.dart';void main() {runApp(MyApp());
}class MyApp extends StatelessWidget {// This widget is the root of your application.@overrideWidget build(BuildContext context) {return MaterialApp(title: 'Flutter Demo',theme: ThemeData(// This is the theme of your application.//// Try running your application with "flutter run". You'll see the// application has a blue toolbar. Then, without quitting the app, try// changing the primarySwatch below to Colors.green and then invoke// "hot reload" (press "r" in the console where you ran "flutter run",// or simply save your changes to "hot reload" in a Flutter IDE).// Notice that the counter didn't reset back to zero; the application// is not restarted.primarySwatch: Colors.blue,// This makes the visual density adapt to the platform that you run// the app on. For desktop platforms, the controls will be smaller and// closer together (more dense) than on mobile platforms.visualDensity: VisualDensity.adaptivePlatformDensity,),home: MyHomePage(title: 'Flutter Demo Home Page'),);}
}class MyHomePage extends StatefulWidget {MyHomePage({Key key, this.title}) : super(key: key);// This widget is the home page of your application. It is stateful, meaning// that it has a State object (defined below) that contains fields that affect// how it looks.// This class is the configuration for the state. It holds the values (in this// case the title) provided by the parent (in this case the App widget) and// used by the build method of the State. Fields in a Widget subclass are// always marked "final".final String title;@override_MyHomePageState createState() => _MyHomePageState();
}class _MyHomePageState extends State<MyHomePage> {int _counter = 0;void _incrementCounter() {setState(() {// This call to setState tells the Flutter framework that something has// changed in this State, which causes it to rerun the build method below// so that the display can reflect the updated values. If we changed// _counter without calling setState(), then the build method would not be// called again, and so nothing would appear to happen._counter++;});}@overrideWidget build(BuildContext context) {// This method is rerun every time setState is called, for instance as done// by the _incrementCounter method above.//// 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 Scaffold(appBar: AppBar(// Here we take the value from the MyHomePage object that was created by// the App.build method, and use it to set our appbar title.title: Text(widget.title),),body: Center(// Center is a layout widget. It takes a single child and positions it// in the middle of the parent.child: Column(// Column is also a layout widget. It takes a list of children and// arranges them vertically. By default, it sizes itself to fit its// children horizontally, and tries to be as tall as its parent.//// Invoke "debug painting" (press "p" in the console, choose the// "Toggle Debug Paint" action from the Flutter Inspector in Android// Studio, or the "Toggle Debug Paint" command in Visual Studio Code)// to see the wireframe for each widget.//// Column has various properties to control how it sizes itself and// how it positions its children. Here we use mainAxisAlignment to// center the children vertically; the main axis here is the vertical// axis because Columns are vertical (the cross axis would be// horizontal).mainAxisAlignment: MainAxisAlignment.center,children: <Widget>[Text('You have clicked the button this many times:',),Text('$_counter',style: Theme.of(context).textTheme.headline4,),],),),floatingActionButton: FloatingActionButton(onPressed: _incrementCounter,tooltip: 'Increment',child: Icon(Icons.add),), // This trailing comma makes auto-formatting nicer for build methods.);}
}

谷歌开源的跨平台UI开发框架Flutter相关推荐

  1. Carson带你学Android:手把手带你入门跨平台UI开发框架Flutter

    前言 Flutter 作为Google出品的一个新兴的跨平台移动客户端UI开发框架,正在被越来越多的开发者和组织使用,包括阿里的咸鱼.腾讯的微信等. 今天,我将献上一份 <全面 & 详细 ...

  2. Google跨平台UI框架 Flutter beta 重磅发布,这里有你需要了解的一切

    2018年2月27日,在西班牙巴塞罗那世界移动大会上,Google发布 Flutter 的第一个 beta 版本.Flutter 是 Google 用以帮助开发者在 iOS 和 Android 两个平 ...

  3. python开源自动化测试平台_Airtest:网易游戏开源的跨平台 UI 自动化测试框架

    Airtest 跨平台的UI自动化测试框架,适用于游戏和App 快速开始 Airtest是一个跨平台的UI自动化测试框架,适用于游戏和App.目前支持Windows和Android平台,iOS支持正在 ...

  4. .NET Core/.NET5/.NET6 开源项目汇总9:客户端跨平台UI框架

    .NET Core 实现了跨平台,支持在 Windwos.Linux.macOS上开发与部署,但是也仅限于Web应用程序.对于Windows桌面端应用程序,WinForm 与 WPF 技术是当前最成熟 ...

  5. 网易 Duilib:功能全面的开源桌面 UI 开发框架

    01 网易 Duilib 框架概述 Duilib 是 Windows 系统下的开源的 DirectUI 界面库(遵循 BSD 协议),完全免费,可用于商业软件开发. Duilib 可以简单方便地实现大 ...

  6. 从Flutter开始聊聊跨平台移动开发框架

    Flutter 是一款由 Google 开发的开源.跨平台移动端开发框架.Flutter 使用 Dart 作为开发语言,这是一门简洁.强类型的编程语言.它允许使用同一个代码库构建高性能.漂亮的 iOS ...

  7. 谷歌移动UI框架Flutter教程之Widget

    引言 在之间我已经介绍了关于Flutter的下载安装以及配置,还有开发工具Android Studio的配置,还不知道的同学可以看看我这篇博客--谷歌移动UI框架Flutter入门.这里为什么非要用A ...

  8. 革命性移动端开发框架-Flutter时间简史

    说到Flutter,可能很多同学都会将它和这几个词关联起来:新兴的.移动端.动态化.跨平台.开发框架. 从去年开始Flutter的热度在不断地上升,那么它对很多同学造成了一个误区:认为Flutter是 ...

  9. 谷歌技术团队出品,Android Flutter全家桶学习资料【全新版】

    Flutter 是谷歌的移动端 UI 框架,可在极短的时间内构建 Android 和 iOS 上高质量的原生级应用. Flutter 可与现有代码一起工作, 它被世界各地的开发者和组织使用, 并且 F ...

最新文章

  1. js php 中文乱码怎么解决_探讨PHP JSON中文乱码的解决方法详解
  2. oracle instead of update触发器,Oracle中的instead of触发器
  3. 2017 企业服务创新大会启动,助力中国企业敏捷发展
  4. Misc(网络+组成原理)
  5. php定义object数据类型,PHP数据类型(4):对象object
  6. HTML+CSS+JS实现 ❤️卡通人物吃水果游戏❤️
  7. ubuntu mysql双主热备配置_MySql双主热备配置
  8. 希尔排序java实现
  9. python stdin和stdout_无法使用Python写入和读取stdin / stdout
  10. Python标准库:内置函数ascii(object)
  11. 高一信息技术 计算机配件的真伪辨别,高一信息技术组PPT.ppt
  12. 安全合规/等级保护--13--我们通过了等级保护三级认证
  13. 【转】Excel表格的35招必学秘技
  14. IIC总线原理详细解析
  15. 任小龙 mysql笔记_小码哥-任小龙Java笔记-面向对象的全部笔记.pdf
  16. 六西格玛dfss_DFSS六西格玛设计的基本内容
  17. 苹果的新手机都是5G,华为的新手机只有4G,大家怎么看待这个现象?
  18. canvas绘制星空
  19. web项目中实现登陆成功后才能访问某些页面,否则自动跳转到登陆界面,以及对无限循环重定向的解决
  20. 查看USB设备序列号的一些方法

热门文章

  1. Macbook GlobalProtect 连接问题
  2. IN指令和OUT指令
  3. No suspicious code found. 1 files processed in 'File '
  4. 神经网络与深度学习笔记(三)python 实现反向传播算法
  5. 2020-助你直通大厂前端中高级面试题
  6. 数字分割(拆数字)的两种方法
  7. 【地球上最欢乐跑步活动】第四届草原马拉松彩跑节▪舞动青春 跑出色彩 千人篝火狂欢大型烟花表演
  8. 润和软件为OpenHarmony落地智慧城市构建高效可靠软件基座
  9. Windows下测试tcp/udp端口是否打开
  10. 老子兵法—柔情似水篇