Can extract date of expenses
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2025-07-20 18:07:22 +02:00
parent 28f61a3099
commit 71d32d72ef
2 changed files with 46 additions and 15 deletions

View File

@@ -13,10 +13,10 @@ part 'scan_screen.g.dart';
/// Scan a document & return generated PDF as byte file
@riverpod
Future<(Uint8List?, double?)> _scanDocument(Ref ref) async {
Future<(Uint8List?, BaseExpenseInfo?)> _scanDocument(Ref ref) async {
final pdf = await scanDocAsPDF();
final img = await renderPdf(pdfBytes: pdf);
final amount = await extractTotalFromBill(img);
final amount = await extractInfoFromBill(img);
return (pdf, amount);
}
@@ -42,11 +42,7 @@ class ScanScreen extends HookConsumerWidget {
child: switch (scanDocProvider) {
AsyncData(:final value) when value.$1 != null => ExpenseEditor(
file: value.$1!,
initialData: BaseExpenseInfo(
label: null,
cost: value.$2 ?? 0.0,
time: DateTime.now(),
),
initialData: value.$2,
onFinished: (expense) async {
await expenses.add(
info: expense,