|
|
@ -458,19 +458,30 @@ class _ReaderWidgetState extends State<ReaderWidget> |
|
|
|
final XFile? file = |
|
|
|
final XFile? file = |
|
|
|
await ImagePicker().pickImage(source: ImageSource.gallery); |
|
|
|
await ImagePicker().pickImage(source: ImageSource.gallery); |
|
|
|
if (file != null) { |
|
|
|
if (file != null) { |
|
|
|
final Code result = await zx.readBarcodeImagePath( |
|
|
|
final DecodeParams params = DecodeParams( |
|
|
|
file, |
|
|
|
format: widget.codeFormat, |
|
|
|
params: DecodeParams( |
|
|
|
tryHarder: widget.tryHarder, |
|
|
|
format: widget.codeFormat, |
|
|
|
tryInverted: widget.tryInverted, |
|
|
|
tryHarder: widget.tryHarder, |
|
|
|
isMultiScan: widget.isMultiScan, |
|
|
|
tryInverted: widget.tryInverted, |
|
|
|
|
|
|
|
isMultiScan: widget.isMultiScan, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
); |
|
|
|
); |
|
|
|
if (result.isValid) { |
|
|
|
if (widget.isMultiScan) { |
|
|
|
widget.onScan?.call(result); |
|
|
|
final Codes result = |
|
|
|
|
|
|
|
await zx.readBarcodesImagePath(file, params: params); |
|
|
|
|
|
|
|
if (result.codes.isNotEmpty) { |
|
|
|
|
|
|
|
results = result; |
|
|
|
|
|
|
|
widget.onMultiScan?.call(result); |
|
|
|
|
|
|
|
setState(() {}); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
results = Codes(); |
|
|
|
|
|
|
|
widget.onMultiScanFailure?.call(result); |
|
|
|
|
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
widget.onScanFailure?.call(result); |
|
|
|
final Code result = await zx.readBarcodeImagePath(file, params: params); |
|
|
|
|
|
|
|
if (result.isValid) { |
|
|
|
|
|
|
|
widget.onScan?.call(result); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
widget.onScanFailure?.call(result); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|