File tree Expand file tree Collapse file tree 5 files changed +102
-0
lines changed
docs/widget/form/checkboxlisttile Expand file tree Collapse file tree 5 files changed +102
-0
lines changed Original file line number Diff line number Diff line change 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: 相对于文本放置控件位置
Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff line change 11import 'package:efox_flutter/store/objects/widget_info.dart' ;
22import 'checkbox/index.dart' as CheckBox;
3+ import 'checkboxlisttile/index.dart' as CheckboxListTile;
34
45const 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
Original file line number Diff line number Diff 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/
You can’t perform that action at this time.
0 commit comments