fix: qrcode issue and update qrcode lib
This commit is contained in:
@@ -33,7 +33,7 @@ class QRCodeScannerScreen extends StatefulHookConsumerWidget {
|
||||
class _QRCodeScannerScreenState extends ConsumerState<QRCodeScannerScreen> with WidgetsBindingObserver, PresLogger {
|
||||
final MobileScannerController controller = MobileScannerController(
|
||||
detectionTimeoutMs: 500,
|
||||
// autoStart: false,
|
||||
autoStart: false,
|
||||
);
|
||||
bool started = false;
|
||||
|
||||
@@ -136,6 +136,8 @@ class _QRCodeScannerScreenState extends ConsumerState<QRCodeScannerScreen> with
|
||||
}
|
||||
|
||||
Future<void> _startScanner() async {
|
||||
loggy.info("Starting scanner");
|
||||
await controller.stop();
|
||||
await controller.start().whenComplete(() {
|
||||
setState(() {
|
||||
started = true;
|
||||
@@ -186,8 +188,6 @@ class _QRCodeScannerScreenState extends ConsumerState<QRCodeScannerScreen> with
|
||||
Widget build(BuildContext context) {
|
||||
final Translations t = ref.watch(translationsProvider);
|
||||
|
||||
startQrScannerIfPermissionIsGranted();
|
||||
|
||||
return FutureBuilder(
|
||||
future: FlutterEasyPermission.has(
|
||||
perms: permissions,
|
||||
@@ -210,7 +210,7 @@ class _QRCodeScannerScreenState extends ConsumerState<QRCodeScannerScreen> with
|
||||
Widget _buildScannerUI(BuildContext context, Translations t) {
|
||||
final size = MediaQuery.sizeOf(context);
|
||||
final overlaySize = (size.shortestSide - 12).coerceAtMost(248);
|
||||
|
||||
// _startScanner();
|
||||
return Scaffold(
|
||||
extendBodyBehindAppBar: true,
|
||||
appBar: AppBar(
|
||||
@@ -221,26 +221,31 @@ class _QRCodeScannerScreenState extends ConsumerState<QRCodeScannerScreen> with
|
||||
),
|
||||
actions: [
|
||||
IconButton(
|
||||
icon: ValueListenableBuilder(
|
||||
valueListenable: controller.torchState,
|
||||
builder: (context, state, child) {
|
||||
switch (state) {
|
||||
case TorchState.off:
|
||||
return const Icon(
|
||||
FluentIcons.flash_off_24_regular,
|
||||
color: Colors.grey,
|
||||
);
|
||||
case TorchState.on:
|
||||
return const Icon(
|
||||
FluentIcons.flash_24_regular,
|
||||
color: Colors.yellow,
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
icon: const Icon(FluentIcons.flash_24_regular),
|
||||
tooltip: t.profile.add.qrScanner.torchSemanticLabel,
|
||||
onPressed: () => controller.toggleTorch(),
|
||||
),
|
||||
// IconButton(
|
||||
// icon: ValueListenableBuilder(
|
||||
// valueListenable: controller.torchState,
|
||||
// builder: (context, state, child) {
|
||||
// switch (state) {
|
||||
// case TorchState.off:
|
||||
// return const Icon(
|
||||
// FluentIcons.flash_off_24_regular,
|
||||
// color: Colors.grey,
|
||||
// );
|
||||
// case TorchState.on:
|
||||
// return const Icon(
|
||||
// FluentIcons.flash_24_regular,
|
||||
// color: Colors.yellow,
|
||||
// );
|
||||
// }
|
||||
// },
|
||||
// ),
|
||||
// tooltip: t.profile.add.qrScanner.torchSemanticLabel,
|
||||
// onPressed: () => controller.toggleTorch(),
|
||||
// ),
|
||||
IconButton(
|
||||
icon: const Icon(FluentIcons.camera_switch_24_regular),
|
||||
tooltip: t.profile.add.qrScanner.facingSemanticLabel,
|
||||
|
||||
@@ -1019,10 +1019,10 @@ packages:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: mobile_scanner
|
||||
sha256: "619ed5fd43ca9007a151f00c3dc43feedeaf235fe5647735d0237c38849d49dc"
|
||||
sha256: b8c0e9afcfd52534f85ec666f3d52156f560b5e6c25b1e3d4fe2087763607926
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.0.0"
|
||||
version: "5.1.1"
|
||||
neat_periodic_task:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
||||
@@ -35,7 +35,7 @@ dependencies:
|
||||
dio: ^5.4.1
|
||||
ffi: ^2.1.2
|
||||
path_provider: ^2.1.1
|
||||
mobile_scanner: ^4.0.0
|
||||
mobile_scanner: ^5.1.1
|
||||
protocol_handler: ^0.2.0
|
||||
flutter_native_splash: ^2.3.10
|
||||
share_plus: ^7.2.2
|
||||
|
||||
Reference in New Issue
Block a user