getBackgroundColor method
Background color based on state
Implementation
Color getBackgroundColor({
Color? idleColor,
Color? loadingColor,
Color? successColor,
Color? errorColor,
}) {
switch (_state) {
case ButtonState.loading:
return loadingColor ?? Colors.grey;
case ButtonState.success:
return successColor ?? Colors.green;
case ButtonState.error:
return errorColor ?? Colors.red;
case ButtonState.idle:
return idleColor ?? const Color.fromARGB(255, 3, 9, 110);
}
}