On the code below, selecting "Option A" automatically selects "Option B" aswell.
This code is basically a copy paste from CheckboxListTile class documentation example, twice.
class Alergias extends StatefulWidget {
@override
_AlergiasState createState() => _AlergiasState();
}
class _AlergiasState extends State<Alergias> {
@override
Widget build(BuildContext context) {
return Scaffold(
...
body: Column(
CheckboxListTile(
title: const Text("Option A"),
value: timeDilation != 1.0,
controlAffinity: ListTileControlAffinity.leading,
onChanged: (bool value) {
setState(() {
timeDilation = value ? 2.0 : 1.0;
});
},
),
CheckboxListTile(
title: const Text("Option B"),
value: timeDilation != 1.0,
controlAffinity: ListTileControlAffinity.leading,
onChanged: (bool value) {
setState(() {
timeDilation = value ? 2.0 : 1.0;
});
},
),
],
),
);
}
}
I don't understand why this happens or if it has something to do with the StatefulWidget State. Can anyone help me?