feat(inventory): photo-first drafts + on-device OCR (digitization R2+R4)
Lower the bulk-digitization cliff with two more routes on top of the already-landed CSV import and "save and add another": - Photo-first drafts (capture now, catalogue later): burst-capture photos (camera or multi-gallery) into unnamed draft varieties, shown in a "to catalogue" tray, hidden from the main list until named. Adds Variety.isDraft (schema), addDraftVariety/watchDrafts/nameDraft, the triage sheet and the inventory banner. - On-device OCR label suggestion (Tesseract, offline, no Google): a "Suggest name from photo" button in the naming dialog behind a LabelTextExtractor interface (Tesseract on Android/iOS, no-op elsewhere). Reads the largest print via hOCR bounding boxes, drops boilerplate/low-confidence noise, preprocesses (grayscale, contrast, upscale) and sweeps rotations (0-315 deg) so tilted packets still read. Bundles tessdata_fast eng+spa; validated on-device against real packets. The photo is written to a temp file deleted immediately in a finally block (the plugin needs a path) - a bounded, documented exception to no-plaintext-at-rest. This commit also carries the co-developed schema evolution v5 to v8 that shares these files (organic flag, species viability years, crop calendar, lot provenance/abundance/preservation format, condition checks) plus their exports/migrations and i18n. Tests: CSV/draft/OCR unit + widget + migration green in isolation. Note: the full widget suite currently hangs (>10 min) - under investigation.
This commit is contained in:
parent
12a2ee2d64
commit
6809dc6143
89 changed files with 17141 additions and 228 deletions
|
|
@ -4,9 +4,11 @@ import '../di/injector.dart';
|
|||
import '../i18n/strings.g.dart';
|
||||
import '../services/export_import_service.dart';
|
||||
|
||||
/// The three backup actions shown in Settings: export CSV, export JSON and
|
||||
/// import JSON. Import asks for confirmation first (it merges into the live
|
||||
/// inventory), then reports what happened in a SnackBar.
|
||||
/// The backup actions shown in Settings. The primary pair — save/restore a
|
||||
/// full copy — comes first; the spreadsheet list export/import is a secondary
|
||||
/// convenience below. File formats (JSON/CSV) are an implementation detail and
|
||||
/// never surface in the UI. Restore/import asks for confirmation first (it
|
||||
/// merges into the live inventory), then reports what happened in a SnackBar.
|
||||
class BackupSection extends StatelessWidget {
|
||||
const BackupSection({this.service, super.key});
|
||||
|
||||
|
|
@ -22,23 +24,24 @@ class BackupSection extends StatelessWidget {
|
|||
return Column(
|
||||
children: [
|
||||
ListTile(
|
||||
leading: const Icon(Icons.table_view_outlined),
|
||||
title: Text(t.backup.exportCsv),
|
||||
subtitle: Text(t.backup.exportCsvSubtitle),
|
||||
onTap: () => _runExport(context, () => _service.exportCsv()),
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.file_download_outlined),
|
||||
leading: const Icon(Icons.save_alt_outlined),
|
||||
title: Text(t.backup.exportJson),
|
||||
subtitle: Text(t.backup.exportJsonSubtitle),
|
||||
onTap: () => _runExport(context, () => _service.exportJson()),
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.file_upload_outlined),
|
||||
leading: const Icon(Icons.settings_backup_restore_outlined),
|
||||
title: Text(t.backup.importJson),
|
||||
subtitle: Text(t.backup.importJsonSubtitle),
|
||||
onTap: () => _runImport(context),
|
||||
),
|
||||
const Divider(),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.table_view_outlined),
|
||||
title: Text(t.backup.exportCsv),
|
||||
subtitle: Text(t.backup.exportCsvSubtitle),
|
||||
onTap: () => _runExport(context, () => _service.exportCsv()),
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.playlist_add_outlined),
|
||||
title: Text(t.backup.importCsv),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue