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>
69 lines
2.3 KiB
Dart
69 lines
2.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../data/models.dart';
|
|
import '../theme/reclaim_tokens.dart';
|
|
|
|
/// Scope badge — surfaces a norm's Geltungsbereich (Berlin /
|
|
/// Deutschland / EU / International) wherever the norm appears, so
|
|
/// the reader sees at a glance which reform lever a figure speaks
|
|
/// to. Visually mirrors [TierBadge]: a scope glyph + code in a
|
|
/// tinted chip, here with a Material icon instead of a dot.
|
|
class JurisdictionBadge extends StatelessWidget {
|
|
const JurisdictionBadge({
|
|
super.key,
|
|
required this.jurisdiction,
|
|
this.compact = false,
|
|
});
|
|
|
|
final Jurisdiction jurisdiction;
|
|
final bool compact;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final t = Theme.of(context).textTheme;
|
|
final color = switch (jurisdiction) {
|
|
Jurisdiction.berlin => ReclaimColors.scopeBerlin,
|
|
Jurisdiction.deutschland => ReclaimColors.scopeDeutschland,
|
|
Jurisdiction.eu => ReclaimColors.scopeEu,
|
|
Jurisdiction.international => ReclaimColors.scopeInternational,
|
|
};
|
|
final icon = switch (jurisdiction) {
|
|
Jurisdiction.berlin => Icons.location_city_outlined,
|
|
Jurisdiction.deutschland => Icons.flag_outlined,
|
|
Jurisdiction.eu => Icons.star_outline_rounded,
|
|
Jurisdiction.international => Icons.public,
|
|
};
|
|
final label = compact
|
|
? jurisdiction.short
|
|
: '${jurisdiction.short} · ${jurisdiction.label}';
|
|
return Tooltip(
|
|
message: 'Geltungsbereich: ${jurisdiction.label} '
|
|
'(${jurisdiction.level}).\n${jurisdiction.reformLever}.',
|
|
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,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|