1. Flutter相关资料
GitHub:https://github.com/Solido/awesome-flutter
shoocase: https://flutter.dev/showcase
flutter中文网:https://flutterchina.club/
技术胖视频:https://jspang.com/detailed?id=58
2. 安装
JDK 、Git 和 androidStudio 准备好
官方地址:
flutterSDK: https://flutter.dev/docs/development/tools/sdk/releases#windows
详情参考:
flutter中文网: https://flutterchina.club/setup-windows/
如果嫌下的慢,可以使用镜像:
下面是国内几个镜像,PUB_HOSTED_URL
是Dart依赖包地址,FLUTTER_STORAGE_BASE_URL
是Flutter依赖文件地址。
要手动下载最新版本的flutter SDK包,可以访问 FLUTTER_STORAGE_BASE_URL
地址,然后进入/flutter_infra/releases/
目录下载(这个方式Flutter社区不可用)。
Flutter 社区
社区主镜像,采用多种方式同步 Flutter 开发者资源(推荐)。
$ export PUB_HOSTED_URL=https://pub.flutter-io.cn
$ export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
上海交大 Linux 用户组
使用反向代理方式建立的 Flutter 镜像,数据与站源实时同步。 Pub API 返回值未做处理,可能造成无法访问的情况。
$ export PUB_HOSTED_URL=https://dart-pub.mirrors.sjtug.sjtu.edu.cn
$ export FLUTTER_STORAGE_BASE_URL=https://mirrors.sjtug.sjtu.edu.cn
清华大学 TUNA 协会
定时与 Flutter 社区 Storage 镜像同步,Pub API 采取定时主动抓取策略,镜像配置了完善的失败回源策略(推荐)。
$ export PUB_HOSTED_URL=https://mirrors.tuna.tsinghua.edu.cn/dart-pub
$ export FLUTTER_STORAGE_BASE_URL=https://mirrors.tuna.tsinghua.edu.cn/flutter
直接拼接清华大学的地址 :
https://mirrors.tuna.tsinghua.edu.cn/flutter/flutter_infra/releases/stable/windows/?C=M&O=D
不到2分钟下完,官方社区要超过2小时。。。
也可以直接用git下载:
git clone https://gitee.com/mirrors/Flutter.git
VSCode下可以直接按F5选择模拟器运行
也可以用批处理命令:
模拟器绝对路径 -netdelay none -netspeed full -avd 模拟器名称
例如:
D:\work\software\Sdk\emulator\emulator.exe -netdelay none -netspeed full -avd Nexus_5X_API_27
示例demo:
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'laoniu home',
// theme: ThemeData(primarySwatch: Colors.blue,),
home: Scaffold(
appBar: AppBar(
title: Text('laoniu home title'),
),
body: Center(
child: Text(
' hello world, 我是老牛!i love u !!我是老牛!i love u !!我是老牛!i love u !!我是老牛!i love u !!',
textAlign: TextAlign.left,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 25.0,
color: Color(0xff0094ff),
decoration: TextDecoration.underline,
decorationStyle: TextDecorationStyle.solid,
),
),
)
),
);
}
}