Switcher.labelAndRounded constructor

Switcher.labelAndRounded({
  1. required bool value,
  2. required void onChange(
    1. bool value
    ),
  3. required String? label,
  4. TextStyle? labelStyle = const TextStyle(),
  5. MainAxisAlignment mainAxisAlignment = MainAxisAlignment.spaceBetween,
  6. Duration duration = const Duration(milliseconds: 100),
  7. double size = 24.0,
  8. Color? activeColor,
  9. Color? disableColor,
})

The named constructor called label that render a circle shaped Switcher with a label.

  • 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.labelAndRounded({
  required this.value,
  required this.onChange,
  required this.label,
  this.labelStyle = const TextStyle(),
  this.mainAxisAlignment = MainAxisAlignment.spaceBetween,
  this.duration = const Duration(milliseconds: 100),
  this.size = 24.0,
  this.activeColor,
  this.disableColor,
})  :

      /// Set shape to a `circle`.
      this._borderRadius = size * 2.66,

      /// Assert [label] is not null.
      assert(label != null, 'The label variable must be seted'),

      /// 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');