【问题标题】:Flutter - how to change CheckboxListTile size?Flutter - 如何更改 CheckboxListTile 大小?
【发布时间】:2020-02-12 03:26:09
【问题描述】:

如何仅更改 CheckboxListTile 上的复选框图标大小? 对于 Checkbox 小部件,我可以使用 Transform.scale 更改其大小,但在 CheckboxListTile 上我无法操作复选框图标。 如图所示,在平板电脑屏幕上,尺寸太小了。

【问题讨论】:

    标签: flutter dart widget


    【解决方案1】:

    不用担心! 最好使用 Transform.scale(), 它将帮助您通过缩放功能管理大小..

    *** 下面的代码 ***

    Row(
              children: [
                Transform.scale(
                  scale: 1.3,
                  child: Checkbox(value: mail, onChanged: (value) {}),
                ),
                Text(
                  "Recieve Mail",
                  style: TextStyle(fontSize: 18.0),
                )
              ],
            ),
    

    【讨论】:

      【解决方案2】:

      不确定我是否会在这里提供帮助,但看起来您是正确的,即通过 CheckBoxListTile 小部件添加时无法更改 CheckBox 大小。

      不过,您也可以通过为正在使用的每个图块插入一个 Row 来创建自己的图块:

      Row(
       children: [
        Icon(Icons.attach_money),
        Text("Sinal"),
        Transform(
         transform: myTransform, // I don't remember the correct syntax for this one
         child: Checkbox(
          value: true,
          onChanged: (_) {},
         ),
        ),
       ]
      ),
      

      您唯一需要添加的是根据设备动态更改图标、文本和复选框的大小。 (您可以使用MediaQuery.of(context).size 来实现此目的)

      【讨论】:

      • 感谢您的回答,插入一行可能会解决大小问题,但我不想失去 CheckboxListTile 功能,即单击它选中/取消选中复选框的图块上的任意位置。跨度>
      猜你喜欢
      • 2020-12-19
      • 1970-01-01
      • 2019-05-29
      • 2022-07-02
      • 2019-07-29
      • 2019-12-08
      • 2020-07-19
      • 1970-01-01
      • 2020-10-19
      相关资源
      最近更新 更多