feat(ui): scope, freshness and jurist-review badges + live empty-state

Adds three dark-first chip badges in the TierBadge pattern:
- Jurisdiction (Berlin/DE/EU/International) — derived from the ELI,
  surfaced on the norms list, detail header and heatmap chips/hover.
- Freshness (aktuell/geaendert/ungeprueft) — flags norms amended
  upstream (standDate + sourceSha256); renders only when stale.
- Jurist review — marks evaluations a trusted jurist has confirmed
  (optional; the figure stands on its own).
Models gain Jurisdiction/Freshness enums, Norm.freshness/supersededNote
and Evaluation.reviewedBy/reviewedAt; HubRepository parses them from
the flow bag (ELI fallback). HeatmapPage shows a real empty-state
(hub-down vs no-evaluations) instead of a blank plot, and connect()
no longer throws on a failed probe.

Signed-off-by: flemming-it <sf@flemming.it>
This commit is contained in:
flemming-it 2026-06-19 02:25:39 +02:00
parent 9dfa418e92
commit aabff2b140
11 changed files with 604 additions and 26 deletions

View file

@ -0,0 +1,74 @@
import 'package:flutter/material.dart';
import '../data/models.dart';
import '../theme/reclaim_tokens.dart';
/// Freshness badge flags when a norm version is stale relative to
/// the published source (amended upstream) or hasn't been reconciled.
/// By design it renders NOTHING for [Freshness.current] (the common
/// case shouldn't add noise) unless [alwaysShow] is set. Same chip
/// shape as the scope/tier badges.
class FreshnessBadge extends StatelessWidget {
const FreshnessBadge({
super.key,
required this.freshness,
this.note,
this.compact = false,
this.alwaysShow = false,
});
final Freshness freshness;
/// Optional plain-text hint of what changed (from Norm.supersededNote).
final String? note;
final bool compact;
final bool alwaysShow;
@override
Widget build(BuildContext context) {
if (!freshness.needsBadge && !alwaysShow) {
return const SizedBox.shrink();
}
final t = Theme.of(context).textTheme;
final color = switch (freshness) {
Freshness.current => ReclaimColors.signal,
Freshness.superseded => ReclaimColors.freshSuperseded,
Freshness.unknown => ReclaimColors.freshUnknown,
};
final icon = switch (freshness) {
Freshness.current => Icons.check_circle_outline,
Freshness.superseded => Icons.history_toggle_off,
Freshness.unknown => Icons.help_outline,
};
final label = compact ? freshness.label : 'Stand: ${freshness.label}';
return Tooltip(
message: '${freshness.description}'
'${note != null && note!.isNotEmpty ? '\n$note' : ''}',
child: Container(
padding: EdgeInsets.symmetric(
horizontal: compact ? 6 : ReclaimSpace.sm,
vertical: compact ? 2 : 4,
),
decoration: BoxDecoration(
color: color.withValues(alpha: 0.18),
border: Border.all(color: color.withValues(alpha: 0.55)),
borderRadius: const BorderRadius.all(ReclaimRadius.sm),
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(icon, size: compact ? 12 : 14, color: color),
const SizedBox(width: 6),
Text(
label,
style: (compact ? t.labelSmall : t.labelLarge)?.copyWith(
color: color,
fontWeight: FontWeight.w600,
),
),
],
),
),
);
}
}