2024-03-24 16:38:06 +00:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
Color getColorOfRank(int rank){
|
2024-11-13 23:20:52 +00:00
|
|
|
if (rank < 1) return Colors.grey;
|
2024-03-24 16:38:06 +00:00
|
|
|
if (rank == 1) return Colors.yellowAccent;
|
|
|
|
if (rank == 2) return Colors.blueGrey;
|
|
|
|
if (rank == 3) return Colors.brown[400]!;
|
|
|
|
if (rank <= 9) return Colors.blueAccent;
|
|
|
|
if (rank <= 99) return Colors.greenAccent;
|
|
|
|
return Colors.grey;
|
2024-09-08 22:10:51 +00:00
|
|
|
}
|
|
|
|
|
2024-10-22 22:28:55 +00:00
|
|
|
Color? getStatColor(num value, num? avgValue, bool higherIsBetter){
|
|
|
|
if (avgValue == null) return null;
|
|
|
|
num percentile = (higherIsBetter ? value / avgValue : avgValue / value).abs();
|
|
|
|
if (percentile > 1.50) return Colors.purpleAccent;
|
|
|
|
if (percentile > 1.20) return Colors.blueAccent;
|
|
|
|
if (percentile > 0.90) return Colors.greenAccent;
|
|
|
|
if (percentile > 0.70) return Colors.yellowAccent;
|
|
|
|
return Colors.redAccent;
|
|
|
|
}
|
|
|
|
|
2024-09-08 22:10:51 +00:00
|
|
|
Color getDifferenceColor(num diff){
|
|
|
|
return diff.isNegative ? Colors.redAccent : Colors.greenAccent;
|
2024-03-24 16:38:06 +00:00
|
|
|
}
|