Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter : how to left aligned a checkbox

Tags:

flutter

I am adding a check box and list title to my app. However, these item are not left align with the other widgets. How can I align it with the other widgets

here is a picture

enter image description here

like image 307
user2570135 Avatar asked Aug 15 '19 19:08

user2570135


1 Answers

You can use CheckboxListTile widget which has property called controlAffinity. Setting it to leading will make the checkbox left aligned. Below is sample working code:

CheckboxListTile(
  controlAffinity: ListTileControlAffinity.leading,
  title: Text('I agree to the Terms and Conditions'),
  value: monVal,
  onChanged: (bool value) {
    setState(() {
      monVal = value;
    });
  },
)

And the output is:

enter image description here

like image 137
Darshan Avatar answered Oct 19 '22 18:10

Darshan