fixes before build 3
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
/// Editable list of parsed receipt lines before they are saved as a shop trip.
|
||||
library;
|
||||
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'models/line_item.dart';
|
||||
@@ -113,6 +115,24 @@ class _ReviewScreenState extends State<ReviewScreen> {
|
||||
setState(() => _shoppedAt = picked);
|
||||
}
|
||||
|
||||
Future<void> _openReceipt() async {
|
||||
final path = widget.imagePath;
|
||||
if (path == null || path.isEmpty) return;
|
||||
final file = File(path);
|
||||
if (!file.existsSync()) return;
|
||||
await showDialog<void>(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return Dialog(
|
||||
insetPadding: const EdgeInsets.all(16),
|
||||
child: InteractiveViewer(
|
||||
child: Image.file(file, fit: BoxFit.contain),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _confirm() async {
|
||||
final supermarket = _resolvedSupermarket;
|
||||
if (supermarket == null) {
|
||||
@@ -160,6 +180,10 @@ class _ReviewScreenState extends State<ReviewScreen> {
|
||||
if (_supermarket != null && !names.contains(_supermarket)) {
|
||||
names.add(_supermarket!);
|
||||
}
|
||||
final receiptPath = widget.imagePath;
|
||||
final hasReceipt = receiptPath != null &&
|
||||
receiptPath.isNotEmpty &&
|
||||
File(receiptPath).existsSync();
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
@@ -313,6 +337,27 @@ class _ReviewScreenState extends State<ReviewScreen> {
|
||||
],
|
||||
),
|
||||
),
|
||||
if (hasReceipt)
|
||||
ExpansionTile(
|
||||
title: const Text('See receipt'),
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 0, 16, 16),
|
||||
child: GestureDetector(
|
||||
onTap: _openReceipt,
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
child: Image.file(
|
||||
File(receiptPath),
|
||||
fit: BoxFit.contain,
|
||||
height: 220,
|
||||
width: double.infinity,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
if (widget.rawText.isNotEmpty)
|
||||
ExpansionTile(
|
||||
title: const Text('Raw OCR text'),
|
||||
|
||||
Reference in New Issue
Block a user