diff --git a/example/pubspec.lock b/example/pubspec.lock index ee1635c..31391a5 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -35,7 +35,7 @@ packages: name: camera_android url: "https://pub.dartlang.org" source: hosted - version: "0.10.0+1" + version: "0.10.0+2" camera_avfoundation: dependency: transitive description: @@ -84,7 +84,7 @@ packages: name: cross_file url: "https://pub.dartlang.org" source: hosted - version: "0.3.3+1" + version: "0.3.3+2" crypto: dependency: transitive description: @@ -141,14 +141,14 @@ packages: path: ".." relative: true source: path - version: "0.8.0" + version: "0.8.1" font_awesome_flutter: dependency: "direct main" description: name: font_awesome_flutter url: "https://pub.dartlang.org" source: hosted - version: "10.1.0" + version: "10.2.1" http: dependency: transitive description: @@ -183,7 +183,7 @@ packages: name: image_picker_android url: "https://pub.dartlang.org" source: hosted - version: "0.8.5+2" + version: "0.8.5+3" image_picker_for_web: dependency: transitive description: @@ -197,7 +197,7 @@ packages: name: image_picker_ios url: "https://pub.dartlang.org" source: hosted - version: "0.8.6" + version: "0.8.6+1" image_picker_platform_interface: dependency: transitive description: @@ -260,7 +260,7 @@ packages: name: plugin_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "2.1.2" + version: "2.1.3" quiver: dependency: transitive description: diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 858c4ff..0438ab0 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -11,7 +11,7 @@ dependencies: sdk: flutter flutter_zxing: path: ../ - font_awesome_flutter: ^10.1.0 + font_awesome_flutter: ^10.2.1 image: ^3.2.0 image_picker: ^0.8.5 diff --git a/lib/src/ui/reader_widget.dart b/lib/src/ui/reader_widget.dart index 25157c3..38feecb 100644 --- a/lib/src/ui/reader_widget.dart +++ b/lib/src/ui/reader_widget.dart @@ -26,7 +26,8 @@ class ReaderWidget extends StatefulWidget { this.scanDelaySuccess = const Duration(milliseconds: 1000), // 1000ms delay this.cropPercent = 0.5, // 50% of the screen this.resolution = ResolutionPreset.high, - this.loading = const DecoratedBox(decoration: BoxDecoration(color: Colors.black)), + this.loading = + const DecoratedBox(decoration: BoxDecoration(color: Colors.black)), }); final Function(CodeResult) onScan; @@ -46,7 +47,8 @@ class ReaderWidget extends StatefulWidget { State createState() => _ReaderWidgetState(); } -class _ReaderWidgetState extends State with TickerProviderStateMixin, WidgetsBindingObserver { +class _ReaderWidgetState extends State + with TickerProviderStateMixin, WidgetsBindingObserver { List cameras = []; CameraController? controller; bool _cameraOn = false; @@ -89,7 +91,6 @@ class _ReaderWidgetState extends State with TickerProviderStateMix if (cameras.isNotEmpty && !_cameraOn) { onNewCameraSelected(cameras.first); } - break; case AppLifecycleState.inactive: break; @@ -131,7 +132,8 @@ class _ReaderWidgetState extends State with TickerProviderStateMix cameraDescription, widget.resolution, enableAudio: false, - imageFormatGroup: isAndroid() ? ImageFormatGroup.yuv420 : ImageFormatGroup.bgra8888, + imageFormatGroup: + isAndroid() ? ImageFormatGroup.yuv420 : ImageFormatGroup.bgra8888, ); if (controller == null) { return; @@ -144,6 +146,8 @@ class _ReaderWidgetState extends State with TickerProviderStateMix controller!.startImageStream(processImageStream); } on CameraException catch (e) { debugPrint('${e.code}: ${e.description}'); + } catch (e) { + debugPrint('Error: $e'); } controller!.addListener(rebuildOnMount); @@ -179,7 +183,10 @@ class _ReaderWidgetState extends State with TickerProviderStateMix @override Widget build(BuildContext context) { - final bool isCameraReady = cameras.isNotEmpty && _cameraOn && controller != null && controller!.value.isInitialized; + final bool isCameraReady = cameras.isNotEmpty && + _cameraOn && + controller != null && + controller!.value.isInitialized; final Size size = MediaQuery.of(context).size; final double cameraMaxSize = max(size.width, size.height); final double cropSize = min(size.width, size.height) * widget.cropPercent; @@ -224,29 +231,29 @@ class _ReaderWidgetState extends State with TickerProviderStateMix _zoom = _scaleFactor; }, onScaleUpdate: (ScaleUpdateDetails details) { - _scaleFactor = (_zoom * details.scale).clamp(_minZoomLevel, _maxZoomLevel); + _scaleFactor = + (_zoom * details.scale).clamp(_minZoomLevel, _maxZoomLevel); controller?.setZoomLevel(_scaleFactor); }, ), - if (widget.showFlashlight) + if (widget.showFlashlight && isCameraReady) Positioned( bottom: 20, left: 20, child: FloatingActionButton( onPressed: () { - if (controller != null) { - FlashMode mode = controller!.value.flashMode; - if (mode == FlashMode.torch) { - mode = FlashMode.off; - } else { - mode = FlashMode.torch; - } - controller!.setFlashMode(mode); - setState(() {}); + FlashMode mode = controller!.value.flashMode; + if (mode == FlashMode.torch) { + mode = FlashMode.off; + } else { + mode = FlashMode.torch; } + controller?.setFlashMode(mode); + setState(() {}); }, backgroundColor: Colors.black26, - child: _FlashIcon(flashMode: controller!.value.flashMode)), + child: _FlashIcon( + flashMode: controller?.value.flashMode ?? FlashMode.off)), ), ], ); diff --git a/zxscanner/lib/generated/intl/messages_en_US.dart b/zxscanner/lib/generated/intl/messages_en_US.dart index f943842..fb62c24 100644 --- a/zxscanner/lib/generated/intl/messages_en_US.dart +++ b/zxscanner/lib/generated/intl/messages_en_US.dart @@ -20,7 +20,8 @@ typedef String MessageIfAbsent(String messageStr, List args); class MessageLookup extends MessageLookupByLibrary { String get localeName => 'en_US'; - final Map messages = _notInlinedMessages(_notInlinedMessages); + final Map messages = + _notInlinedMessages(_notInlinedMessages); static Map _notInlinedMessages(_) => { "settingsAppBarTitle": MessageLookupByLibrary.simpleMessage("Settings"), "settingsLanguageTitle": diff --git a/zxscanner/lib/models/code.dart b/zxscanner/lib/models/code.dart index b79524e..bc3d53d 100644 --- a/zxscanner/lib/models/code.dart +++ b/zxscanner/lib/models/code.dart @@ -5,7 +5,6 @@ part 'code.g.dart'; @HiveType(typeId: 0) class Code extends HiveObject { - Code(); Code.fromCodeResult(CodeResult result) { diff --git a/zxscanner/lib/models/encode.dart b/zxscanner/lib/models/encode.dart index dde6eb2..65789a2 100644 --- a/zxscanner/lib/models/encode.dart +++ b/zxscanner/lib/models/encode.dart @@ -7,7 +7,6 @@ part 'encode.g.dart'; @HiveType(typeId: 1) class Encode extends HiveObject { - Encode(); Encode.fromEncodeResult(EncodeResult result, Uint8List? bytes) { diff --git a/zxscanner/pubspec.lock b/zxscanner/pubspec.lock index 7444ec1..34b31ae 100644 --- a/zxscanner/pubspec.lock +++ b/zxscanner/pubspec.lock @@ -49,7 +49,7 @@ packages: name: build url: "https://pub.dartlang.org" source: hosted - version: "2.3.0" + version: "2.3.1" build_config: dependency: transitive description: @@ -70,21 +70,21 @@ packages: name: build_resolvers url: "https://pub.dartlang.org" source: hosted - version: "2.0.9" + version: "2.0.10" build_runner: dependency: "direct dev" description: name: build_runner url: "https://pub.dartlang.org" source: hosted - version: "2.2.0" + version: "2.2.1" build_runner_core: dependency: transitive description: name: build_runner_core url: "https://pub.dartlang.org" source: hosted - version: "7.2.3" + version: "7.2.4" built_collection: dependency: transitive description: @@ -141,13 +141,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.2.1" - charcode: - dependency: transitive - description: - name: charcode - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.1" checked_yaml: dependency: transitive description: @@ -168,7 +161,7 @@ packages: name: code_builder url: "https://pub.dartlang.org" source: hosted - version: "4.2.0" + version: "4.3.0" collection: dependency: transitive description: @@ -189,14 +182,14 @@ packages: name: convex_bottom_bar url: "https://pub.dartlang.org" source: hosted - version: "3.0.0" + version: "3.1.0+1" cross_file: dependency: transitive description: name: cross_file url: "https://pub.dartlang.org" source: hosted - version: "0.3.3+1" + version: "0.3.3+2" crypto: dependency: transitive description: @@ -224,7 +217,7 @@ packages: name: dart_style url: "https://pub.dartlang.org" source: hosted - version: "2.2.3" + version: "2.2.4" fake_async: dependency: transitive description: @@ -259,7 +252,7 @@ packages: name: flex_color_scheme url: "https://pub.dartlang.org" source: hosted - version: "6.0.0" + version: "6.0.1" flex_seed_scheme: dependency: transitive description: @@ -290,14 +283,14 @@ packages: name: flutter_markdown url: "https://pub.dartlang.org" source: hosted - version: "0.6.10+5" + version: "0.6.12" flutter_mobx: dependency: "direct main" description: name: flutter_mobx url: "https://pub.dartlang.org" source: hosted - version: "2.0.6+1" + version: "2.0.6+4" flutter_native_splash: dependency: "direct dev" description: @@ -328,7 +321,7 @@ packages: path: ".." relative: true source: path - version: "0.8.0" + version: "0.8.1" font_awesome_flutter: dependency: "direct main" description: @@ -447,7 +440,7 @@ packages: name: image_picker_ios url: "https://pub.dartlang.org" source: hosted - version: "0.8.6" + version: "0.8.6+1" image_picker_platform_interface: dependency: transitive description: @@ -482,7 +475,7 @@ packages: name: json_annotation url: "https://pub.dartlang.org" source: hosted - version: "4.6.0" + version: "4.7.0" lint: dependency: transitive description: @@ -510,7 +503,7 @@ packages: name: markdown url: "https://pub.dartlang.org" source: hosted - version: "5.0.0" + version: "6.0.1" matcher: dependency: transitive description: @@ -545,14 +538,14 @@ packages: name: mobx url: "https://pub.dartlang.org" source: hosted - version: "2.0.7+5" + version: "2.1.0" mobx_codegen: dependency: "direct dev" description: name: mobx_codegen url: "https://pub.dartlang.org" source: hosted - version: "2.0.7" + version: "2.0.7+3" package_config: dependency: transitive description: @@ -636,7 +629,7 @@ packages: name: plugin_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "2.1.2" + version: "2.1.3" pool: dependency: transitive description: @@ -678,7 +671,7 @@ packages: name: share_plus url: "https://pub.dartlang.org" source: hosted - version: "4.1.0" + version: "4.4.0" share_plus_linux: dependency: transitive description: @@ -776,7 +769,7 @@ packages: name: shelf url: "https://pub.dartlang.org" source: hosted - version: "1.3.2" + version: "1.4.0" shelf_web_socket: dependency: transitive description: @@ -795,14 +788,14 @@ packages: name: source_gen url: "https://pub.dartlang.org" source: hosted - version: "1.2.2" + version: "1.2.5" source_helper: dependency: transitive description: name: source_helper url: "https://pub.dartlang.org" source: hosted - version: "1.3.2" + version: "1.3.3" source_span: dependency: transitive description: @@ -886,7 +879,7 @@ packages: name: url_launcher_android url: "https://pub.dartlang.org" source: hosted - version: "6.0.18" + version: "6.0.19" url_launcher_ios: dependency: transitive description: @@ -979,5 +972,5 @@ packages: source: hosted version: "3.1.1" sdks: - dart: ">=2.18.0 <3.0.0" + dart: ">=2.18.1 <3.0.0" flutter: ">=3.3.0" diff --git a/zxscanner/pubspec.yaml b/zxscanner/pubspec.yaml index 98f8e73..7a7ac21 100644 --- a/zxscanner/pubspec.yaml +++ b/zxscanner/pubspec.yaml @@ -5,17 +5,17 @@ publish_to: "none" version: 1.0.3+8 environment: - sdk: ">=2.18.0 <3.0.0" + sdk: ">=2.18.1 <3.0.0" dependencies: - convex_bottom_bar: ^3.0.0 + convex_bottom_bar: ^3.1.0 cupertino_icons: ^1.0.5 - flex_color_scheme: ^6.0.0 + flex_color_scheme: ^6.0.1 flutter: sdk: flutter flutter_localizations: sdk: flutter - flutter_markdown: ^0.6.10 + flutter_markdown: ^0.6.12 flutter_mobx: ^2.0.6 flutter_zxing: path: ../ @@ -25,9 +25,9 @@ dependencies: image: ^3.2.0 image_picker: ^0.8.5 intl: ^0.17.0 - mobx: ^2.0.7 + mobx: ^2.1.0 path_provider: ^2.0.11 - share_plus: ^4.1.0 + share_plus: ^4.4.0 shared_preferences: ^2.0.15 url_launcher: ^6.1.5 @@ -36,7 +36,7 @@ flutter_intl: enabled: true dev_dependencies: - build_runner: ^2.2.0 + build_runner: ^2.2.1 # espresso: ^0.2.0+2 flutter_lints: ^2.0.1 flutter_native_splash: ^2.2.9 # flutter pub run flutter_native_splash:create