xxxxxxxxxx
Flutter SwitchListTile Widget
-------------------------------
SwitchListTile(
title: const Text('Lights'),
value: ans,
onChanged: (bool value) {
setState(() {
ans = value;
});
},
secondary: const Icon(Icons.lightbulb_outline),
),
xxxxxxxxxx
class _SettingsScreenState extends State<SettingsScreen> {
@override
Widget build(BuildContext context) {
return SwitchListTile(
title: const Text('Dark Mode'),
value: SettingsScreenVM.isDarkMode,
onChanged: (bool value) {
setState(() {
SettingsScreenVM.isDarkMode = value;
});
},
secondary: const Icon(Icons.sunny),
);
}
}