Skip to content

Commit 52fb0af

Browse files
authored
Merge pull request #27 from efoxTeam/test
feat: 合并test分支
2 parents adbd7a4 + 043d180 commit 52fb0af

Some content is hidden

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

66 files changed

+1143
-388
lines changed
Loading
Loading
Loading
Loading
Loading
Loading
27.5 KB
Loading

assets/imgs/avatar.png

251 KB
Loading

docs/widget/form/daypicker/index.md

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,35 @@
1-
## **文档完善中**
1+
## **DatePicker**
2+
3+
>
4+
显示给定月份的日期并允许选择一天
5+
* 日期选择器很少直接使用,请考虑使用 showDatePicker 或者 showTimePicker,它会创建一个日期/时间选择器对话框
6+
7+
### showDatePicker构造方法
8+
``` dart
9+
showDatePicker({
10+
@required BuildContext context,
11+
@required DateTime initialDate,
12+
@required DateTime firstDate,
13+
@required DateTime lastDate,
14+
SelectableDayPredicate selectableDayPredicate,
15+
DatePickerMode initialDatePickerMode = DatePickerMode.day,
16+
Locale locale,
17+
TextDirection textDirection,
18+
TransitionBuilder builder,
19+
})
20+
```
21+
22+
### showTimePicker构造方法
23+
``` dart
24+
showTimePicker({
25+
@required BuildContext context,
26+
@required TimeOfDay initialTime,
27+
TransitionBuilder builder,
28+
})
29+
```
30+
31+
### 属性介绍
32+
* context: 上下文
33+
* initialDate: 初始时间
34+
* firstDate: 设置选择的最早时间
35+
* lastDate: 设置选择的最晚时间

docs/widget/form/radio/index.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,22 @@
1-
## **文档完善中**
1+
## **Radio**
2+
3+
>
4+
单选按钮
5+
6+
### 构造方法
7+
``` dart
8+
Radio({
9+
Key key,
10+
@required this.value,
11+
@required this.groupValue,
12+
@required this.onChanged,
13+
this.activeColor,
14+
this.materialTapTargetSize,
15+
})
16+
```
17+
18+
### 属性介绍
19+
* value:单选按钮的值
20+
* groupValue:此组单选按钮的当前选定值,当value=groupValue时表示该按钮被选中
21+
* onChanged:选择单选按钮时的回调
22+
* activeColor:选中该按钮的颜色
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
## **RadioListTile**
2+
3+
>
4+
带标签的单选按钮
5+
6+
### 构造方法
7+
``` dart
8+
RadioListTile({
9+
Key key,
10+
@required this.value,
11+
@required this.groupValue,
12+
@required this.onChanged,
13+
this.activeColor,
14+
this.title,
15+
this.subtitle,
16+
this.isThreeLine = false,
17+
this.dense,
18+
this.secondary,
19+
this.selected = false,
20+
this.controlAffinity = ListTileControlAffinity.platform,
21+
})
22+
```
23+
24+
### 属性介绍
25+
* value:单选按钮的值
26+
* groupValue:此组单选按钮的当前选定值,当value=groupValue时表示该按钮被选中
27+
* onChanged:选择单选按钮时的回调
28+
* activeColor:选中该按钮的颜色
29+
* title: 标题
30+
* subtitle: 子标题
31+
* isThreeLine: 是否显示三行文本
32+
* dense: 是否垂直密集显示
33+
* secondary: 显示单选按钮一侧的小组件
34+
* selected: 是否使用activeColor渲染图标和文本
35+
* controlAffinity: 相对于文本放置控件位置

