feat(block1): photo thumbnails in the inventory list

The list showed only initials even when a variety had a photo (quick-add stores
one as an encrypted BLOB). Now the avatar shows the first photo, falling back to
the initial — matching the "foto/inicial" list spec.

- VarietyListItem carries the first photo bytes; watchInventory loads them in a
  single query per emission.
- List tile renders a MemoryImage avatar when present.

Tests: repository (photo bytes surfaced, null when none) and a widget test
(avatar replaces the initial). Full suite: 37 passing, 0 skipped.
This commit is contained in:
vjrj 2026-07-07 22:03:36 +02:00
parent 37427fa738
commit 8a19a6c85a
4 changed files with 87 additions and 10 deletions

View file

@ -52,6 +52,18 @@ void main() {
},
);
test('watchInventory carries the first photo bytes for the avatar', () async {
await repo.addQuickVariety(
label: 'With photo',
photoBytes: Uint8List.fromList([9, 8, 7]),
);
await repo.addQuickVariety(label: 'No photo');
final items = await repo.watchInventory().first;
expect(items.firstWhere((i) => i.label == 'With photo').photo, [9, 8, 7]);
expect(items.firstWhere((i) => i.label == 'No photo').photo, isNull);
});
test(
'stream is ordered by category then label and excludes soft-deleted rows',
() async {