简体   繁体   English

在 Flutter 中创建复选框

[英]Creating tick box in Flutter

How to create such kind of thing in Flutter with possibility of putting a tick?如何在 Flutter 中创建这种可以打勾的东西?

enter image description here在此处输入图片说明

This kind of thing is called a Checkbox , and like most things, Flutter has a Widget for that.这种东西叫做Checkbox ,和大多数东西一样,Flutter 有一个Widget来做。

It's called Checkbox and the Flutter Team has a full live example of how it's used, go to their docs to find out more!它被称为Checkbox ,Flutter 团队有一个完整的使用示例,请访问他们的文档以了解更多信息!

you can use widget called CheckBox and use shape property to make it round您可以使用名为CheckBox小部件并使用shape属性使其变圆

Checkbox(
      checkColor: Colors.white,
      fillColor: MaterialStateProperty.resolveWith(getColor),
      value: isChecked,
      shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(2)),
      onChanged: (bool? value) {
        setState(() {
          isChecked = value!;
        });
      },
    );

here you can check more about Checkbox在这里您可以查看有关Checkbox更多信息

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

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