background method
Color
background({
- required BuildContext context,
- required bool isFocused,
- required bool isPressed,
- required bool isDisabled,
Implementation
Color background({
required BuildContext context,
required bool isFocused,
required bool isPressed,
required bool isDisabled,
}) {
switch (this) {
case OneButtonDestructiveHierarchy.primary:
if (isDisabled) {
return context.color.background(BackgroundColorType.disabled);
} else if (isPressed) {
return context.color.utility(UtilityColorType.brand700);
} else if (isFocused) {
return context.color.utility(UtilityColorType.brand300);
}
return Theme.of(context).colorScheme.primary;
case OneButtonDestructiveHierarchy.secondary:
if (isDisabled) {
return context.color.background(BackgroundColorType.primary);
} else if (isPressed) {
return context.color.background(BackgroundColorType.primary);
} else if (isFocused) {
return context.color.utility(UtilityColorType.gray50);
}
return context.color.background(BackgroundColorType.primary);
case OneButtonDestructiveHierarchy.tertiary:
case OneButtonDestructiveHierarchy.link:
return context.color.background(BackgroundColorType.secondary);
}
}