onChanged property

ValueChanged<bool> onChanged
final

Called when the user taps the ClipSwitch.

The ClipSwitch passes the new value to the callback but does not actually change state until the parent widget rebuilds the ClipSwitch with the new value.

The callback provided to onChanged should update the state of the parent StatefulWidget using the State.setState method, so that the parent gets rebuilt; for example:

ClipSwitch(
  ...
  value: _switchIsActive,
  onChanged: (bool newValue) {
    setState(() {
      _switchIsActive = newValue;
    });
  },
)

Implementation

final ValueChanged<bool> onChanged;