Skip to content

Commit 6224c89

Browse files
samsam
authored andcommitted
feat: 增多7个小控件和provide迁移
2 parents da113d3 + 30017f7 commit 6224c89

File tree

175 files changed

+2612
-1586
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

175 files changed

+2612
-1586
lines changed

analysis_options.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
analyzer:
2-
errors:
3-
mixin_inherits_from_not_object: ignore
1+
# analyzer:
2+
# errors:
3+
# mixin_inherits_from_not_object: ignore

assets/imgs/cool.jpg

22.7 KB
Loading

assets/imgs/github.png

1.26 KB
Loading

assets/imgs/github_1.png

2.09 KB
Loading

assets/imgs/github_2.png

2 KB
Loading
Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,13 @@
1-
## **文档完善中**
1+
## **AssetBundle**
2+
> 抽象类,资源读取
3+
4+
#### 使用
5+
```
6+
import 'package:flutter/services.dart' show rootBundle;
7+
8+
getText() async {
9+
String text = await rootBundle.loadString('locale/zh.json');
10+
print('text $text');
11+
}
12+
13+
```
Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,32 @@
1-
## **文档完善中**
1+
## **IconButton**
2+
>
3+
图标按钮,通过填充颜色(墨水)对触摸做出反应
4+
5+
### 构造方法
6+
``` dart
7+
IconButton({
8+
Key key,
9+
this.iconSize = 24.0,
10+
this.padding = const EdgeInsets.all(8.0),
11+
this.alignment = Alignment.center,
12+
@required this.icon,
13+
this.color,
14+
this.highlightColor,
15+
this.splashColor,
16+
this.disabledColor,
17+
@required this.onPressed,
18+
this.tooltip
19+
})
20+
```
21+
22+
### 属性介绍
23+
* iconSize = 24.0:图标大小
24+
* padding = const EdgeInsets.all(8.0):按钮图标周围的填充
25+
* alignment = Alignment.center:图标对齐方式
26+
* icon:图标
27+
* color:图标颜色
28+
* highlightColor:按钮处于按下时按钮的辅助颜色
29+
* splashColor:按钮处于按下状态时按钮颜色
30+
* disabledColor:图标被禁用时按钮内图标的颜色
31+
* onPressed:点击回调
32+
* tooltip:长按文本提示

