Files
app-flutter/lib/reading.dart
T
mikkeli 8d95514897
/ crosscheck (push) Successful in 1s
CI / Analyze & Test (push) Successful in 14s
CI / Debug APK (push) Successful in 36s
Dash: DIN 1451 opt-in per widget (hudFont), GNSS compass, rei by default; widget catalogue
From smart-serow: the DIN 1451 face (Alte DIN 1451 Mittelschrift, via gps-speedo)
and GpsCompass. A cosmetic font is opt-in: widgets name hudFont in their own
TextStyle, the rest keeps the basic font (CJK). Boxes and telltales shrink long
labels instead of wrapping. Telltale and Reading get their own files;
lib/README.md catalogues folders and widgets like smart-serow's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DDwfd6Ki8UfG4hK6W5YpJz
2026-10-14 13:20:34 +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);
}