Files
app-flutter/lib/README.md
T

38 lines
2.3 KiB
Markdown
Raw Normal View History

---
type: reference
---
# The app's code: a catalogue
Laid out like smart-serow's HUD (`pi/ui/lib/`), which several pieces come from.
## Folders
| Where | Holds |
|---|---|
| `lib/*.dart` | Pages (`dash`, `checklist`, `camview`, `linktest`), the boundary client (`boundary`), the USB network binding (`net`), and `reading`, one signal's state as a display needs it |
| `theme/` | `palette.dart`: the palette and `hudFont` |
| `widgets/` | Reusable display widgets, one per file, each fed values, never the boundary |
## Widgets
| Widget | File | Shows | From |
|---|---|---|---|
| `StatBox`, `StatBoxMain` | `widgets/stat_box.dart` | A value, its unit and label, sized from its box's height; alarm on warning, subdued when dim | smart-serow |
| `Telltale` | `widgets/telltale.dart` | An on/off lamp: a label or an icon, lit or dark, "—" when missing | Yukart |
| `WhiskeyMark` | `widgets/whiskey_mark.dart` | Attitude: a horizon tilting with roll, ladder moving with pitch | smart-serow |
| `AccelGraph` | `widgets/accel_graph.dart` | G-meter: a dot for lateral/longitudinal g, a trace and a peak marker over a window | smart-serow |
| `GpsCompass` | `widgets/gps_compass.dart` | Heading arrow and bearing; "ACQ" while acquiring, "N/A" without | smart-serow, from gps-speedo |
## Conventions
- **The boxed pattern.** A widget takes its share of a row and sizes its type from its own height, so a layout
is a grid of boxes and a value gaining a digit never moves anything. Labels shrink to fit, never wrap.
- **Colours by meaning.** `AppTheme.of(context)` gives seven roles: `background`, `foreground`,
`subdued` (muted, missing, stale), `accent` (emphasis without danger: buttons, links, the current item),
and the state gradient `good` → `caution` → `alarm`; plus the derived `surface` (raised bars) and
`onFill(colour)` (text on a fill). No widget names a colour. Themes are JSON in `assets/themes/`, `rei` by
default; smart-serow's four-key files still load (their `highlight` is `alarm`).
- **Cosmetic fonts are opt-in.** A widget that wants the HUD face names `fontFamily: hudFont` in its own
`TextStyle`; everything else keeps the basic font, which covers CJK where DIN 1451 does not.
- **Missing is a state** (app guideline 2): a widget given no value draws "—" or subdued, never an error.