Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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),
- ),
- ],
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement