flutter初体验(环境配置)
文章图片
前言
Flutter是谷歌的移动UI框架,可以快速在iOS和Android上构建高质量的原生用户界面。 Flutter可以与现有的代码一起工作。在全世界,Flutter正在被越来越多的开发者和组织使用,并且Flutter是完全免费、开源的。
- 快速开发
- 毫秒级的热重载,修改后,您的应用界面会立即更新。使用丰富的、完全可定制的widget在几分钟内构建原生界面。
- 富有表现力和灵活的UI
- 快速发布聚焦于原生体验的功能。分层的架构允许您完全自定义,从而实现难以置信的快速渲染和富有表现力、灵活的设计。
- 原生性能
- Flutter包含了许多核心的widget,如滚动、导航、图标和字体等,这些都可以在iOS和Android上达到原生应用一样的性能。
环境配置
Flutter 1.0.0安装与环境搭建
Dart 2.1.0 (build 2.1.0-dev.9.4 f9ebf21297)
Xcode Version 10.1 (10B61)
IntelliJ IDEA 2018.3.2 (Ultimate Edition)
VS Code 1.30.1 (1.30.1)
参考flutter中文网或者自行Google,前人之述备矣,此处不再赘述。
配置编辑器
本人为iOS开发,未安装过Android Studio,所以不具备安卓开发环境。
为了亲自体验一下不同编辑器,所以安装了IntelliJ IDEA 和 VS Code体验flutter开发。VS Code的配置参考官方教程。IntelliJ IDEA的配置参考官方教程。IntelliJ IDEA需要安装flutter和dart插件,在IntelliJ IDEA安装插件需要翻墙,也可以去官方插件库搜索插件从磁盘安装。从磁盘安装插件极有可能重启应用后报错闪退,修复方法是在应用目录下~/Library/Application Support/
文章图片
[图片上传中...(WX20181228-112812@2x.png-e23a9d-1545968380976-0)]
常用命令
- flutter doctor: 坚持flutter开发环境信息.
- flutter create: 创建一个新的flutter项目.
- flutter run: 在已运行的设备上运行flutter应用.
Global options:
-h, --helpPrint this usage information.
-v, --verboseNoisy logging, including all shell commands
executed.
If used with --help, shows hidden options.-d, --device-idTarget device id or name (prefixes allowed).
--versionReports the version of this tool.
--suppress-analyticsSuppress analytics reporting when this command runs.
--bug-reportCaptures a bug report file to submit to the Flutter
team.
Contains local paths, device identifiers, and log
snippets.--packagesPath to your ".packages" file.
(required, since the current directory does not
contain a ".packages" file)Available commands:
analyzeAnalyze the project's Dart code.
attachAttach to a running application.
bash-completionOutput command line shell completion setup scripts.
buildFlutter build commands.
channelList or switch flutter channels.
cleanDelete the build/ directory.
configConfigure Flutter settings.
createCreate a new Flutter project.
devicesList all connected devices.
doctorShow information about the installed tooling.
driveRuns Flutter Driver tests for the current project.
emulatorsList, launch and create emulators.
formatFormat one or more dart files.
helpDisplay help information for flutter.
installInstall a Flutter app on an attached device.
logsShow log output for running Flutter apps.
make-host-app-editableMoves host apps from generated directories to
non-generated directories so that they can be edited
by developers.
packagesCommands for managing Flutter packages.
precachePopulates the Flutter tool's cache of binary
artifacts.
runRun your Flutter app on an attached device.
screenshotTake a screenshot from a connected device.
stopStop your Flutter app on an attached device.
testRun Flutter unit tests for the current project.
traceStart and stop tracing for a running Flutter app.
upgradeUpgrade your copy of Flutter.
快速开始
终端 终端在适合的目录下运行flutter create flutter_app创建一个名为flutter_app的应用。
IntelliJ IDEA 从Flutter入门应用程序模板创建一个新的Flutter IntelliJ项目:
- 在IntelliJ中,在 ‘Welcome’ 窗口点击 Create New Project
- 或者在主界面 File>New>Project…
- 在菜单中选择 Flutter , 然后点击 Next.
- 输入Project name 和 Project location,点击 Finish.
- 打开 Command Palette (Ctrl+Shift+P (Cmd+Shift+P on macOS)).
- 选择 Flutter: New Project命令并回车。
- 输入Project name 和 Project location
在IDE中开发Flutter应用
英文还可以的同学参考官方的英文教程,官方提供了Android Studio / IntelliJ和VS Code的简单开发教学。
IntelliJ中直接在顶部工具栏就可以操做,VS Code按F5运行项目并显示工具栏。
文章图片
相关参考
【flutter初体验(环境配置)】flutter中文网
在IDE中开发Flutter应用
推荐阅读
- parallels|parallels desktop 解决网络初始化失败问题
- 汇讲-勇于突破
- 生命过客——第10章|生命过客——第10章 初为人母
- 回忆曾经看过的小说
- 漫画初学者如何学习漫画背景的透视画法(这篇教程请收藏好了!)
- 绘本讲师训练营【18期】14/21《我的情绪小怪兽》故事会新体验
- 2018.03.18
- (全员向连载)云间当铺(一)
- 美之初体验—我所感受到的那一点儿
- 如果我的人生能从初中重新开始