Skip to content

Commit 2a0dc02

Browse files
committed
Merge branch 'lhr' into test
2 parents 4b8b7fb + 7a9bec3 commit 2a0dc02

File tree

3 files changed

+35
-8
lines changed

3 files changed

+35
-8
lines changed

docs/widget/form/switchlisttile/index.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
## **SwitchListTile**
22

33
>
4-
Switch是切换按钮控件,通常用于设置的选项里
4+
带有标签的开关
55

66
### 构造方法
77
``` dart
8-
Switch({
8+
SwitchListTile({
99
Key key,
1010
@required this.value,
1111
@required this.onChanged,
@@ -15,8 +15,12 @@ Switch({
1515
this.inactiveTrackColor,
1616
this.activeThumbImage,
1717
this.inactiveThumbImage,
18-
this.materialTapTargetSize,
19-
this.dragStartBehavior = DragStartBehavior.start,
18+
this.title,
19+
this.subtitle,
20+
this.isThreeLine = false,
21+
this.dense,
22+
this.secondary,
23+
this.selected = false,
2024
})
2125
```
2226

@@ -29,5 +33,9 @@ Switch({
2933
* inactiveTrackColor: 关闭状态track颜色
3034
* activeThumbImage: 打开状态下thumb图片
3135
* inactiveThumbImage: 关闭状态thumb图片
32-
* materialTapTargetSize: 配置点击目标的最小尺寸
33-
* dragStartBehavior: 确定处理拖动开始行为的方式
36+
* title: 标题
37+
* subtitle: 子标题
38+
* isThreeLine: 是否显示三行文本
39+
* dense: 是否垂直密集显示
40+
* secondary: 显示左侧侧的小组件
41+
* selected: 是否使用activeColor渲染图标和文本

lib/widget/form/switchlisttile/demo.dart

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,25 @@ class _IndexState extends State<Index> {
1919
title: Text('SwitchListTile'),
2020
),
2121
body: Center(
22-
child: Text('data')
22+
child: SwitchListTile(
23+
value: _switchValue,
24+
onChanged: (value) {
25+
setState(() {
26+
_switchValue = value;
27+
});
28+
},
29+
activeColor: Theme.of(context).primaryColor,
30+
activeTrackColor: Theme.of(context).primaryColor.withOpacity(0.3),
31+
inactiveThumbColor: Colors.black87,
32+
inactiveTrackColor: Colors.black12,
33+
activeThumbImage: NetworkImage('http://pic1.win4000.com/wallpaper/2019-02-15/5c664c4b4dc2f.jpg'),
34+
inactiveThumbImage: NetworkImage('http://pic1.win4000.com/wallpaper/2019-02-14/5c651084373de.jpg',),
35+
title: Text('Switch Item A'),
36+
subtitle: Text('SubTitle'),
37+
isThreeLine: false,
38+
secondary: _switchValue ? Icon(Icons.visibility) : Icon(Icons.visibility_off),
39+
selected: _switchValue,
40+
)
2341
),
2442
);
2543
}

readme.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,13 @@ Flutter UI
7979
│ ├─checkbox 【✔️ v1.0】
8080
│ ├─checkboxlisttile 【✔️ v1.0】
8181
│ ├─daypicker 【✔️ v1.0】
82+
│ ├─switch 【✔️ v1.0】
83+
│ ├─switchListTile 【✔️ v1.0】
8284
│ ├─form
8385
│ ├─formfield
8486
│ ├─radio
8587
│ ├─rawkeyboard
8688
│ ├─slider
87-
│ ├─switch
8889
│ ├─textfield
8990
│ └─textinput
9091
├─gestures

0 commit comments

Comments
 (0)