feat: initial F∆I Law-Heatmap Phase 0 scaffold
First end-to-end-buildable cut of the pflicht-/graph-basierte
Wirkungsanalyse von Rechtsnormen, running on Ch∆In. Demo runs
without external dependencies and without a hub connection so
the methodology + UI stack can be reviewed before any Verbands-
Kooperation or Beirats-Validierung kicks in.
Tree layout
MACHBARKEITSSTUDIE.md v0.3 — pflicht-basierte Methodik,
4-Tier-Evidenz, 8 law*-Module
auf Ch∆In statt der alten F∆I-
Plattform.
RUN.md one-page how-to-run.
flows/durchstich-gewo-14.yaml
vertical Phase-0 flow: pull →
normalize → duties → citations →
cohort → skm → frust → benefit →
attribution → system.approval.
app/ Flutter macOS client, design
language pulled from fai_web
(ink #08090A, paper #F4F3EF,
petrol signal #2E8F9E). Mock
repository ships five fixture
norms with real source URLs and a
permanent T4 demo-banner so no
figure can be mistaken for a
validated one.
Module repos (separate, see chain-modules*/):
text-akoma-normalize, text-deontic-extract, graph-citation-
extract, text-readability-score, stats-cohort-size, graph-
shapley-attribution, econ-skm-score, law-benefit-score.
What runs today
- flutter analyze: 0 issues
- flutter test: 2/2 (landing + nav-to-shell smoke)
- flutter build macos (via app/build-macos.sh) and ad-hoc
codesign, app launches and the Dart VM service comes up
- native cargo test green on every module
- cargo build --release --target wasm32-wasip2 produces a
130 KiB artefact for text-akoma-normalize
What is deliberately mock / stub
- gRPC wire from the client to a chain serve hub (Repository
abstraction is in place; live impl is the next step)
- NKR Bürokratiekosten-Datenbank ingestion (for the canonical
h-Werte that close out the Engpass per Studie §6.7)
- DESTATIS GENESIS-API adapter for stats.cohort_size
License: Apache-2.0. Author/contact in MACHBARKEITSSTUDIE.md.
Signed-off-by: flemming-it <sf@flemming.it>
This commit is contained in:
commit
8ee6a294a1
64 changed files with 5641 additions and 0 deletions
129
app/lib/pages/about_page.dart
Normal file
129
app/lib/pages/about_page.dart
Normal file
|
|
@ -0,0 +1,129 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../theme/lawheatmap_tokens.dart';
|
||||
import '../widgets/lawheatmap_card.dart';
|
||||
|
||||
class AboutPage extends StatelessWidget {
|
||||
const AboutPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final t = Theme.of(context).textTheme;
|
||||
return SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(LawHeatmapSpace.xl),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('Methodik & Quellen', style: t.displaySmall),
|
||||
const SizedBox(height: LawHeatmapSpace.xs),
|
||||
Text(
|
||||
'Wie das System bewertet, woran es sich messen lässt.',
|
||||
style: t.bodyLarge?.copyWith(color: LawHeatmapColors.mute),
|
||||
),
|
||||
const SizedBox(height: LawHeatmapSpace.lg),
|
||||
LawHeatmapCard(
|
||||
accent: true,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('Drei nicht verhandelbare Sätze',
|
||||
style: t.headlineSmall),
|
||||
const SizedBox(height: LawHeatmapSpace.md),
|
||||
Text(
|
||||
'1. Wir bewerten Pflichten, nicht Gesetze.\n'
|
||||
'2. Jede Zahl trägt die Tier-Stufe ihres schwächsten '
|
||||
'Bestandteils. Kein figürlich-runder Wert ohne Quelle.\n'
|
||||
'3. Kein Output verlässt das System ohne Juristen-Gate '
|
||||
'(`system.approval@^0`).',
|
||||
style: t.bodyLarge?.copyWith(height: 1.7),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: LawHeatmapSpace.lg),
|
||||
LawHeatmapCard(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('Methodische Vorbilder', style: t.headlineSmall),
|
||||
const SizedBox(height: LawHeatmapSpace.sm),
|
||||
_bullet(t,
|
||||
'Standardkostenmodell (SKM) — Nationaler Normenkontrollrat. P × F × T × h.'),
|
||||
_bullet(t,
|
||||
'Coupette / Katz / Bommarito 2021 — Netzwerkanalyse deutsches Bundesrecht (Graph-Schema).'),
|
||||
_bullet(t,
|
||||
'Mercatus QuantGov / RegData — NLP-basierte Pflicht-Klassifikation (must/shall/may).'),
|
||||
_bullet(t,
|
||||
'EU Better Regulation Toolbox + REFIT — Cost-Benefit + Evaluations-Methodik.'),
|
||||
_bullet(t,
|
||||
'Akoma Ntoso 1.0 (OASIS) + LegalRuleML — XML-Format und Deontik-Datenmodell.'),
|
||||
_bullet(t,
|
||||
'UK Better Regulation Framework — Regulatory Policy Committee als unabhängige Letzt-Validierung.'),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: LawHeatmapSpace.lg),
|
||||
LawHeatmapCard(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('4-Tier-Evidenz-Modell', style: t.headlineSmall),
|
||||
const SizedBox(height: LawHeatmapSpace.sm),
|
||||
_bullet(t,
|
||||
'T1 — amtlich/peer-reviewed: NKR, DESTATIS, ifo, ZEW, BMWK, SVR, IfM Bonn.'),
|
||||
_bullet(t,
|
||||
'T2 — Verbands-Erhebung: DIHK, IHK Berlin, ZDH, BDI Mittelstand, BVMW, HDE.'),
|
||||
_bullet(t,
|
||||
'T3 — eigene strukturierte Erhebung (Phase 2/3, DSGVO-anonymisiert).'),
|
||||
_bullet(t,
|
||||
'T4 — qualitatives Signal: Petitionen, openPetition, mein.berlin.de, Foren — nur Pain-Indikator.'),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: LawHeatmapSpace.lg),
|
||||
LawHeatmapCard(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('Plattform', style: t.headlineSmall),
|
||||
const SizedBox(height: LawHeatmapSpace.sm),
|
||||
Text(
|
||||
'Ch∆In v0.16.0 (vormals F∆I-Plattform) — Vendor: '
|
||||
'F∆I = Flemming.AI. Hub. Module. Flow. Deterministisch, '
|
||||
'WASM-sandboxed, tamper-evident Audit-Log '
|
||||
'(CHAIN-EVENT-V3), Apache 2.0, CRA-ready.',
|
||||
style: t.bodyLarge?.copyWith(height: 1.6),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _bullet(TextTheme t, String text) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: LawHeatmapSpace.sm),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 6, right: 10),
|
||||
child: Container(
|
||||
width: 5,
|
||||
height: 5,
|
||||
decoration: const BoxDecoration(
|
||||
color: LawHeatmapColors.signal,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Text(text, style: t.bodyLarge?.copyWith(height: 1.6)),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
128
app/lib/pages/heatmap_page.dart
Normal file
128
app/lib/pages/heatmap_page.dart
Normal file
|
|
@ -0,0 +1,128 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../data/models.dart';
|
||||
import '../data/repository.dart';
|
||||
import '../theme/lawheatmap_tokens.dart';
|
||||
import '../widgets/demo_banner.dart';
|
||||
import '../widgets/heatmap_grid.dart';
|
||||
import '../widgets/lawheatmap_card.dart';
|
||||
import '../widgets/tier_badge.dart';
|
||||
import 'norm_detail_page.dart';
|
||||
|
||||
class HeatmapPage extends StatefulWidget {
|
||||
const HeatmapPage({super.key, required this.repository});
|
||||
|
||||
final EvaluationRepository repository;
|
||||
|
||||
@override
|
||||
State<HeatmapPage> createState() => _HeatmapPageState();
|
||||
}
|
||||
|
||||
class _HeatmapPageState extends State<HeatmapPage> {
|
||||
late Future<List<Evaluation>> _future;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_future = widget.repository.list();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final t = Theme.of(context).textTheme;
|
||||
return Column(
|
||||
children: [
|
||||
const DemoBanner(),
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(LawHeatmapSpace.xl),
|
||||
child: FutureBuilder<List<Evaluation>>(
|
||||
future: _future,
|
||||
builder: (context, snap) {
|
||||
if (!snap.hasData) {
|
||||
return const Center(
|
||||
child: CircularProgressIndicator());
|
||||
}
|
||||
final items = snap.data!;
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('Heatmap', style: t.displaySmall),
|
||||
const SizedBox(height: LawHeatmapSpace.xs),
|
||||
Text(
|
||||
'X: jährliche Bürokratiekosten (€, log10). '
|
||||
'Y: Nutzen-Score 0–5. Punktgröße: Betroffenheit. '
|
||||
'Klick auf einen Punkt → Detail mit Pflichten + Quellen.',
|
||||
style: t.bodyLarge?.copyWith(
|
||||
color: LawHeatmapColors.mute,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: LawHeatmapSpace.lg),
|
||||
Expanded(
|
||||
child: LawHeatmapCard(
|
||||
accent: true,
|
||||
expand: true,
|
||||
child: HeatmapGrid(
|
||||
evaluations: items,
|
||||
onTap: (e) {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (_) => NormDetailPage(
|
||||
repository: widget.repository,
|
||||
evaluation: e,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: LawHeatmapSpace.lg),
|
||||
Wrap(
|
||||
spacing: LawHeatmapSpace.md,
|
||||
runSpacing: LawHeatmapSpace.sm,
|
||||
children: [
|
||||
for (final e in items)
|
||||
InkWell(
|
||||
onTap: () {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (_) => NormDetailPage(
|
||||
repository: widget.repository,
|
||||
evaluation: e,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
child: LawHeatmapCard(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: LawHeatmapSpace.md,
|
||||
vertical: LawHeatmapSpace.sm,
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
TierBadge(
|
||||
tier: e.tierLowest, compact: true),
|
||||
const SizedBox(
|
||||
width: LawHeatmapSpace.sm),
|
||||
Text(
|
||||
'${e.norm.jurabk} ${e.norm.paragraph}',
|
||||
style: t.labelLarge,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
90
app/lib/pages/hub_status_page.dart
Normal file
90
app/lib/pages/hub_status_page.dart
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../data/repository.dart';
|
||||
import '../theme/lawheatmap_tokens.dart';
|
||||
import '../widgets/lawheatmap_card.dart';
|
||||
|
||||
class HubStatusPage extends StatelessWidget {
|
||||
const HubStatusPage({super.key, required this.repository});
|
||||
|
||||
final EvaluationRepository repository;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final t = Theme.of(context).textTheme;
|
||||
return SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(LawHeatmapSpace.xl),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('Ch∆In Hub', style: t.displaySmall),
|
||||
const SizedBox(height: LawHeatmapSpace.xs),
|
||||
Text(
|
||||
'Status der Verbindung zum lokalen Hub und des Audit-Logs.',
|
||||
style: t.bodyLarge?.copyWith(color: LawHeatmapColors.mute),
|
||||
),
|
||||
const SizedBox(height: LawHeatmapSpace.lg),
|
||||
LawHeatmapCard(
|
||||
accent: true,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_row('Modus', repository.mode.toUpperCase(), t),
|
||||
_row('Quelle', repository.hubLabel, t),
|
||||
_row('gRPC-Endpunkt', '— (Phase-0-Stub)', t),
|
||||
_row('Audit-DB', '~/.chain/chain.db (geplant)', t),
|
||||
_row('Hash-Tag', 'CHAIN-EVENT-V3', t),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: LawHeatmapSpace.lg),
|
||||
LawHeatmapCard(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('Geplante Live-Anbindung', style: t.headlineSmall),
|
||||
const SizedBox(height: LawHeatmapSpace.sm),
|
||||
Text(
|
||||
'1. `chain serve` startet lokal auf Port 50051.\n'
|
||||
'2. Diese App liest `~/.chain/hub-auth-token` und '
|
||||
'verbindet via gRPC.\n'
|
||||
'3. Capability `text.akoma_normalize@^0` muss '
|
||||
'installiert sein (`chain install text.akoma_normalize`).\n'
|
||||
'4. Pilot-Flow `flows/durchstich-gewo-14.yaml` läuft '
|
||||
'gegen GewO §14.\n'
|
||||
'5. Jedes step.completed-Event landet im Audit-Log; '
|
||||
'die Repository-Implementierung tauscht von MockRepository '
|
||||
'auf HubRepository (gleiches Interface, kein UI-Wechsel).',
|
||||
style: t.bodyLarge?.copyWith(
|
||||
height: 1.6,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _row(String label, String value, TextTheme t) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 4),
|
||||
child: Row(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 160,
|
||||
child: Text(label,
|
||||
style: t.labelLarge
|
||||
?.copyWith(color: LawHeatmapColors.mute)),
|
||||
),
|
||||
Expanded(
|
||||
child: Text(value,
|
||||
style: t.bodyLarge
|
||||
?.copyWith(fontFamily: LawHeatmapTypography.mono)),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
85
app/lib/pages/landing_page.dart
Normal file
85
app/lib/pages/landing_page.dart
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../data/repository.dart';
|
||||
import '../theme/lawheatmap_theme.dart';
|
||||
import '../theme/lawheatmap_tokens.dart';
|
||||
import '../widgets/delta_mark.dart';
|
||||
import 'shell_page.dart';
|
||||
|
||||
/// First-run landing: brand mark, one-line claim, "enter app" CTA.
|
||||
/// Mock-mode bypasses Hub connect; the live wire lands in week 1.
|
||||
class LandingPage extends StatelessWidget {
|
||||
const LandingPage({super.key, required this.repository});
|
||||
|
||||
final EvaluationRepository repository;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final t = Theme.of(context).textTheme;
|
||||
return Scaffold(
|
||||
body: SafeArea(
|
||||
child: Center(
|
||||
child: ConstrainedBox(
|
||||
constraints: const BoxConstraints(maxWidth: 720),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: LawHeatmapSpace.xxl,
|
||||
vertical: LawHeatmapSpace.xxxl,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const DeltaMark(size: 96),
|
||||
const SizedBox(height: LawHeatmapSpace.xxl),
|
||||
Text('F∆I Law-Heatmap', style: t.displaySmall),
|
||||
const SizedBox(height: LawHeatmapSpace.sm),
|
||||
Text(
|
||||
'Pflicht-basierte Wirkungsanalyse von Rechtsnormen — '
|
||||
'auf Ch∆In, mit Quellen-Audit by construction.',
|
||||
style: t.bodyLarge
|
||||
?.copyWith(color: LawHeatmapColors.mute),
|
||||
),
|
||||
const SizedBox(height: LawHeatmapSpace.xxl),
|
||||
Wrap(
|
||||
crossAxisAlignment: WrapCrossAlignment.center,
|
||||
spacing: LawHeatmapSpace.md,
|
||||
runSpacing: LawHeatmapSpace.sm,
|
||||
children: [
|
||||
FilledButton.icon(
|
||||
onPressed: () {
|
||||
Navigator.of(context).pushReplacement(
|
||||
MaterialPageRoute(
|
||||
builder: (_) =>
|
||||
ShellPage(repository: repository),
|
||||
),
|
||||
);
|
||||
},
|
||||
icon: const Icon(Icons.east),
|
||||
label: const Text('App öffnen (Demo-Modus)'),
|
||||
),
|
||||
Text(
|
||||
'Demo: 5 Pilot-Normen, ohne Hub-Verbindung',
|
||||
style: t.labelSmall?.copyWith(
|
||||
color: LawHeatmapColors.mute,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: LawHeatmapSpace.xl),
|
||||
Text(
|
||||
'v0.1.0 · Phase 0 · Mock-Modus · '
|
||||
'Live-Hub-Anbindung folgt in Woche 1',
|
||||
style: LawHeatmapTheme.mono(
|
||||
t.labelSmall ?? const TextStyle(),
|
||||
).copyWith(color: LawHeatmapColors.mute),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
271
app/lib/pages/norm_detail_page.dart
Normal file
271
app/lib/pages/norm_detail_page.dart
Normal file
|
|
@ -0,0 +1,271 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../data/models.dart';
|
||||
import '../data/repository.dart';
|
||||
import '../theme/lawheatmap_tokens.dart';
|
||||
import '../widgets/demo_banner.dart';
|
||||
import '../widgets/evidence_sidebar.dart';
|
||||
import '../widgets/lawheatmap_card.dart';
|
||||
import '../widgets/tier_badge.dart';
|
||||
|
||||
class NormDetailPage extends StatelessWidget {
|
||||
const NormDetailPage({
|
||||
super.key,
|
||||
required this.repository,
|
||||
required this.evaluation,
|
||||
});
|
||||
|
||||
final EvaluationRepository repository;
|
||||
final Evaluation evaluation;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final t = Theme.of(context).textTheme;
|
||||
final e = evaluation;
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('${e.norm.jurabk} ${e.norm.paragraph}'),
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
const DemoBanner(),
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(LawHeatmapSpace.xl),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(e.norm.title,
|
||||
style: t.displaySmall),
|
||||
const SizedBox(height: 4),
|
||||
SelectableText(
|
||||
e.norm.eli,
|
||||
style: t.bodyLarge?.copyWith(
|
||||
fontFamily:
|
||||
LawHeatmapTypography.mono,
|
||||
color: LawHeatmapColors.mute,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
TierBadge(tier: e.tierLowest),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: LawHeatmapSpace.lg),
|
||||
_MetricsRow(e: e),
|
||||
const SizedBox(height: LawHeatmapSpace.lg),
|
||||
LawHeatmapCard(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('Pflichten',
|
||||
style: t.headlineSmall),
|
||||
const SizedBox(
|
||||
height: LawHeatmapSpace.sm),
|
||||
Text(
|
||||
'Atomare deontische Aussagen, extrahiert '
|
||||
'aus dem Norm-Text (Phase 1: regex + LLM-'
|
||||
'Vorschlag, Juristen-Review obligatorisch).',
|
||||
style: t.labelSmall?.copyWith(
|
||||
color: LawHeatmapColors.mute),
|
||||
),
|
||||
const SizedBox(
|
||||
height: LawHeatmapSpace.md),
|
||||
for (final d in e.duties)
|
||||
_DutyTile(duty: d),
|
||||
],
|
||||
),
|
||||
),
|
||||
if (e.notes != null) ...[
|
||||
const SizedBox(height: LawHeatmapSpace.lg),
|
||||
LawHeatmapCard(
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('Methodik-Notiz',
|
||||
style: t.headlineSmall),
|
||||
const SizedBox(
|
||||
height: LawHeatmapSpace.sm),
|
||||
Text(e.notes!, style: t.bodyLarge),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(width: LawHeatmapSpace.xl),
|
||||
SizedBox(
|
||||
width: 340,
|
||||
child: EvidenceSidebar(evaluation: e),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _MetricsRow extends StatelessWidget {
|
||||
const _MetricsRow({required this.e});
|
||||
final Evaluation e;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
children: [
|
||||
_MetricBox(
|
||||
label: 'Schaden',
|
||||
value: _eur(e.skmEurPerYear),
|
||||
sub: 'SKM P×F×T×h',
|
||||
),
|
||||
const SizedBox(width: LawHeatmapSpace.md),
|
||||
_MetricBox(
|
||||
label: 'Nutzen',
|
||||
value: '${e.benefitScore.toStringAsFixed(1)} / 5',
|
||||
sub: '7-dim. Score',
|
||||
),
|
||||
const SizedBox(width: LawHeatmapSpace.md),
|
||||
_MetricBox(
|
||||
label: 'Betroffene',
|
||||
value: _kmu(e.affectedCount),
|
||||
sub: 'DESTATIS',
|
||||
),
|
||||
const SizedBox(width: LawHeatmapSpace.md),
|
||||
_MetricBox(
|
||||
label: 'Frust',
|
||||
value: '${e.frustScore.toStringAsFixed(1)} / 10',
|
||||
sub: 'Lesbarkeit + Tiefe',
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
static String _eur(double v) {
|
||||
if (v >= 1e9) return '${(v / 1e9).toStringAsFixed(2)} Mrd €';
|
||||
if (v >= 1e6) return '${(v / 1e6).toStringAsFixed(1)} Mio €';
|
||||
if (v >= 1e3) return '${(v / 1e3).toStringAsFixed(0)} k €';
|
||||
return '${v.toStringAsFixed(0)} €';
|
||||
}
|
||||
|
||||
static String _kmu(int n) {
|
||||
if (n >= 1_000_000) return '${(n / 1e6).toStringAsFixed(1)} Mio';
|
||||
if (n >= 1_000) return '${(n / 1e3).toStringAsFixed(0)} k';
|
||||
return n.toString();
|
||||
}
|
||||
}
|
||||
|
||||
class _MetricBox extends StatelessWidget {
|
||||
const _MetricBox({
|
||||
required this.label,
|
||||
required this.value,
|
||||
required this.sub,
|
||||
});
|
||||
final String label;
|
||||
final String value;
|
||||
final String sub;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final t = Theme.of(context).textTheme;
|
||||
return Expanded(
|
||||
child: LawHeatmapCard(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(label,
|
||||
style: t.labelSmall
|
||||
?.copyWith(color: LawHeatmapColors.mute)),
|
||||
const SizedBox(height: 4),
|
||||
Text(value, style: t.displaySmall),
|
||||
const SizedBox(height: 4),
|
||||
Text(sub,
|
||||
style: t.labelSmall
|
||||
?.copyWith(color: LawHeatmapColors.mute)),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _DutyTile extends StatelessWidget {
|
||||
const _DutyTile({required this.duty});
|
||||
final Duty duty;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final t = Theme.of(context).textTheme;
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: LawHeatmapSpace.md),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(LawHeatmapSpace.md),
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.onSurface
|
||||
.withValues(alpha: 0.12)),
|
||||
borderRadius: const BorderRadius.all(LawHeatmapRadius.sm),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 6, vertical: 2),
|
||||
decoration: BoxDecoration(
|
||||
color: LawHeatmapColors.signal.withValues(alpha: 0.18),
|
||||
borderRadius:
|
||||
const BorderRadius.all(LawHeatmapRadius.sm),
|
||||
),
|
||||
child: Text(
|
||||
duty.modality,
|
||||
style: t.labelSmall?.copyWith(
|
||||
color: LawHeatmapColors.signal,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: LawHeatmapSpace.sm),
|
||||
Text(duty.sourceNorm,
|
||||
style: t.labelSmall?.copyWith(
|
||||
fontFamily: LawHeatmapTypography.mono,
|
||||
color: LawHeatmapColors.mute,
|
||||
)),
|
||||
]),
|
||||
const SizedBox(height: LawHeatmapSpace.sm),
|
||||
Text(duty.action, style: t.bodyLarge),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
'Adressat: ${duty.addressee} · '
|
||||
'Frequenz: ${duty.frequency}'
|
||||
'${duty.authority != null ? " · Behörde: ${duty.authority}" : ""}'
|
||||
'${duty.consequence != null ? " · Sanktion: ${duty.consequence}" : ""}',
|
||||
style: t.labelSmall?.copyWith(color: LawHeatmapColors.mute),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
176
app/lib/pages/norms_list_page.dart
Normal file
176
app/lib/pages/norms_list_page.dart
Normal file
|
|
@ -0,0 +1,176 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../data/models.dart';
|
||||
import '../data/repository.dart';
|
||||
import '../theme/lawheatmap_tokens.dart';
|
||||
import '../widgets/demo_banner.dart';
|
||||
import '../widgets/lawheatmap_card.dart';
|
||||
import '../widgets/tier_badge.dart';
|
||||
import 'norm_detail_page.dart';
|
||||
|
||||
class NormsListPage extends StatelessWidget {
|
||||
const NormsListPage({super.key, required this.repository});
|
||||
|
||||
final EvaluationRepository repository;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final t = Theme.of(context).textTheme;
|
||||
return Column(
|
||||
children: [
|
||||
const DemoBanner(),
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(LawHeatmapSpace.xl),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('Normen-Pilotkorpus', style: t.displaySmall),
|
||||
const SizedBox(height: LawHeatmapSpace.xs),
|
||||
Text(
|
||||
'5 Normen für den vertikalen Durchstich. '
|
||||
'Korpus erweiterbar in Phase 1.',
|
||||
style: t.bodyLarge?.copyWith(
|
||||
color: LawHeatmapColors.mute,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: LawHeatmapSpace.lg),
|
||||
FutureBuilder<List<Evaluation>>(
|
||||
future: repository.list(),
|
||||
builder: (context, snap) {
|
||||
if (!snap.hasData) {
|
||||
return const Center(
|
||||
child: CircularProgressIndicator());
|
||||
}
|
||||
return Column(
|
||||
children: [
|
||||
for (final e in snap.data!)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
bottom: LawHeatmapSpace.md),
|
||||
child: _NormRow(
|
||||
evaluation: e,
|
||||
repository: repository,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _NormRow extends StatelessWidget {
|
||||
const _NormRow({required this.evaluation, required this.repository});
|
||||
|
||||
final Evaluation evaluation;
|
||||
final EvaluationRepository repository;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final t = Theme.of(context).textTheme;
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (_) => NormDetailPage(
|
||||
repository: repository,
|
||||
evaluation: evaluation,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
child: LawHeatmapCard(
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 4,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'${evaluation.norm.jurabk} ${evaluation.norm.paragraph} — ${evaluation.norm.title}',
|
||||
style: t.titleMedium,
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
evaluation.norm.eli,
|
||||
style: t.labelSmall?.copyWith(
|
||||
fontFamily: LawHeatmapTypography.mono,
|
||||
color: LawHeatmapColors.mute,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(width: LawHeatmapSpace.lg),
|
||||
Expanded(
|
||||
child: _MetricColumn(
|
||||
label: 'Schaden / Jahr',
|
||||
value: _eur(evaluation.skmEurPerYear),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: _MetricColumn(
|
||||
label: 'Nutzen',
|
||||
value:
|
||||
'${evaluation.benefitScore.toStringAsFixed(1)} / 5',
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: _MetricColumn(
|
||||
label: 'Betroffene',
|
||||
value: _kmu(evaluation.affectedCount),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: LawHeatmapSpace.md),
|
||||
TierBadge(tier: evaluation.tierLowest),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
String _eur(double v) {
|
||||
if (v >= 1e9) return '${(v / 1e9).toStringAsFixed(2)} Mrd €';
|
||||
if (v >= 1e6) return '${(v / 1e6).toStringAsFixed(1)} Mio €';
|
||||
if (v >= 1e3) return '${(v / 1e3).toStringAsFixed(0)} k €';
|
||||
return '${v.toStringAsFixed(0)} €';
|
||||
}
|
||||
|
||||
String _kmu(int n) {
|
||||
if (n >= 1_000_000) return '${(n / 1e6).toStringAsFixed(1)} Mio';
|
||||
if (n >= 1_000) return '${(n / 1e3).toStringAsFixed(0)} k';
|
||||
return n.toString();
|
||||
}
|
||||
}
|
||||
|
||||
class _MetricColumn extends StatelessWidget {
|
||||
const _MetricColumn({required this.label, required this.value});
|
||||
|
||||
final String label;
|
||||
final String value;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final t = Theme.of(context).textTheme;
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
label,
|
||||
style: t.labelSmall?.copyWith(color: LawHeatmapColors.mute),
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
Text(value, style: t.titleMedium),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
91
app/lib/pages/shell_page.dart
Normal file
91
app/lib/pages/shell_page.dart
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../data/repository.dart';
|
||||
import '../theme/lawheatmap_tokens.dart';
|
||||
import '../widgets/delta_mark.dart';
|
||||
import 'about_page.dart';
|
||||
import 'heatmap_page.dart';
|
||||
import 'hub_status_page.dart';
|
||||
import 'norms_list_page.dart';
|
||||
|
||||
/// App shell with a NavigationRail. Each rail destination is one
|
||||
/// page; pages do their own scrolling.
|
||||
class ShellPage extends StatefulWidget {
|
||||
const ShellPage({super.key, required this.repository});
|
||||
|
||||
final EvaluationRepository repository;
|
||||
|
||||
@override
|
||||
State<ShellPage> createState() => _ShellPageState();
|
||||
}
|
||||
|
||||
class _ShellPageState extends State<ShellPage> {
|
||||
int _index = 0;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final t = Theme.of(context).textTheme;
|
||||
final pages = <Widget>[
|
||||
HeatmapPage(repository: widget.repository),
|
||||
NormsListPage(repository: widget.repository),
|
||||
HubStatusPage(repository: widget.repository),
|
||||
const AboutPage(),
|
||||
];
|
||||
|
||||
return Scaffold(
|
||||
body: Row(
|
||||
children: [
|
||||
NavigationRail(
|
||||
backgroundColor: Theme.of(context).colorScheme.surface,
|
||||
extended: MediaQuery.of(context).size.width > 1100,
|
||||
selectedIndex: _index,
|
||||
onDestinationSelected: (i) => setState(() => _index = i),
|
||||
leading: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: LawHeatmapSpace.lg,
|
||||
horizontal: LawHeatmapSpace.md,
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
const DeltaMark(size: 36),
|
||||
const SizedBox(height: LawHeatmapSpace.sm),
|
||||
Text(
|
||||
'F∆I',
|
||||
style: t.labelLarge?.copyWith(
|
||||
letterSpacing: 2,
|
||||
color: LawHeatmapColors.signal,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
destinations: const [
|
||||
NavigationRailDestination(
|
||||
icon: Icon(Icons.grid_view_outlined),
|
||||
selectedIcon: Icon(Icons.grid_view),
|
||||
label: Text('Heatmap'),
|
||||
),
|
||||
NavigationRailDestination(
|
||||
icon: Icon(Icons.list_alt_outlined),
|
||||
selectedIcon: Icon(Icons.list_alt),
|
||||
label: Text('Normen'),
|
||||
),
|
||||
NavigationRailDestination(
|
||||
icon: Icon(Icons.hub_outlined),
|
||||
selectedIcon: Icon(Icons.hub),
|
||||
label: Text('Hub'),
|
||||
),
|
||||
NavigationRailDestination(
|
||||
icon: Icon(Icons.info_outline),
|
||||
selectedIcon: Icon(Icons.info),
|
||||
label: Text('Methodik'),
|
||||
),
|
||||
],
|
||||
),
|
||||
const VerticalDivider(width: 1),
|
||||
Expanded(child: pages[_index]),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue