Flutter 如何在Flatter中更改checkBoxListTile中的复选框颜色?

Flutter 如何在Flatter中更改checkBoxListTile中的复选框颜色?,flutter,checkboxlist,Flutter,Checkboxlist,我使用的是这样的CheckBoxListTile CheckboxListTile( title: Text( ourAllnotes[i].note, style: TextStyle(color: Colors.white), ), value: false, onChanged: (bool value) {}, a

我使用的是这样的CheckBoxListTile

CheckboxListTile(
            title: Text(
              ourAllnotes[i].note,
              style: TextStyle(color: Colors.white),
            ),
            value: false,
            onChanged: (bool value) {},
            activeColor: Colors.orange,
            checkColor: Colors.white,
            controlAffinity: ListTileControlAffinity.leading,
          )
我可以在选中复选框后更改其颜色,但我无法在选中复选框之前更改其颜色,而不是更改其默认值。 如何做到这一点?

尝试使用主题小部件包装CheckBoxListTile,并在未选择的WidgetColor属性中选择颜色

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

      title: Text(
        "show password",
        style: TextStyle(
            fontSize: 12, color: Colors.white, letterSpacing: 2),
      ),
      value: checkboxflag,
      onChanged: (newValue) {
        setState(() {
          if (newValue) {
            checkboxflag = newValue;
            _obscureText = false;
          } else {
            checkboxflag = newValue;
            _obscureText = true;
          }
        });
      },
      controlAffinity:
          ListTileControlAffinity.leading, //  <-- leading Checkbox
    ),
  )
尝试使用主题小部件包装CheckBoxListTile,并在未选择的WidgetColor属性中选择颜色

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

      title: Text(
        "show password",
        style: TextStyle(
            fontSize: 12, color: Colors.white, letterSpacing: 2),
      ),
      value: checkboxflag,
      onChanged: (newValue) {
        setState(() {
          if (newValue) {
            checkboxflag = newValue;
            _obscureText = false;
          } else {
            checkboxflag = newValue;
            _obscureText = true;
          }
        });
      },
      controlAffinity:
          ListTileControlAffinity.leading, //  <-- leading Checkbox
    ),
  )