cosyer's Blog

Blog


  • 首页

  • 友链

  • 留言板

  • 归档

  • 关于

  • 搜索

flutter 标签

1月
02
更新于
1月02
2019
JS

flutter入门

发表于 2018-12-25 | 热度 ℃
| 字数统计: 324 (字) | 阅读时长: 2 (分钟)

什么是flutter

Flutter is Google’s mobile UI framework for crafting high-quality native interfaces on iOS and Android in record time. Flutter works with existing code, is used by developers and organizations around the world,and is free and open source.

环境安装

下载SDK

https://flutter.io/docs/development/tools/sdk/archive?tab=macos#macos 或者 git clone -b beta https://github.com/flutter/flutter.git

镜像

添加环境变量 .bash_profile

1
2
3
4
5
6
export ANDROID_HOME=~/Library/Android/sdk
export PATH=${PATH}:${ANDROID_HOME}/tools
export PATH=${PATH}:${ANDROID_HOME}/platform-tools
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
export PATH=/Users/chenyu/treasure/flutter/flutter/bin:$PATH

运行flutter doctor查看是否需要安装其它依赖项来完成安装:

该命令检查您的环境并在终端窗口中显示报告。Dart SDK已经在捆绑在Flutter里了,没有必要单独安装Dart。 仔细检查命令行输出以获取可能需要安装的其他软件或进一步需要执行的任务(以粗体显示)

创建项目

  1. 在AndroidStudio安装Dart插件。启动studio,搜索flutter,自动安装Dart插件,完成后重启studio。

  2. Android Studio - File - New -New Flutter Project

文件入口

项目路径下的lib文件夹下的main.dart文件

1
2
3
4
5
6
7
8
import 'package:flutter/material.dart'; //导包
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return new MaterialAp
}
陈宇(cosyer)

陈宇(cosyer)

不去做的话永远也做不到。

159 日志
10 分类
51 标签
RSS
GitHub Twitter E-Mail FB Page
推荐阅读
  • Callmesoul
  • JsTips
  • Personal Site
  • Resume
© 2021 陈宇(cosyer)
终于等到你(UV):   |   欢迎再来(PV):
Blog总字数: 312.5k字
苏ICP备17005342号-1