Switch constructor
Creates a material design switch.
The switch itself does not maintain any state. Instead, when the state of
the switch changes, the widget calls the onChanged
callback. Most widgets
that use a switch will listen for the onChanged
callback and rebuild the
switch with a new value
to update the visual appearance of the switch.
The following arguments are required:
value
determines whether this switch is on or off.onChanged
is called when the user toggles the switch on or off.
Implementation
const Switch({
Key key,
@required this.value,
@required this.onChanged,
this.activeColor,
this.activeTrackColor,
this.inactiveThumbColor,
this.inactiveTrackColor,
this.activeThumbImage,
this.inactiveThumbImage,
this.materialTapTargetSize,
}) : _switchType = _SwitchType.material,
super(key: key);