Home

Published

- 1 min read

How do you add a label (title text) to a Checkbox in Flutter?

img of How do you add a label (title text) to a Checkbox in Flutter?

The solution for this is noted below

How do you add a label (title text) to a Checkbox in Flutter?

Solution

   bool isChecked = false;
CheckboxListTile(
            title: Text('CheckboxTitle'),
            subtitle: Text('subtitle'),
            secondary: Icon(Icons.delete),
            controlAffinity: ListTileControlAffinity.leading, // ListTileControlAffinity.trailing
            value: isChecked,
            onChanged: (v) {
              setState(() {
                isChecked = v!;
              });
            },
          ),

Try other methods by searching on the site. That is if this doesn’t work