mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-08 03:49:43 +00:00
allow scanning from images
This commit is contained in:
parent
11b52efc25
commit
f5a1273d43
1 changed files with 12 additions and 10 deletions
|
@ -21,14 +21,14 @@ class ScanScreenState extends State<ScanScreen> {
|
|||
}
|
||||
|
||||
Future<void> scanImage() async {
|
||||
// final ImagePicker imagePicker = ImagePicker();
|
||||
// final XFile? file = await imagePicker.pickImage(source: ImageSource.gallery);
|
||||
// if (file?.path != null) {
|
||||
// final bool qrCodeFound = await cameraController.analyzeImage(file!.path);
|
||||
// if (!qrCodeFound && mounted && !popped) {
|
||||
// UIUtil.showSnackbar(Z.of(context).qrUnknownError, context);
|
||||
// }
|
||||
// }
|
||||
final ImagePicker imagePicker = ImagePicker();
|
||||
final XFile? file = await imagePicker.pickImage(source: ImageSource.gallery);
|
||||
if (file?.path != null) {
|
||||
final bool qrCodeFound = await cameraController.analyzeImage(file!.path);
|
||||
if (!qrCodeFound && mounted && !popped) {
|
||||
throw Exception("No QR code found");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -123,9 +123,11 @@ class ScanScreenState extends State<ScanScreen> {
|
|||
builder: (BuildContext context, TorchState state, Widget? child) {
|
||||
switch (state) {
|
||||
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:
|
||||
return const Icon(Icons.flashlight_on_rounded, color: Colors.yellow);
|
||||
return const Icon(Icons.flashlight_on_rounded,
|
||||
color: Colors.yellow);
|
||||
}
|
||||
},
|
||||
),
|
||||
|
|
Loading…
Reference in a new issue