docs/widget/form/switch/index.md

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,33 @@
1-
## **文档完善中**
1+
## **Switch**
2+
3+
>
4+
Switch是切换按钮控件,通常用于设置的选项里
5+
6+
### 构造方法
7+
``` dart
8+
Switch({
9+
Key key,
10+
@required this.value,
11+
@required this.onChanged,
12+
this.activeColor,
13+
this.activeTrackColor,
14+
this.inactiveThumbColor,
15+
this.inactiveTrackColor,
16+
this.activeThumbImage,
17+
this.inactiveThumbImage,
18+
this.materialTapTargetSize,
19+
this.dragStartBehavior = DragStartBehavior.start,
20+
})
21+
```
22+
23+
### 属性介绍
24+
* value: true:开 false:关
25+
* onChanged: 变化时回调
26+
* activeColor: 打开状态下颜色
27+
* activeTrackColor: 打开状态下track颜色
28+
* inactiveThumbColor: 关闭状态thumb颜色
29+
* inactiveTrackColor: 关闭状态track颜色
30+
* activeThumbImage: 打开状态下thumb图片
31+
* inactiveThumbImage: 关闭状态thumb图片
32+
* materialTapTargetSize: 配置点击目标的最小尺寸
33+
* dragStartBehavior: 确定处理拖动开始行为的方式
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
## **SwitchListTile**
2+
3+
>
4+
带有标签的开关
5+
6+
### 构造方法
7+
``` dart
8+
SwitchListTile({
9+
Key key,
10+
@required this.value,
11+
@required this.onChanged,
12+
this.activeColor,
13+
this.activeTrackColor,
14+
this.inactiveThumbColor,
15+
this.inactiveTrackColor,
16+
this.activeThumbImage,
17+
this.inactiveThumbImage,
18+
this.title,
19+
this.subtitle,
20+
this.isThreeLine = false,
21+
this.dense,
22+
this.secondary,
23+
this.selected = false,
24+
})
25+
```
26+
27+
### 属性介绍
28+
* value: true:开 false:关
29+
* onChanged: 变化时回调
30+
* activeColor: 打开状态下颜色
31+
* activeTrackColor: 打开状态下track颜色
32+
* inactiveThumbColor: 关闭状态thumb颜色
33+
* inactiveTrackColor: 关闭状态track颜色
34+
* activeThumbImage: 打开状态下thumb图片
35+
* inactiveThumbImage: 关闭状态thumb图片
36+
* title: 标题
37+
* subtitle: 子标题
38+
* isThreeLine: 是否显示三行文本
39+
* dense: 是否垂直密集显示
40+
* secondary: 显示左侧侧的小组件
41+
* selected: 是否使用activeColor渲染图标和文本

docs/widget/form/textfield/index.md

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,64 @@
1-
## **文档完善中**
1+
## **TextField**
2+
3+
>
4+
TextField最常用的文本输入Widget
5+
6+
7+
### 构造方法
8+
``` dart
9+
TextField({
10+
Key key,
11+
this.controller,
12+
this.focusNode,
13+
this.decoration = const InputDecoration(),
14+
TextInputType keyboardType,
15+
this.textInputAction,
16+
this.textCapitalization = TextCapitalization.none,
17+
this.style,
18+
this.strutStyle,
19+
this.textAlign = TextAlign.start,
20+
this.textDirection,
21+
this.autofocus = false,
22+
this.obscureText = false,
23+
this.autocorrect = true,
24+
this.maxLines = 1,
25+
this.maxLength,
26+
this.maxLengthEnforced = true,
27+
this.onChanged,
28+
this.onEditingComplete,
29+
this.onSubmitted,
30+
this.inputFormatters,
31+
this.enabled,
32+
this.cursorWidth = 2.0,
33+
this.cursorRadius,
34+
this.cursorColor,
35+
this.keyboardAppearance,
36+
this.scrollPadding = const EdgeInsets.all(20.0),
37+
this.dragStartBehavior = DragStartBehavior.start,
38+
this.enableInteractiveSelection,
39+
this.onTap,
40+
this.buildCounter,
41+
})
42+
```
43+
44+
### 属性介绍
45+
* controller:TextField的控制器,可用来添加通知或者获取TextField的值,如controller.text
46+
* decoration = const InputDecoration():装饰器,设置相关的属性能构造出各种TextField效果,详情见Demo
47+
* TextInputType keyboardType:TextField获得焦点时弹出的键盘类型
48+
* style:输入框文本样式
49+
* textAlign:文本对齐方式
50+
* textDirection:文本方向
51+
* autofocus:是否自动对焦
52+
* obscureText:是否以密码形式显示
53+
* autocorrect:是否自动更正
54+
* maxLines:最大行数
55+
* maxLength:最大长度,设置此项会让TextField右下角有一个输入数量的统计字符串
56+
* maxLengthEnforced = true:
57+
* onChanged:输入框内容改变进行回调
58+
* onEditingComplete:输入完毕回调
59+
* onSubmitted:内容提交,回车的回调
60+
* enabled:是否禁用
61+
* cursorWidth = 2.0:光标的宽度
62+
* cursorRadius:光标的角的圆角
63+
* cursorColor:光标的颜色
64+
* onTap:点击文本时调用

