Skip to content

Commit 741b1a6

Browse files
committed
RadioListTile
1 parent cecdd2f commit 741b1a6

File tree

3 files changed

+40
-15
lines changed

3 files changed

+40
-15
lines changed
Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,35 @@
11
## **RadioListTile**
22

33
>
4-
单选按钮
4+
带标签的单选按钮
55

66
### 构造方法
77
``` 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-
})
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+
})
1622
```
1723

1824
### 属性介绍
1925
* value:单选按钮的值
2026
* groupValue:此组单选按钮的当前选定值,当value=groupValue时表示该按钮被选中
2127
* onChanged:选择单选按钮时的回调
22-
* activeColor:选中该按钮的颜色
28+
* activeColor:选中该按钮的颜色
29+
* title: 标题
30+
* subtitle: 子标题
31+
* isThreeLine: 是否显示三行文本
32+
* dense: 是否垂直密集显示
33+
* secondary: 显示单选按钮一侧的小组件
34+
* selected: 是否使用activeColor渲染图标和文本
35+
* controlAffinity: 相对于文本放置控件位置

lib/widget/form/radiolisttile/demo.dart

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,27 +23,39 @@ class _IndexState extends State<Index> {
2323
Widget build(BuildContext context) {
2424
return Scaffold(
2525
appBar: AppBar(
26-
title: Text('Radio'),
26+
title: Text('RadioListTile'),
2727
),
2828
body: Column(
2929
children: <Widget>[
30-
Radio(
30+
RadioListTile(
3131
value: 0,
3232
groupValue: _radioValue,
3333
onChanged: _handleRadioValueChanged,
3434
activeColor: Theme.of(context).primaryColor,
35+
title: Text('RadioListTile A'),
36+
subtitle: Text('Description'),
37+
secondary: Icon(Icons.filter_1),
38+
selected: _radioValue == 0,
3539
),
36-
Radio(
40+
RadioListTile(
3741
value: 1,
3842
groupValue: _radioValue,
3943
onChanged: _handleRadioValueChanged,
4044
activeColor: Theme.of(context).primaryColor,
45+
title: Text('RadioListTile B'),
46+
subtitle: Text('Description'),
47+
secondary: Icon(Icons.filter_2),
48+
selected: _radioValue == 1,
4149
),
42-
Radio(
50+
RadioListTile(
4351
value: 2,
4452
groupValue: _radioValue,
4553
onChanged: _handleRadioValueChanged,
4654
activeColor: Theme.of(context).primaryColor,
55+
title: Text('RadioListTile C'),
56+
subtitle: Text('Description'),
57+
secondary: Icon(Icons.filter_3),
58+
selected: _radioValue == 2,
4759
),
4860
],
4961
),

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ Flutter UI
130130
│ ├─switchListTile 【✔️ v1.0】
131131
│ ├─daypicker 【✔️ v1.0】
132132
│ ├─radio 【✔️ v1.0】
133-
│ ├─radioListTile
133+
│ ├─radioListTile 【✔️ v1.0】
134134
│ ├─form
135135
│ ├─formfield
136136
│ ├─rawkeyboard

0 commit comments

Comments
 (0)