docs/widget/common/image/index.md

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,51 @@
1-
## **文档完善中**
1+
## **Image**
2+
3+
>
4+
用于展示图片的控件,支持本地图片,资源图片,网络图片等加载方式
5+
6+
### 构造方法
7+
``` dart
8+
Image({
9+
Key key,
10+
@required this.image,
11+
this.semanticLabel,
12+
this.excludeFromSemantics = false,
13+
this.width,
14+
this.height,
15+
this.color,
16+
this.colorBlendMode,
17+
this.fit,
18+
this.alignment = Alignment.center,
19+
this.repeat = ImageRepeat.noRepeat,
20+
this.centerSlice,
21+
this.matchTextDirection = false,
22+
this.gaplessPlayback = false,
23+
this.filterQuality = FilterQuality.low,
24+
})
25+
```
26+
27+
### 属性介绍
28+
* image:
29+
* Image(): 通用方法,使用ImageProvider(包括:AssetImage, NetworkImage, FileImage, MemoryImage)实现,如下方法本质上也是使用这个方法
30+
* Image.asset: 加载资源图片
31+
* Image.file: 加载本地图片文件夹
32+
* Image.network: 加载网络图片
33+
* Image.memory: 加载Uint8List资源图片
34+
* width:图片容器宽度
35+
* height:图片容器高度
36+
* color:color一般和colorBlendMod配合使用
37+
* colorBlendMode:和color配合使用,添加滤镜效果
38+
* fit:如何将图像分配到布局空间中
39+
* BoxFit.fill : 全图显示,显示尽可能拉伸,充满
40+
* BoxFit.contain : 全图显示,显示原比例,不需充满
41+
* BoxFit.cover : 显示可能拉伸,可能裁剪,充满
42+
* BoxFit.fitWidth : 显示尽可能拉伸,可能裁剪,宽度充满
43+
* BoxFit.fitHeight 显示尽可能拉伸,可能裁剪,高度充满:
44+
* BoxFit.none 无fit:
45+
* BoxFit.scaleDown 效果和contain差不多,但此属性不允许显示超过原图片大小,可小不可大:
46+
* alignment = Alignment.center:控制图片的显示位置
47+
* repeat = ImageRepeat.noRepeat:图片是否重复
48+
* centerSlice:九个补丁图像的中心切片
49+
* matchTextDirection = false:若值为turn,与Directionality配合使用,图片显示方向
50+
* gaplessPlayback = false:当ImageProvider发生变化后,重新加载图片的过程中,原图片的展示是否保留。若值为true,保留,若为false,不保留,直接空白等待下一张图片加载
51+
* filterQuality = FilterQuality.low:用于设置图像的FilterQuality
Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,35 @@
1-
## **文档完善中**
1+
## **ListTile**
2+
>
3+
单个固定高度的行,通常包含一些文本和前导或者尾随的图标,通常在ListView中使用
4+
5+
### 构造方法
6+
``` dart
7+
ListTile({
8+
Key key,
9+
this.leading,
10+
this.title,
11+
this.subtitle,
12+
this.trailing,
13+
this.isThreeLine = false,
14+
this.dense,
15+
this.contentPadding,
16+
this.enabled = true,
17+
this.onTap,
18+
this.onLongPress,
19+
this.selected = false,
20+
})
21+
```
22+
23+
### 属性介绍
24+
25+
* leading:显示左侧的小组件
26+
* title:标题
27+
* subtitle:子标题
28+
* trailing:显示右侧的小组件
29+
* isThreeLine = false:是否显示三行文本
30+
* dense:是否垂直密集显示
31+
* contentPadding:ListTile的内部填充
32+
* enabled = true:是否是交互式的
33+
* onTap:点击时的回调
34+
* onLongPress:长按时的回调
35+
* selected = false:图标和文本是否以相同颜色呈现
Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,57 @@
1-
## **文档完善中**
1+
## **RaisedButton**
2+
>
3+
RaisedButton 凸起按钮
4+
5+
### 构造方法
6+
``` dart
7+
RaisedButton({
8+
Key key,
9+
@required VoidCallback onPressed,
10+
ValueChanged<bool> onHighlightChanged,
11+
ButtonTextTheme textTheme,
12+
Color textColor,
13+
Color disabledTextColor,
14+
Color color,
15+
Color disabledColor,
16+
Color highlightColor,
17+
Color splashColor,
18+
Brightness colorBrightness,
19+
double elevation,
20+
double highlightElevation,
21+
double disabledElevation,
22+
EdgeInsetsGeometry padding,
23+
ShapeBorder shape,
24+
Clip clipBehavior = Clip.none,
25+
MaterialTapTargetSize materialTapTargetSize,
26+
Duration animationDuration,
27+
Widget child,
28+
})
29+
```
30+
31+
### 属性介绍
32+
* onPressed: 点击回调
33+
* textColor:文本颜色
34+
* disabledTextColor:禁用文本颜色
35+
* color:按钮颜色
36+
* disabledColor: 禁用按钮颜色
37+
* highlightColor:长按按钮颜色
38+
* splashColor: 点击按钮水波纹颜色
39+
* elevation: 按钮下面阴影
40+
* highlightElevation:阴影大小
41+
* disabledElevation:禁止阴影
42+
* padding:按钮填充区域
43+
* shape:按钮形状
44+
* child:按钮中的Widget
45+
46+
### 高级用法
47+
按钮形状
48+
* BeveledRectangleBorder 带斜角的长方形边框
49+
* CircleBorder 圆形边框
50+
* RoundedRectangleBorder 圆角矩形
51+
* StadiumBorder 两端是半圆的边框
52+
53+
设置按钮形状常用属性
54+
* side:用来设置边线(颜色、宽度等)
55+
* borderRadius:用来设置圆角
56+
57+
使用RaisedButton.icon可以创建图标(icon)和标签(label)的widget文本按钮

0 commit comments

Comments
 (0)