ProgressButton constructor
ProgressButton({
- Key? key,
- required Map<
ButtonState, Widget> stateWidgets, - required Map<
ButtonState, Color> stateColors, - ButtonState? state = ButtonState.idle,
- Function? onPressed,
- Function? onAnimationEnd,
- double minWidth = 200.0,
- double maxWidth = 400.0,
- double radius = 16.0,
- double height = 53.0,
- double progressIndicatorSize = 35.0,
- ProgressIndicator? progressIndicator,
- MainAxisAlignment progressIndicatorAlignment = MainAxisAlignment.spaceBetween,
- EdgeInsets padding = EdgeInsets.zero,
- List<
ButtonState> minWidthStates = const <ButtonState>[ButtonState.loading], - 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);