NuntioStateButton constructor
NuntioStateButton({
- 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 progressIndicatorSize = 15.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
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);