fix: fixed a bug that would cause empty scanned barcodes to be treated as no-empty

This commit is contained in:
alzalia1 2025-08-19 23:17:45 +02:00
parent 587cc0689a
commit aa3fda9c88
2 changed files with 6 additions and 0 deletions

View file

@ -80,6 +80,9 @@ class _AddPageState extends State<AddPage> {
MobileScanner( MobileScanner(
controller: controller, controller: controller,
onDetect: (barcodes) async { onDetect: (barcodes) async {
if (barcodes.barcodes.isEmpty) {
return;
}
if (widget.viewModel.currentOwner == null) { if (widget.viewModel.currentOwner == null) {
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar( SnackBar(

View file

@ -41,6 +41,9 @@ class _ScanScreenState extends State<ScanScreen> {
MobileScanner( MobileScanner(
controller: controller, controller: controller,
onDetect: (barcodes) async { onDetect: (barcodes) async {
if (barcodes.barcodes.isEmpty) {
return;
}
controller.stop(); controller.stop();
showDialog( showDialog(
context: context, context: context,