You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何缩小Flutter中两个Checkbox之间的默认间距?

Flutter 缩小CheckboxListTile之间间距的方案

如果需要缩小Flutter中CheckboxListTile组件之间的默认固定间距,可以通过用Container包裹CheckboxListTile并设置合适的height值来实现,示例代码如下:

Container(
  height: 30, // 调整此值控制组件高度,进而缩小间距
  child: CheckboxListTile(
    controlAffinity: ListTileControlAffinity.leading,
    value: mon,
    activeColor: Colors.green,
    checkboxShape: CircleBorder(),
    onChanged: (newvalue) {
      setState(() {
        mon = newvalue!;
      });
    },
    title: Text('Keep me sign in'),
  ),
)

通过Container的height属性限制CheckboxListTile的整体高度,就能有效缩小多个CheckboxListTile之间的垂直间距,你可以根据实际UI需求调整height的具体数值。

内容的提问来源于stack exchange,提问作者Rio

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.14 20:30:56