NuntioStateButton constructor

NuntioStateButton({
  1. Key? key,
  2. required Map<ButtonState, Widget> stateWidgets,
  3. required Map<ButtonState, Color> stateColors,
  4. ButtonState? state = ButtonState.idle,
  5. Function? onPressed,
  6. Function? onAnimationEnd,
  7. double minWidth = 200.0,
  8. double maxWidth = 400.0,
  9. double progressIndicatorSize = 15.0,
  10. ProgressIndicator? progressIndicator,
  11. MainAxisAlignment progressIndicatorAlignment = MainAxisAlignment.spaceBetween,
  12. EdgeInsets padding = EdgeInsets.zero,
  13. List<ButtonState> minWidthStates = const <ButtonState>[ButtonState.loading],
  14. Duration animationDuration = const Duration(milliseconds: 500),
})

Implementation

NuntioStateButton(
    {Key? key,
    required this.stateWidgets,
    required this.stateColors,
    this.state = ButtonState.idle,
    this.onPressed,
    this.onAnimationEnd,
    this.minWidth = 200.0,
    this.maxWidth = 400.0,
    this.progressIndicatorSize = 15.0,
    this.progressIndicator,
    this.progressIndicatorAlignment = MainAxisAlignment.spaceBetween,
    this.padding = EdgeInsets.zero,
    this.minWidthStates = const <ButtonState>[ButtonState.loading],
    this.animationDuration = const Duration(milliseconds: 500)})
    : assert(
        stateWidgets.keys.toSet().containsAll(ButtonState.values.toSet()),
        'Must be non-null widgetds provided in map of stateWidgets. Missing keys => ${ButtonState.values.toSet().difference(stateWidgets.keys.toSet())}',
      ),
      assert(
        stateColors.keys.toSet().containsAll(ButtonState.values.toSet()),
        'Must be non-null widgetds provided in map of stateWidgets. Missing keys => ${ButtonState.values.toSet().difference(stateColors.keys.toSet())}',
      ),
      super(key: key);