mirror of
https://github.com/kuhyx/diet-guard.git
synced 2026-11-19 08:14:31 +01:00
Some checks are pending
dependency freshness / dependencies on newest stable (push) Waiting to run
file-length / file length <= 250 lines (push) Waiting to run
md-naming / markdown naming convention (push) Waiting to run
pre-commit / pre-commit (${{ matrix.group }}) (mypy, mypy, ) (push) Waiting to run
pre-commit / pre-commit (${{ matrix.group }}) (pylint, pylint, ) (push) Waiting to run
pre-commit / pre-commit (${{ matrix.group }}) (rest, , mypy,pylint) (push) Waiting to run
Tests / test (push) Waiting to run
release-apk / release (APK) (push) Waiting to run
repo-contract / repo contract (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WzxdWWy9HCAx2bNSRPvmTW
79 lines
4.1 KiB
Markdown
79 lines
4.1 KiB
Markdown
# The phone's log screen
|
|
|
|
`app/lib/screens/log_meal_screen.dart` and its mixins. Approved design: kuhy,
|
|
2026-11-17, mockup variant 1A. **No painted words**: every control is an icon.
|
|
|
|
## Two modes
|
|
|
|
- **Due mode** (`missingSlots` is non-empty): no app bar, sync banner, date row,
|
|
slot chips or Fill all; the Android status bar is hidden (immersive) and put
|
|
back on exit and on `dispose`. `main.dart` sets no system-UI mode, so "back"
|
|
means both bars visible. Only the food field, a fixed-height suggestion block,
|
|
the macro fields (2 rows of 3) and the action row remain.
|
|
- **Normal mode** (nothing due): the old screen minus the slot chips and Fill
|
|
all, plus the same action row. Notifications are unchanged.
|
|
|
|
Until the first read of today's log the screen draws neither (no app-bar flash).
|
|
`logMealClock` (`log_meal_due_mixin.dart`) is the clock; the suite pins it to
|
|
07:00 in `flutter_test_config.dart`, and a test needing due mode calls
|
|
`pinLogMealClock`.
|
|
|
|
## Slot targeting
|
|
|
|
No slot picker. Due mode: both the check and the sparkle target the **oldest
|
|
due slot** (`dueSlots.first`). Normal mode: `slotForLog` (nearest). The integer
|
|
slot maths in `models/slot.dart` is untouched. A *future* date (the app bar's date icon,
|
|
normal mode only) keeps its own slot row, because it has no due slots to derive
|
|
from.
|
|
|
|
## The action row (1A)
|
|
|
|
Photo (blue; tap = camera, long press = gallery; attached = tinted with a check
|
|
badge and a remove badge, **never a thumbnail**), Claude (gold sparkle), log
|
|
(green check). Sparkle and check are greyed until there is text (or, for the
|
|
sparkle, a photo). The sparkle shows a spinner while sending, an hourglass when
|
|
queued (PC offline), a lock when sync is locked, an error glyph on failure
|
|
(a tap retries).
|
|
|
|
**The food field never moves.** Spinners, logged rows and cues go *below* the
|
|
action row. `log_meal_geometry_test.dart` asserts, on 1080x2400 at 2.625 with
|
|
the Pixel insets and a 320 dp keyboard, that the field's top is identical in
|
|
every state and `maxScrollExtent == 0`. Macro values of four digits must paint
|
|
whole at 16 sp or more (`macro_input_row_test.dart` measures the digits; a
|
|
`Row` of `Expanded` fields clips them without any exception).
|
|
|
|
## Date picker and the keyboard
|
|
|
|
- The "log for later" picker is the **leftmost app bar icon** (`Icons.edit_calendar`,
|
|
`buildDateActions` in `log_meal_future_mixin.dart`); there is no date row above
|
|
the field. A picked future date tints it gold (theme primary) with a small
|
|
dot (`log-date-badge`) and adds a close icon back to today. No date text.
|
|
- **NO COVER BY KEYBOARD EVER** (kuhy): while `viewInsetsOf(context).bottom > 0`
|
|
the today-progress card and the logged rows are not built; they return when
|
|
the keyboard closes. Field, suggestions, macros and action row sit fully
|
|
above the keyboard with `maxScrollExtent == 0`, in normal and due mode, for
|
|
a 320 dp and a 400 dp keyboard (`log_meal_keyboard_test.dart`). Do not fix
|
|
an overflow by scrolling content under the keyboard.
|
|
|
|
## Logged rows and undo
|
|
|
|
After a Claude, check or catering log, a row (origin glyph, name, kcal and macro
|
|
dots, a 48 dp round undo, no countdown) shows under the action row until the
|
|
next meal is logged. Undo is `deleteEntry(id)` plus `publishAfterLog`, a
|
|
tombstone by id (several rows can be on screen, so not `undoLastToday`).
|
|
|
|
## Claude and photos
|
|
|
|
The sparkle talks to `ClaudeRelayClient` (`services/claude_relay_client.dart`),
|
|
injectable; `FakeClaudeRelayClient` drives the tests and `RtdbClaudeRelay`
|
|
(`claude_relay_firebase.dart`, assigned in `main.dart`) is the real transport,
|
|
described in [DOCS-claude-relay-phone.md](DOCS-claude-relay-phone.md). The request
|
|
id is a ULID and the logged entry's id is `uuid5` of it. A check-mark log while
|
|
a request is waiting withdraws it (`cancel`). A photo is **transient input**: `image_picker` scales it to
|
|
1024 px JPEG, the bytes are read into memory and the plugin's cache file is
|
|
deleted at once (`meal_photo_cleanup_io.dart`). It is never stored, put on a
|
|
`FoodEntry`, or synced; `repo_invariants_test.dart` asserts it structurally. The
|
|
camera runtime permission is requested before the camera opens.
|
|
|
|
Catering auto-log: [DOCS-kuchnia-wikinga-phone.md](DOCS-kuchnia-wikinga-phone.md).
|