feat: scan book to add to sell

This commit is contained in:
alzalia1 2025-08-15 12:51:36 +02:00
parent 3a013c829f
commit 07c7c98edb
11 changed files with 238 additions and 31 deletions

View file

@ -3,6 +3,7 @@ import 'package:flutter_svg/svg.dart';
import 'package:mobile_scanner/mobile_scanner.dart';
import 'package:seshat/ui/sell_page/view_model/sell_view_model.dart';
import 'package:seshat/ui/sell_page/widgets/manual_scan_popup.dart';
import 'package:seshat/ui/sell_page/widgets/sell_choice_popup.dart';
class ScanScreen extends StatefulWidget {
const ScanScreen({super.key, required this.viewModel});
@ -30,12 +31,23 @@ class _ScanScreenState extends State<ScanScreen> {
final theme = Theme.of(context);
return Stack(
children: [
ColoredBox(
color: Theme.of(context).scaffoldBackgroundColor,
child: SizedBox(
width: MediaQuery.sizeOf(context).width,
height: MediaQuery.sizeOf(context).height,
),
),
MobileScanner(
controller: controller,
onDetect: (barcodes) async {
widget.viewModel.showScan = false;
widget.viewModel.scanBook(barcodes);
controller.dispose();
controller.stop();
showDialog(
context: context,
builder: (context) =>
SellChoicePopup(viewModel: widget.viewModel),
);
await widget.viewModel.scanBook(barcodes);
},
),
SafeArea(