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,
),
),
)
),
);
}
}