我正在尝试创建一个复选框列表,如下所示: my plan
我将CheckBoxListTile
与dense
和contentPadding
一起使用来删除所有可能的填充,这就是我所拥有的:
my result
是否可以删除CheckBoxListTile
之间的多余“填充”?
这是我的代码(一个复选框):
class Checklist extends StatefulWidget {
Checklist({@required this.content});
final String content;
@override
_ChecklistState createState() => _ChecklistState();
}
class _ChecklistState extends State<Checklist> {
bool _checked = false;
@override
Widget build(BuildContext context) {
return CheckboxListTile(
contentPadding: EdgeInsets.all(0),
//dense: true,
title: Text(widget.content, style: TextStyle(color: kBlackColor),),
value: _checked,
onChanged: (bool value) {
setState(() {
_checked = value;
});
},
controlAffinity: ListTileControlAffinity.leading,
activeColor: kBlackColor,
);
}
}
多个复选框:
Column(
children: [
Checklist(content: 'Develop an app'),
Checklist(content: 'Develop a good app'),
Checklist(content: 'Develop a really good app'),
],
),
答案 0 :(得分:0)
将您的CheckBox包裹在SizedBox中将调整复选框的填充大小
SizedBox(
height: whatYouWant,
width: whatYouWant,
child: Checkbox(...),
)