mpob_colors.dart 1.2 KB

1234567891011121314151617181920212223242526272829303132
  1. import 'package:flutter/material.dart';
  2. /// The 6 MPOB grading classes, in canonical display order.
  3. const List<String> mpobClasses = ['Ripe', 'Unripe', 'Underripe', 'Overripe', 'Abnormal', 'Empty_Bunch'];
  4. /// MPOB-standard ripeness color palette, shared across bounding box
  5. /// overlays, result sheets, and history/report views.
  6. Color getMPOBColor(String label) {
  7. switch (label) {
  8. case 'Ripe':
  9. return const Color(0xFF22C55E); // Industrial Green
  10. case 'Underripe':
  11. return const Color(0xFFFBBF24); // Industrial Orange/Yellow
  12. case 'Unripe':
  13. return const Color(0xFF3B82F6); // Industrial Blue
  14. case 'Abnormal':
  15. return const Color(0xFFDC2626); // Critical Red
  16. case 'Empty_Bunch':
  17. return const Color(0xFF64748B); // Waste Gray
  18. default:
  19. return Colors.yellow;
  20. }
  21. }
  22. /// Coarser 3-way health/alert grouping (red = alert, green = good quality,
  23. /// orange = warning) used in result sheets and history summaries, as
  24. /// opposed to [getMPOBColor]'s per-class palette used on bounding boxes.
  25. Color getStatusColor(String label) {
  26. if (label == 'Empty_Bunch' || label == 'Abnormal') return const Color(0xFFF44336);
  27. if (label == 'Ripe' || label == 'Overripe') return const Color(0xFF4CAF50);
  28. return const Color(0xFFFF9800);
  29. }