getColor static method

Color getColor(
  1. double percentage
)

A color representing a meter's fill.

Implementation

static Color getColor(double percentage) => switch (percentage) {
  > 0.45 => Colors.green,
  > 0.2 => Colors.orange,
  > 0 => Colors.red,
  _ => Colors.black,
};