Flutter 是谷歌开源的应用开发框架,仅通过一套代码库,就能构建精美的、原生平台编译的多平台应用
中文版本文档
插件库,pub,类似于npm。
文件目录:
代码都在lib 文件夹配置文件:
pubspec.yaml
可定义app的各种参数配置,比如项目名称,版本,定义图片文件位置…1
2
3
4
5
6
7
8
9
10
11
12
13name: myflutter
description: myflutter project.
# 版本
version: 1.0.0+1
assets:
- assets/images/
# 定义需要的插件包及版本
dependencies:
flutter:
sdk: flutter
package_info: 2.0.2
http: 0.13.4
常用命令:
1 | flutter clean |
组件 标签
listView() 可以滚动的组件标签
更多组件
常用标签
- Aligin
- AspectRatio
- Center
- Baseline
- ConstrainedBox
- Container
- Expanded
- GestureDetector //手势识别
- stack
- Positioned
- Padding
Image vs ImageProvider
An image provider is what provides the image to an Image widget. ;D
The image provider doesn’t necessarily have the image right there but it knows how to get it.
Getting an Image
If you need an Image widget, then use one of these:
1 | Image.asset() |
Getting an ImageProvider
If you need an ImageProvider, then use one of these:
1 | AssetImage() |
定义一个 Widget 组件
1 | Widget textSection = const Padding( |
Single-child layout widgets
- Aligin
1 | Container( |
- AspectRatio
- Center
- Baseline
- ConstrainedBox
- Container
- Expanded
手势识别。
GestureDetector
1 | Positioned( |
flutter 获取应用签名 (需要jre 低版本才能查看md5)keytool -list -v -keystore D:\XX\key.jks