buttonColor static method

Color buttonColor(
  1. Brightness brightness,
  2. Set<ButtonStates> states
)

Defines the default color used by Buttons using the current brightness and state.

The color used for none and disabled are the same. Only the button content color should be changed. This can be done using the function Color.basedOnLuminance to define the contrast color.

Implementation

// Values eyeballed from Windows 10
// Used when the state is not recieving any user
// interaction or is disabled
static Color buttonColor(Brightness brightness, Set<ButtonStates> states) {
  late Color color;
  if (brightness == Brightness.light) {
    if (states.isPressing)
      color = Colors.grey[70];
    else if (states.isHovering)
      color = Colors.grey[40];
    else
      color = Color(0xFFcccccc);
    return color;
  } else {
    if (states.isPressing) {
      color = Color(0xFF666666);
    } else if (states.isHovering)
      color = Colors.grey[170];
    else {
      color = Color(0xFF333333);
    }
    return color;
  }
}