Files
app-flutter/lib/link/reading.dart
T
mikkeli 4cf7a786d6
/ crosscheck (push) Successful in 1s
CI / Analyze & Test (push) Successful in 13s
CI / Debug APK (push) Successful in 27s
App structure: a swipe-in menu shell; pages/, link/, actions/; Settings
The shell (shell.dart): a drawer from the left edge or each page's menu button.
Dash, Signals, Captures; Tools (Camera, Link test, Orin power options), the
rarely used ones, after pirate-station-aide; Settings (gateway address, dark/bright,
build-time theme and landing). Landing view at build time: YUKART_HOME=dash|signals,
signals for now. Dash, Signals and Captures stay alive while hidden; Captures has its
own navigator, so a run survives switching views. Back goes inside Captures, then to
the landing view, then out. The mock banner sits over every page.

main.dart is startup only; the old home screen is pages/signals.dart; dialogs and
sheets moved to actions/; the protocol client, USB binding and Reading to link/.
lib/README.md catalogues it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DDwfd6Ki8UfG4hK6W5YpJz
2026-10-14 14:08:56 +09:00

29 lines
911 B
Dart

// One signal's current state as a display needs it: value, and whether to draw it dim
// (missing, stale or known-without-value; app guideline 2).
import 'boundary.dart';
/// One signal's current state, as the dash needs it.
class Reading {
const Reading(this.value, {this.dim = false});
/// The value, or null when missing or known-without-value.
final Object? value;
/// Missing or stale: drawn in subdued.
final bool dim;
static Reading of(Boundary b, String name) {
final e = b.signals[name];
if (e is! Map) return const Reading(null, dim: true);
final q = e['quality'] as String? ?? 'ok';
return Reading(e['value'], dim: q != 'ok' || e['value'] == null);
}
double? get number => value is num ? (value as num).toDouble() : null;
bool get on => value == true;
String fixed([int decimals = 0]) =>
number == null ? '—' : number!.toStringAsFixed(decimals);
}