Flutter CheckboxListTile 框到中心?

时间:2021-07-30 08:00:01

标签: flutter dart

我正在尝试创建一个记住我的 CheckboxListTile,但我不知道如何将框和文本都放在中心?

 bool rememberMeCheckBoxValue = false;
 createCheckBox() {
    return CheckboxListTile(
      tileColor: Colors.red,
      activeColor: Colors.yellow,
      checkColor: Colors.white,
      title: Center(
        child: Text(
          "Remember me",
          style: TextStyle(
            color: Colors.white,
            fontSize: 18,
          ),
        ),
      ),
      value: rememberMeCheckBoxValue,
      onChanged: (newValue) {
        setState(() {
          rememberMeCheckBoxValue = newValue;
        });
      },
      controlAffinity: ListTileControlAffinity.leading,
    );
 }

这会将文本放在中心,但框保持在左侧。如何实现随文本移动框?

0 个答案:

没有答案