added frontend

This commit is contained in:
verboomp
2026-01-21 16:08:09 +01:00
parent d2e6f5164a
commit b3de3eec8c
74 changed files with 4938 additions and 26 deletions

View File

@@ -0,0 +1,29 @@
import 'package:flutter/material.dart' show Colors, Color;
extension HexColor on Color {
/// String is in the format "aabbcc" or "ffaabbcc" with an optional leading "#".
static Color fromHex(String hexString) {
final buffer = StringBuffer();
if (hexString.length == 6 || hexString.length == 7) buffer.write('ff');
buffer.write(hexString.replaceFirst('#', ''));
return Color(int.parse(buffer.toString(), radix: 16));
}
}
extension RiskColor on Color {
static const Color noRisk = Colors.transparent;
static final Color lowRisk = HexColor.fromHex("#FFFF00");
static final Color mediumRisk = HexColor.fromHex("#FF9000");
static final Color highRisk = HexColor.fromHex("#FF4000");
static Color colorForRisk(int value) {
if (value == 1) {
return lowRisk;
} else if (value == 2) {
return mediumRisk;
} else if (value == 3) {
return highRisk;
}
return noRisk;
}
}