diff --git a/.pubignore b/.pubignore new file mode 100644 index 0000000..197e684 --- /dev/null +++ b/.pubignore @@ -0,0 +1,2 @@ +apk +example \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..0f551b2 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,45 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "qr_code_dart_scan", + "request": "launch", + "type": "dart" + }, + { + "name": "qr_code_dart_scan (profile mode)", + "request": "launch", + "type": "dart", + "flutterMode": "profile" + }, + { + "name": "qr_code_dart_scan (release mode)", + "request": "launch", + "type": "dart", + "flutterMode": "release" + }, + { + "name": "example", + "cwd": "example", + "request": "launch", + "type": "dart" + }, + { + "name": "example (profile mode)", + "cwd": "example", + "request": "launch", + "type": "dart", + "flutterMode": "profile" + }, + { + "name": "example (release mode)", + "cwd": "example", + "request": "launch", + "type": "dart", + "flutterMode": "release" + } + ] +} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 002ba06..f7fc8a7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,68 @@ +## 0.9.4 +- adds methods `toggleFlash`,`setFlash`,`setFlashAuto` in QRCodeDartScanController. + +## 0.9.3 +- Fix `stopImageStream` exception. + +## 0.9.2 +- Adds method `stopScan` and `startScan` in `QRCodeDartScanController`. +- Adds get `isLiveScan`. +- Fix `changeCamera` exception. + +## 0.9.1 +- Fix issue [#28](https://github.com/RafaelBarbosatec/qr_code_dart_scan/issues/28) +- Fix issue [#29](https://github.com/RafaelBarbosatec/qr_code_dart_scan/issues/29) + +## 0.9.0 +- Camera key improvments +- Update camera pluggin to `0.11.0` +- Performance improvements. Now using pool of isolates to process in live. +- Adds support to `itf`. + +## 0.8.3 +- Fix camera preview scale. + +## 0.8.2 +- Remove debug prints + +## 0.8.1 +- fix app life circle issue [26](https://github.com/RafaelBarbosatec/qr_code_dart_scan/pull/26). Thanks [Ömral Cörüt](https://github.com/omralcrt) ! + +## 0.8.0 +- `QRCodeDartScanController` Improvements +- Adds `Future changeCamera(TypeCamera typeCamera)` method in `QRCodeDartScanController`. +- Adds `intervalScan` param in `QRCodeDartScanView`. +- Adds `onResultInterceptor` param in `QRCodeDartScanView`. + +## 0.7.7 +- Fix issue [#18](https://github.com/RafaelBarbosatec/qr_code_dart_scan/issues/18). Thanks [MateusLucasDaSilva](https://github.com/MateusLucasDaSilva)! + +## 0.7.6 +- Handle with `didChangeAppLifecycleState`. +- Fix issue [#15](https://github.com/RafaelBarbosatec/qr_code_dart_scan/issues/15). Thanks [thierrylee](https://github.com/thierrylee)! + +## 0.7.5 +- Update dependencies. +- Adds the method `dispose` in `QRCodeDartScanController` + +## 0.7.4 +- Fix issue [#11](https://github.com/RafaelBarbosatec/qr_code_dart_scan/issues/11) +- Fix AspectRatio +- Update dependencies. + +## 0.7.3 +- Fix issue [#9](https://github.com/RafaelBarbosatec/qr_code_dart_scan/issues/9) + +## 0.7.2 +- Fix issue [#7](https://github.com/RafaelBarbosatec/qr_code_dart_scan/issues/7). Thanks so much [philseeley](https://github.com/philseeley)! + +## 0.7.1 +- return `resolutionPreset` default to `QRCodeDartScanResolutionPreset.medium` +- removre debug prints. + +## 0.7.0 +- Update dependencies. + ## 0.6.0 - Adds scan by picture - Export decoder diff --git a/README.md b/README.md index 065ead0..30e5344 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,12 @@ minSdkVersion 21 It's important to note that the `MediaRecorder` class is not working properly on emulators, as stated in the documentation: https://developer.android.com/reference/android/media/MediaRecorder. Specifically, when recording a video with sound enabled and trying to play it back, the duration won't be correct and you will only see the first frame. +Do override of `camera_android_camerax` to `0.6.10+3` in your pubspec.yml: + +``` +dependency_overrides: + camera_android_camerax: 0.6.10+3 +``` ### Using @@ -81,7 +87,12 @@ It's important to note that the `MediaRecorder` class is not working properly on return Scaffold( body: QRCodeDartScanView( scanInvertedQRCode: true, // enable scan invert qr code ( default = false) - typeScan: TypeScan.live, // if TypeScan.takePicture will try decode when click to take a picture (default TypeScan.live) + + typeScan: TypeScan.live, // if TypeScan.takePicture will try decode when click to take a picture(default TypeScan.live) + // intervalScan: const Duration(seconds:1) + // onResultInterceptor: (old,new){ + // do any rule to controll onCapture. + // } // takePictureButtonBuilder: (context,controller,isLoading){ // if typeScan == TypeScan.takePicture you can customize the button. // if(loading) return CircularProgressIndicator(); // return ElevatedButton( @@ -91,15 +102,15 @@ It's important to note that the `MediaRecorder` class is not working properly on // } // resolutionPreset: = QrCodeDartScanResolutionPreset.high, // formats: [ // You can restrict specific formats. - // BarcodeFormat.QR_CODE, - // BarcodeFormat.AZTEC, - // BarcodeFormat.DATA_MATRIX, - // BarcodeFormat.PDF_417, - // BarcodeFormat.CODE_39, - // BarcodeFormat.CODE_93, - // BarcodeFormat.CODE_128, - // BarcodeFormat.EAN_8, - // BarcodeFormat.EAN_13, + // BarcodeFormat.qrCode, + // BarcodeFormat.aztec, + // BarcodeFormat.dataMatrix, + // BarcodeFormat.pdf417, + // BarcodeFormat.code39, + // BarcodeFormat.code93, + // BarcodeFormat.code128, + // BarcodeFormat.ean8, + // BarcodeFormat.ean13, // ], onCapture: (Result result) { // do anything with result @@ -124,15 +135,15 @@ You may use only the our decoder if you want: final decoder = QRCodeDartScanDecoder( // formats: [ // You can restrict specific formats. - // BarcodeFormat.QR_CODE, - // BarcodeFormat.AZTEC, - // BarcodeFormat.DATA_MATRIX, - // BarcodeFormat.PDF_417, - // BarcodeFormat.CODE_39, - // BarcodeFormat.CODE_93, - // BarcodeFormat.CODE_128, - // BarcodeFormat.EAN_8, - // BarcodeFormat.EAN_13, + // BarcodeFormat.qrCode, + // BarcodeFormat.aztec, + // BarcodeFormat.dataMatrix, + // BarcodeFormat.pdf417, + // BarcodeFormat.code39, + // BarcodeFormat.code93, + // BarcodeFormat.code128, + // BarcodeFormat.ean8, + // BarcodeFormat.ean13, // ], ); diff --git a/analysis_options.yaml b/analysis_options.yaml new file mode 100644 index 0000000..61b6c4d --- /dev/null +++ b/analysis_options.yaml @@ -0,0 +1,29 @@ +# This file configures the analyzer, which statically analyzes Dart code to +# check for errors, warnings, and lints. +# +# The issues identified by the analyzer are surfaced in the UI of Dart-enabled +# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be +# invoked from the command line by running `flutter analyze`. + +# The following line activates a set of recommended lints for Flutter apps, +# packages, and plugins designed to encourage good coding practices. +include: package:flutter_lints/flutter.yaml + +linter: + # The lint rules applied to this project can be customized in the + # section below to disable rules from the `package:flutter_lints/flutter.yaml` + # included above or to enable additional rules. A list of all available lints + # and their documentation is published at + # https://dart-lang.github.io/linter/lints/index.html. + # + # Instead of disabling a lint rule for the entire project in the + # section below, it can also be suppressed for a single line of code + # or a specific dart file by using the `// ignore: name_of_lint` and + # `// ignore_for_file: name_of_lint` syntax on the line or in the file + # producing the lint. + rules: + # avoid_print: false # Uncomment to disable the `avoid_print` rule + # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule + +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options diff --git a/apk/demo.apk b/apk/demo.apk index 703744a..d2a0e81 100644 Binary files a/apk/demo.apk and b/apk/demo.apk differ diff --git a/example/.metadata b/example/.metadata index ec98142..7d0a304 100644 --- a/example/.metadata +++ b/example/.metadata @@ -4,7 +4,27 @@ # This file should be version controlled and should not be manually edited. version: - revision: d79295af24c3ed621c33713ecda14ad196fd9c31 - channel: stable + revision: "41456452f29d64e8deb623a3c927524bcf9f111b" + channel: "stable" project_type: app + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: 41456452f29d64e8deb623a3c927524bcf9f111b + base_revision: 41456452f29d64e8deb623a3c927524bcf9f111b + - platform: android + create_revision: 41456452f29d64e8deb623a3c927524bcf9f111b + base_revision: 41456452f29d64e8deb623a3c927524bcf9f111b + + # User provided section + + # List of Local paths (relative to this file) that should be + # ignored by the migrate tool. + # + # Files that are not part of the templates will be ignored by default. + unmanaged_files: + - 'lib/main.dart' + - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/example/analysis_options.yaml b/example/analysis_options.yaml new file mode 100644 index 0000000..0d29021 --- /dev/null +++ b/example/analysis_options.yaml @@ -0,0 +1,28 @@ +# This file configures the analyzer, which statically analyzes Dart code to +# check for errors, warnings, and lints. +# +# The issues identified by the analyzer are surfaced in the UI of Dart-enabled +# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be +# invoked from the command line by running `flutter analyze`. + +# The following line activates a set of recommended lints for Flutter apps, +# packages, and plugins designed to encourage good coding practices. +include: package:flutter_lints/flutter.yaml + +linter: + # The lint rules applied to this project can be customized in the + # section below to disable rules from the `package:flutter_lints/flutter.yaml` + # included above or to enable additional rules. A list of all available lints + # and their documentation is published at https://dart.dev/lints. + # + # Instead of disabling a lint rule for the entire project in the + # section below, it can also be suppressed for a single line of code + # or a specific dart file by using the `// ignore: name_of_lint` and + # `// ignore_for_file: name_of_lint` syntax on the line or in the file + # producing the lint. + rules: + # avoid_print: false # Uncomment to disable the `avoid_print` rule + # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule + +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options diff --git a/example/android/.gitignore b/example/android/.gitignore index 0a741cb..6f56801 100644 --- a/example/android/.gitignore +++ b/example/android/.gitignore @@ -9,3 +9,5 @@ GeneratedPluginRegistrant.java # Remember to never publicly share your keystore. # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app key.properties +**/*.keystore +**/*.jks diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index 89ee73e..daa7cf5 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -1,3 +1,9 @@ +plugins { + id "com.android.application" + id "kotlin-android" + id "dev.flutter.flutter-gradle-plugin" +} + def localProperties = new Properties() def localPropertiesFile = rootProject.file('local.properties') if (localPropertiesFile.exists()) { @@ -6,11 +12,6 @@ if (localPropertiesFile.exists()) { } } -def flutterRoot = localProperties.getProperty('flutter.sdk') -if (flutterRoot == null) { - throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") -} - def flutterVersionCode = localProperties.getProperty('flutter.versionCode') if (flutterVersionCode == null) { flutterVersionCode = '1' @@ -21,12 +22,24 @@ if (flutterVersionName == null) { flutterVersionName = '1.0' } -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' -apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" +def flutterMinSdkVersion = localProperties.getProperty('flutter.minSdkVersion') +if (flutterMinSdkVersion == null) { + flutterMinSdkVersion = '21' +} android { - compileSdkVersion 31 + namespace "com.example.example" + compileSdkVersion flutter.compileSdkVersion + ndkVersion flutter.ndkVersion + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + + kotlinOptions { + jvmTarget = '1.8' + } sourceSets { main.java.srcDirs += 'src/main/kotlin' @@ -34,9 +47,11 @@ android { defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). - applicationId "com.qrcodedartscan.example" - minSdkVersion 21 - targetSdkVersion 31 + applicationId "com.example.qrcodedartscan" + // You can update the following values to match your application needs. + // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. + minSdkVersion flutterMinSdkVersion.toInteger() + targetSdkVersion flutter.targetSdkVersion versionCode flutterVersionCode.toInteger() versionName flutterVersionName } @@ -54,6 +69,4 @@ flutter { source '../..' } -dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" -} +dependencies {} diff --git a/example/android/app/src/debug/AndroidManifest.xml b/example/android/app/src/debug/AndroidManifest.xml index 7a7ad94..399f698 100644 --- a/example/android/app/src/debug/AndroidManifest.xml +++ b/example/android/app/src/debug/AndroidManifest.xml @@ -1,6 +1,6 @@ - - diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml index da32707..ce5abb2 100644 --- a/example/android/app/src/main/AndroidManifest.xml +++ b/example/android/app/src/main/AndroidManifest.xml @@ -1,10 +1,11 @@ - - + - - diff --git a/example/android/app/src/main/kotlin/com/qrcodedartscan/example/MainActivity.kt b/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt similarity index 73% rename from example/android/app/src/main/kotlin/com/qrcodedartscan/example/MainActivity.kt rename to example/android/app/src/main/kotlin/com/example/example/MainActivity.kt index a572119..e793a00 100644 --- a/example/android/app/src/main/kotlin/com/qrcodedartscan/example/MainActivity.kt +++ b/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt @@ -1,4 +1,4 @@ -package com.qrcodedartscan.example +package com.example.example import io.flutter.embedding.android.FlutterActivity diff --git a/example/android/app/src/main/res/values-night/styles.xml b/example/android/app/src/main/res/values-night/styles.xml index 449a9f9..06952be 100644 --- a/example/android/app/src/main/res/values-night/styles.xml +++ b/example/android/app/src/main/res/values-night/styles.xml @@ -3,14 +3,14 @@