allow scanning from images

This commit is contained in:
fosse 2023-08-08 11:41:19 -04:00
parent 11b52efc25
commit f5a1273d43

View file

@ -21,14 +21,14 @@ class ScanScreenState extends State<ScanScreen> {
} }
Future<void> scanImage() async { Future<void> scanImage() async {
// final ImagePicker imagePicker = ImagePicker(); final ImagePicker imagePicker = ImagePicker();
// final XFile? file = await imagePicker.pickImage(source: ImageSource.gallery); final XFile? file = await imagePicker.pickImage(source: ImageSource.gallery);
// if (file?.path != null) { if (file?.path != null) {
// final bool qrCodeFound = await cameraController.analyzeImage(file!.path); final bool qrCodeFound = await cameraController.analyzeImage(file!.path);
// if (!qrCodeFound && mounted && !popped) { if (!qrCodeFound && mounted && !popped) {
// UIUtil.showSnackbar(Z.of(context).qrUnknownError, context); throw Exception("No QR code found");
// } }
// } }
} }
@override @override
@ -123,9 +123,11 @@ class ScanScreenState extends State<ScanScreen> {
builder: (BuildContext context, TorchState state, Widget? child) { builder: (BuildContext context, TorchState state, Widget? child) {
switch (state) { switch (state) {
case TorchState.off: case TorchState.off:
return const Icon(Icons.flashlight_off_rounded, color: Colors.white); return const Icon(Icons.flashlight_off_rounded,
color: Colors.white);
case TorchState.on: case TorchState.on:
return const Icon(Icons.flashlight_on_rounded, color: Colors.yellow); return const Icon(Icons.flashlight_on_rounded,
color: Colors.yellow);
} }
}, },
), ),