reclaim/app/lib/widgets/delta_mark.dart
flemming-it 8ee6a294a1 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>
2026-06-18 11:26:28 +02:00

98 lines
2.6 KiB
Dart

import 'dart:math' as math;
import 'package:flutter/material.dart';
import '../theme/lawheatmap_tokens.dart';
/// The F∆I / Ch∆In brand mark: an upward triangle (the `∆`) with
/// a petrol "eye" at the centre. Geometry mirrors fai_web's
/// Logo.astro — the triangle IS the "A"; the eye-dot IS the dot
/// of the "i".
///
/// Subtle 9s breathing pulse on the eye (matches fai_web's
/// `.eye-pulse`). Set [animated] to false for static contexts
/// (icons, screenshots).
class DeltaMark extends StatefulWidget {
const DeltaMark({super.key, this.size = 64, this.animated = true});
final double size;
final bool animated;
@override
State<DeltaMark> createState() => _DeltaMarkState();
}
class _DeltaMarkState extends State<DeltaMark>
with SingleTickerProviderStateMixin {
late final AnimationController _controller;
@override
void initState() {
super.initState();
_controller = AnimationController(
vsync: this,
duration: const Duration(seconds: 9),
);
if (widget.animated) {
_controller.repeat();
}
}
@override
void dispose() {
_controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return AnimatedBuilder(
animation: _controller,
builder: (context, _) {
final t = _controller.value;
// Breathe: scale 1 → 1.28 → 1 over the cycle.
final pulse = 1.0 + 0.28 * (1 - (math.cos(t * 2 * math.pi).abs()));
return CustomPaint(
size: Size.square(widget.size),
painter: _DeltaPainter(pulse: widget.animated ? pulse : 1.0),
);
},
);
}
}
class _DeltaPainter extends CustomPainter {
_DeltaPainter({required this.pulse});
final double pulse;
@override
void paint(Canvas canvas, Size size) {
final w = size.width;
final h = size.height;
// Upward triangle, geometric centre.
final stroke = Paint()
..color = const Color(0xFFE9E7E2)
..style = PaintingStyle.stroke
..strokeWidth = w * 0.04
..strokeJoin = StrokeJoin.miter;
final inset = w * 0.08;
final tri = Path()
..moveTo(w / 2, inset)
..lineTo(w - inset, h - inset)
..lineTo(inset, h - inset)
..close();
canvas.drawPath(tri, stroke);
// Eye — petrol fill, centred on the triangle's centroid.
final eyeCentre = Offset(w / 2, inset + (h - 2 * inset) * 2 / 3);
final eyeR = w * 0.06 * pulse;
final eye = Paint()..color = LawHeatmapColors.signal;
canvas.drawCircle(eyeCentre, eyeR, eye);
}
@override
bool shouldRepaint(covariant _DeltaPainter old) => old.pulse != pulse;
}