ProgressButton constructor

ProgressButton({
  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 radius = 16.0,
  10. double height = 53.0,
  11. double progressIndicatorSize = 35.0,
  12. ProgressIndicator? progressIndicator,
  13. MainAxisAlignment progressIndicatorAlignment = MainAxisAlignment.spaceBetween,
  14. EdgeInsets padding = EdgeInsets.zero,
  15. List<ButtonState> minWidthStates = const <ButtonState>[ButtonState.loading],
  16. Duration animationDuration = const Duration(milliseconds: 500),
})

Implementation

ProgressButton(
    {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.radius = 16.0,
    this.height = 53.0,
    this.progressIndicatorSize = 35.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 != null &&
            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 != null &&
            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);