简体   繁体   中英

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.

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,
                ),

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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