new UI + new targets.

This commit is contained in:
Jan Pleterski
2026-11-27 14:37:44 +01:00
parent 5f9e2a3b86
commit 2fc741a9f6
113 changed files with 6861 additions and 7381 deletions
+25 -9
View File
@@ -27,6 +27,9 @@ class ProgressChart extends StatefulWidget {
final List<ChartSeries> series; // legend and tooltip order
final Color textColor;
final Color gridColor;
final Color surfaceColor; // ring around points
final Color tooltipColor;
final Color tooltipTextColor;
// true: the graph takes all the height its parent gives it (inside an
// Expanded); false: a fixed 190 px
final bool expand;
@@ -37,6 +40,9 @@ class ProgressChart extends StatefulWidget {
required this.series,
required this.textColor,
required this.gridColor,
this.surfaceColor = Colors.white,
this.tooltipColor = const Color(0xFF212121),
this.tooltipTextColor = Colors.white,
this.expand = false,
});
@@ -97,6 +103,9 @@ class _ProgressChartState extends State<ProgressChart> {
series: widget.series,
textColor: widget.textColor,
gridColor: widget.gridColor,
surfaceColor: widget.surfaceColor,
tooltipColor: widget.tooltipColor,
tooltipTextColor: widget.tooltipTextColor,
selected: _selected,
),
),
@@ -120,9 +129,9 @@ class _ProgressChartState extends State<ProgressChart> {
mainAxisSize: MainAxisSize.min,
children: [
Container(
width: 14,
height: 3,
decoration: BoxDecoration(color: s.color, borderRadius: BorderRadius.circular(2)),
width: 8,
height: 8,
decoration: BoxDecoration(color: s.color, shape: BoxShape.circle),
),
const SizedBox(width: 6),
Text(s.name, style: TextStyle(fontSize: 12, color: widget.textColor)),
@@ -148,6 +157,9 @@ class _ChartPainter extends CustomPainter {
final List<ChartSeries> series;
final Color textColor;
final Color gridColor;
final Color surfaceColor;
final Color tooltipColor;
final Color tooltipTextColor;
final int? selected;
_ChartPainter({
@@ -155,6 +167,9 @@ class _ChartPainter extends CustomPainter {
required this.series,
required this.textColor,
required this.gridColor,
required this.surfaceColor,
required this.tooltipColor,
required this.tooltipTextColor,
required this.selected,
});
@@ -225,7 +240,7 @@ class _ChartPainter extends CustomPainter {
for (int i = 0; i < n; i++) {
final isSel = i == selected;
final p = Offset(xAt(i), yAt(s.values[i], r));
canvas.drawCircle(p, isSel ? 6 : 4.5, Paint()..color = Colors.white);
canvas.drawCircle(p, isSel ? 6 : 4.5, Paint()..color = surfaceColor);
canvas.drawCircle(p, isSel ? 4.5 : 3.5, Paint()..color = s.color);
}
}
@@ -236,13 +251,13 @@ class _ChartPainter extends CustomPainter {
canvas.drawLine(Offset(xAt(i), plot.top), Offset(xAt(i), plot.bottom), grid);
final tp = TextPainter(
text: TextSpan(
style: const TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Colors.white),
style: TextStyle(fontFamily: 'Inter', fontSize: 12, fontWeight: FontWeight.w600, color: tooltipTextColor),
children: [
TextSpan(text: labels[i]),
for (final s in series)
TextSpan(
text: ' ${s.format(s.values[i])}',
style: TextStyle(color: Color.lerp(s.color, Colors.white, 0.35)),
style: TextStyle(color: Color.lerp(s.color, tooltipTextColor, 0.25)),
),
],
),
@@ -252,7 +267,7 @@ class _ChartPainter extends CustomPainter {
final left = (xAt(i) - w / 2).clamp(0.0, size.width - w);
canvas.drawRRect(
RRect.fromRectAndRadius(Rect.fromLTWH(left, 2, w, 24), const Radius.circular(6)),
Paint()..color = Colors.grey[900]!,
Paint()..color = tooltipColor,
);
tp.paint(canvas, Offset(left + 8, 2 + (24 - tp.height) / 2));
}
@@ -260,7 +275,7 @@ class _ChartPainter extends CustomPainter {
void _text(Canvas canvas, String text, Offset at, double size, Color color, {bool alignRight = false}) {
final tp = TextPainter(
text: TextSpan(text: text, style: TextStyle(fontSize: size, color: color)),
text: TextSpan(text: text, style: TextStyle(fontFamily: 'Inter', fontSize: size, color: color, fontFeatures: const [FontFeature.tabularFigures()])),
textDirection: TextDirection.ltr,
)..layout();
tp.paint(canvas, alignRight ? at.translate(-tp.width, 0) : at);
@@ -271,5 +286,6 @@ class _ChartPainter extends CustomPainter {
old.labels != labels ||
old.series != series ||
old.selected != selected ||
old.textColor != textColor;
old.textColor != textColor ||
old.surfaceColor != surfaceColor;
}