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 OneButtonHierarchy.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 OneButtonHierarchy.secondaryGray:
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 OneButtonHierarchy.secondaryColor:
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.brand50);
}
return context.color.background(BackgroundColorType.primary);
case OneButtonHierarchy.tertiaryGray:
return context.color.background(BackgroundColorType.secondary);
case OneButtonHierarchy.tertiaryColor:
return context.color.background(BackgroundColorType.secondary);
case OneButtonHierarchy.linkGray:
return Colors.transparent;
case OneButtonHierarchy.linkColor:
return Colors.transparent;
}
}