Flutter Switch widget does not working fine, i am using switch widget for yes and no options but in flutter i am not able to change swtich button state. when i drag dot left to right only then it is changeing but i want to switch on click event.
Switch( value: false, onChanged: (bool val) {}, ),
also switch doesnt have anything to show my Text.
whats wrong i am doing here?
- 4 years ago
You have to use setState(){}
bool _acceptTrm=false; ... SwitchListTile( value: _acceptTrm, title: Text('Accept Terms'), onChanged: (bool value) { setState(() { _acceptTrm = value; }); }, ),
you have to use SwitchListTile for Text with Switch Widget.
Hot Questions