Skip to content

Commit 6b375fd

Browse files
committed
Merge branch 'lhr' into test
2 parents 168d925 + 15f338a commit 6b375fd

File tree

5 files changed

+102
-0
lines changed

5 files changed

+102
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
## **CheckboxListTile**
2+
3+
>
4+
带有标签的复选框
5+
6+
### 构造方法
7+
``` dart
8+
CheckboxListTile({
9+
Key key,
10+
@required this.value,
11+
@required this.onChanged,
12+
this.activeColor,
13+
this.title,
14+
this.subtitle,
15+
this.isThreeLine = false,
16+
this.dense,
17+
this.secondary,
18+
this.selected = false,
19+
this.controlAffinity = ListTileControlAffinity.platform,
20+
})
21+
```
22+
23+
### 属性介绍
24+
* value: 复选框选择状态
25+
* onChanged: 点击复选框的回调函数
26+
* activeColor: 选中此复选框时要使用的颜色
27+
* title: 标题
28+
* subtitle: 子标题
29+
* isThreeLine: 是否显示三行文本
30+
* dense: 是否垂直密集显示
31+
* secondary: 显示复选框一侧的小组件
32+
* selected: 是否使用activeColor渲染图标和文本
33+
* controlAffinity: 相对于文本放置控件位置
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import 'package:flutter/material.dart';
2+
3+
class Index extends StatefulWidget {
4+
@override
5+
_IndexState createState() => _IndexState();
6+
}
7+
8+
class _IndexState extends State<Index> {
9+
List<bool> checkboxValue = [false, true, true, false];
10+
11+
@override
12+
Widget build(BuildContext context) {
13+
return Scaffold(
14+
appBar: AppBar(title: Text('CheckboxListTile'),),
15+
body: ListView(
16+
children: List.generate(4, (index) {
17+
return CheckboxListTile(
18+
value: checkboxValue[index],
19+
onChanged: (value) {
20+
setState(() {
21+
checkboxValue[index] = value;
22+
});
23+
},
24+
activeColor: Theme.of(context).primaryColor,
25+
title: Text('Checkbox Item ${index+1}'),
26+
subtitle: Text('Description'),
27+
isThreeLine: false,
28+
dense: false,
29+
secondary: Icon(Icons.bookmark),
30+
// selected: checkboxValue[index],
31+
controlAffinity: ListTileControlAffinity.platform,
32+
);
33+
}),
34+
),
35+
);
36+
}
37+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import 'package:flutter/material.dart';
2+
import 'package:efox_flutter/components/widgetComp.dart' as WidgetComp;
3+
import 'demo.dart' as Demo;
4+
5+
class Index extends StatefulWidget {
6+
static String title = 'CheckboxListTile';
7+
static String originCodeUrl = 'https://docs.flutter.io/flutter/material/CheckboxListTile-class.html';
8+
static String mdUrl = 'docs/widget/form/checkboxlisttile/index.md';
9+
@override
10+
_IndexState createState() => _IndexState();
11+
}
12+
13+
class _IndexState extends State<Index> {
14+
@override
15+
Widget build(BuildContext context) {
16+
return WidgetComp.Index(
17+
title: Index.title,
18+
originCodeUrl: Index.originCodeUrl,
19+
mdUrl: Index.mdUrl,
20+
demoChild: <Widget>[
21+
Demo.Index()
22+
],
23+
);
24+
}
25+
}

lib/widget/form/index.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import 'package:efox_flutter/store/objects/widget_info.dart';
22
import 'checkbox/index.dart' as CheckBox;
3+
import 'checkboxlisttile/index.dart' as CheckboxListTile;
34

45
const nameSpaces = '/form_';
56

@@ -8,6 +9,11 @@ List widgets = [
89
widget: CheckBox.Index(),
910
code: 57923, // format_paint
1011
title: CheckBox.Index.title
12+
),
13+
ItemInfo(
14+
widget: CheckboxListTile.Index(),
15+
code: 59662, // gavel
16+
title: CheckboxListTile.Index.title
1117
)
1218
];
1319

pubspec.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ flutter:
8787
- docs/widget/bulletbox/snackbar/
8888
- docs/widget/bulletbox/expansionpanel/
8989
- docs/widget/form/checkbox/
90+
- docs/widget/form/checkboxlisttile/
9091
- docs/widget/navigator/appbar/
9192
- docs/widget/navigator/bottomnavigationbar/
9293
- docs/widget/navigator/drawer/

0 commit comments

Comments
 (0)