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. dynamic minWidth = 200.0,
  8. dynamic maxWidth = 400.0,
  9. dynamic radius = 16.0,
  10. dynamic height = 53.0,
  11. dynamic progressIndicatorSize = 35.0,
  12. ProgressIndicator? progressIndicator,
  13. MainAxisAlignment progressIndicatorAligment = MainAxisAlignment.spaceBetween,
  14. EdgeInsets padding = EdgeInsets.zero,
  15. List<ButtonState> minWidthStates = const <ButtonState>[ButtonState.loading],
})

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.progressIndicatorAligment = MainAxisAlignment.spaceBetween,
      this.padding = EdgeInsets.zero,
      this.minWidthStates = const <ButtonState>[ButtonState.loading]})
    : 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);