getTextColor method

Color getTextColor(
  1. Color color
)

Returns the text color for the button based on the background color. If the background color is transparent, returns FxColor.gray700. Otherwise, returns FxColor.gray700 for light background colors and Colors.white for dark background colors.

Implementation

Color getTextColor(Color color) => color == Colors.transparent
    ? FxColor.gray700
    : color.computeLuminance() > 0.5
        ? FxColor.gray700
        : Colors.white;