Advertisement
Guest User

Untitled

a guest
Aug 20th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. class _MyListTiles extends State<MyListTiles> {
  2. var _checkboxValue = false;
  3. var _radioValue = 0;
  4. var _switchValue = false;
  5.  
  6. @override
  7. Widget build(BuildContext context) {
  8. return ListView(
  9. padding: EdgeInsets.zero,
  10. children: <Widget>[
  11. CheckboxListTile(
  12. value: _checkboxValue,
  13. title: Text('Open source?'),
  14. onChanged: (bool value) {
  15. setState(() { _checkboxValue = value; });
  16. },
  17. secondary: _checkboxValue?Icon(Icons.thumb_up):Icon(Icons.thumb_down),
  18. ),
  19. Divider(),
  20. RadioListTile(
  21. title: Text('GOOD'),
  22. value: 1,
  23. groupValue: _radioValue,
  24. onChanged: (int value) {
  25. setState(() { _radioValue = value; });
  26. },
  27. ),
  28. RadioListTile(
  29. title: Text('NOT GOOD'),
  30. value: 2,
  31. groupValue: _radioValue,
  32. onChanged: (int value) {
  33. setState(() { _radioValue = value; });
  34. },
  35. ),
  36. Divider(),
  37. SwitchListTile(
  38. title: Text('Lights'),
  39. subtitle: Text(_switchValue?'on':'off'),
  40. value: _switchValue,
  41. onChanged: (bool value) {
  42. setState(() { _switchValue = value; });
  43. },
  44. secondary: Icon(Icons.lightbulb_outline),
  45. ),
  46. ],
  47. );
  48. }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement