简体   繁体   English

Flutter - CheckboxListTile - 边框颜色为白色

[英]Flutter - CheckboxListTile - Border color white

I don't have any idea how to change the color of checkbox border and move the text closer.我不知道如何更改复选框边框的颜色并将文本移近。 Below is my code and image of I want to achieve.下面是我想要实现的代码和图像。

Thanks!谢谢!

在此处输入图像描述

CheckboxListTile(
                  title: const Text('Remember Me'),
                  value: _isSelected,
                  onChanged: (bool value) {
                    setState(() {
                      _isSelected = value;
                    });
                  },
                  controlAffinity: ListTileControlAffinity.leading,
                ),

Try this solution:试试这个解决方案:

Theme(
    data: ThemeData(unselectedWidgetColor: Colors.white),
    child: CheckboxListTile(....),
    )

these two property check color and active color helps you to change the color of check box.. for moving closer the text.You can use Container or Row: you can use row with main axis alignment.这两个属性检查颜色和活动颜色可帮助您更改复选框的颜色.. 以靠近文本。您可以使用容器或行:您可以使用主轴为 alignment 的行。

If someone tries to change the border of the Checkbox list tile, not the checkbox itself.如果有人试图更改复选框列表磁贴的边框,而不是复选框本身。

CheckboxListTile(
  title: const Text('text'),
  shape: RoundedRectangleBorder(
  borderRadius: BorderRadius.circular(20.0), // Optionally
    side: const BorderSide(color: Colors.pink),
  ),
  value: true,
  onChanged: (_) {},
)

Makes it look like that.让它看起来像那样。

在此处输入图像描述

You can use Checkbox inside a Row您可以在行内使用复选框

Row(children:[Checkbox(...), Text(...)]);

I don't have any idea how to change the color of checkbox border and move the text closer.我不知道如何更改复选框边框的颜色并将文本移近。 Below is my code and image of I want to achieve.下面是我想要实现的代码和图像。

Thanks!谢谢!

在此处输入图像描述

CheckboxListTile(
                  title: const Text('Remember Me'),
                  value: _isSelected,
                  onChanged: (bool value) {
                    setState(() {
                      _isSelected = value;
                    });
                  },
                  controlAffinity: ListTileControlAffinity.leading,
                ),

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM