Switcher constructor
Switcher({})
The default Switcher constructor that render a square shaped Switcher
.
- value: Default is
It's required
; - onChange:
It's required
; - duration: Default is
Duration(milliseconds: 100)
; - size: Default is
24.0
; - activeColor: Default is
Theme.of(context).accentColor
; - disableColor: Default is
Theme.of(context).disabledColor
;
Implementation
Switcher({
required this.value,
required this.onChange,
this.duration = const Duration(milliseconds: 100),
this.size = 24.0,
this.activeColor,
this.disableColor,
}) :
/// Set shape to a `square`.
this._borderRadius = size / 6,
/// Assert [size] is greater than or equal to `16.0`.
assert(size >= 16.0, 'The size must be greater than or equal to 16.0');