docs/widget/navigator/appbar/index.md

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,32 @@
1-
## **AppBar**
1+
## **AppBar**
2+
> 创建导航栏,
3+
4+
### 构造函数
5+
```
6+
AppBar({
7+
Key key,
8+
Widget leading,
9+
bool automaticallyImplyLeading: true,
10+
Widget title,
11+
List<Widget> actions,
12+
Widget flexibleSpace,
13+
PreferredSizeWidget bottom,
14+
double elevation,
15+
Color backgroundColor,
16+
Brightness brightness,
17+
IconThemeData iconTheme,
18+
TextTheme textTheme,
19+
bool primary: true,
20+
bool centerTitle,
21+
double titleSpacing: NavigationToolbar.kMiddleSpacing,
22+
double toolbarOpacity: 1.0,
23+
double bottomOpacity: 1.0
24+
})
25+
```
26+
27+
### 属性介绍
28+
- leading: 导航栏左侧图标
29+
- title: 导航栏标题
30+
- actions: 导航栏右侧扩展图标,可添加PopupMenuButton,点开有下拉展开更多按钮。
31+
- automaticallyImplyLeading: 默认true, 当有上一级页面时,默认显示back按钮
32+
- bottom: 通过与Tabbar使用

docs/widget/navigator/drawer/index.md

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,50 @@
1-
## **文档完善中**
1+
## **Drawer**
2+
> 抽屉式组件,从Scaffold边缘水平滑出左侧菜单,也可通过Scaffold.of(context).openDrawer()显示左侧菜单。关闭页面通过Navigator.pop(context)。
3+
4+
### 构造函数
5+
```
6+
Drawer({
7+
Key key,
8+
double elevation: 16.0,
9+
Widget child,
10+
String semanticLabel
11+
})
12+
```
13+
14+
### 属性介绍
15+
- child: 菜单内容
16+
- elevation:导航栏底部阴影
17+
18+
### 高级用法
19+
- 关闭菜单
20+
> Navigator.pop(context)
21+
- 打开菜单
22+
> 方法一: Scaffold.of(context).openDrawer()
23+
```
24+
使用context变量时,需要注意在scaffold中增加Builder来获取到context,该context才是scaffold中的上下文对象,而Build build(BuildContext context)是外层类的上下文,没法操作菜单
25+
Builder(
26+
builder: (context) {
27+
return RaisedButton(
28+
onPressed: () {
29+
Scaffold.of(context).openDrawer();
30+
},
31+
child: Text("点击滑出左侧菜单"),
32+
);
33+
},
34+
),
35+
```
36+
37+
> 方法二: static GlobalKey<ScaffoldState> _globalKey= new GlobalKey();
38+
```
39+
定义globalKey
40+
41+
static GlobalKey<ScaffoldState> _globalKey= new GlobalKey();
42+
...
43+
Scaffold(
44+
key: _globalKey , //设置key
45+
...
46+
)
47+
48+
通过globalkey操作菜单状态
49+
_globalKey.currentState.openDrawer()
50+
```

0 commit comments

Comments
 (0)