Created
August 8, 2019 09:04
-
-
Save ipondroid/c95cfbda459b94239e6aa329d30f8422 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class _MyListTiles extends State<MyListTiles> { | |
| var _checkboxValue = false; | |
| var _radioValue = 0; | |
| var _switchValue = false; | |
| @override | |
| Widget build(BuildContext context) { | |
| return ListView( | |
| padding: EdgeInsets.zero, | |
| children: <Widget>[ | |
| CheckboxListTile( | |
| value: _checkboxValue, | |
| title: Text('Open source?'), | |
| onChanged: (bool value) { | |
| setState(() { _checkboxValue = value; }); | |
| }, | |
| secondary: _checkboxValue?Icon(Icons.thumb_up):Icon(Icons.thumb_down), | |
| ), | |
| Divider(), | |
| RadioListTile( | |
| title: Text('GOOD'), | |
| value: 1, | |
| groupValue: _radioValue, | |
| onChanged: (int value) { | |
| setState(() { _radioValue = value; }); | |
| }, | |
| ), | |
| RadioListTile( | |
| title: Text('NOT GOOD'), | |
| value: 2, | |
| groupValue: _radioValue, | |
| onChanged: (int value) { | |
| setState(() { _radioValue = value; }); | |
| }, | |
| ), | |
| Divider(), | |
| SwitchListTile( | |
| title: Text('Lights'), | |
| subtitle: Text(_switchValue?'on':'off'), | |
| value: _switchValue, | |
| onChanged: (bool value) { | |
| setState(() { _switchValue = value; }); | |
| }, | |
| secondary: Icon(Icons.lightbulb_outline), | |
| ), | |
| ], | |
| ); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment