Giter Club home page Giter Club logo

flutter_qr_bar_scanner's People

Contributors

contactlutforrahman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

flutter_qr_bar_scanner's Issues

Incompatibility Exception with AndroidX

Hi there,

i just tried out the package with your example.
I'm using: Flutter 1.17.0, VS-Code and Android Emulator w. A9 (28)

I get this error Message (complete output):

Launching lib\main.dart on AOSP on IA Emulator in debug mode...

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:preDebugBuild'.
> Could not resolve all dependencies for configuration ':app:debugRuntimeClasspath'.
   > Could not determine artifacts for androidx.fragment:fragment:1.1.0
      > Could not get resource 'https://dl.google.com/dl/android/maven2/androidx/fragment/fragment/1.1.0/fragment-1.1.0.aar'.
         > Could not HEAD 'https://dl.google.com/dl/android/maven2/androidx/fragment/fragment/1.1.0/fragment-1.1.0.aar'.
            > Connect to dl.google.com:443 [dl.google.com/172.217.168.238] failed: Connection timed out: connect

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1m 5s
The built failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetfier to solve the incompatibility.
Building plugin flutter_qr_bar_scanner...

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'flutter_qr_bar_scanner'.
> SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1s
Exception: The plugin flutter_qr_bar_scanner could not be built due to the issue above.
Exited (sigterm)

[BUG]flutter q_bar_scanner gives thread on iOS which is not allowing to upload app on app Store

it is working fine on android devices and iOS simulators but when I'm running it on iOS devices it gives the following thread:
this is my console output:

2021-09-07 11:26:15.652435+0100 Runner[19614:1966095] [Assert] Unsupported use of UIKit API off the main thread: UIAccessibilityIsAssistiveTouchRunning()
2021-09-07 11:26:15.652558+0100 Runner[19614:1966095] [Assert] Unsupported use of UIKit API off the main thread: UIAccessibilityIsGuidedAccessEnabled()

Fatal Exception: java.lang.NullPointerException

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'void io.flutter.plugin.common.MethodChannel.invokeMethod(java.lang.String, java.lang.Object)' on a null object reference
at com.github.contactlutforrahman.flutter_qr_bar_scanner.FlutterQrBarScannerPlugin.qrRead(FlutterQrBarScannerPlugin.java:216)
at com.github.contactlutforrahman.flutter_qr_bar_scanner.QrDetector.onSuccess(QrDetector.java:80)
at com.github.contactlutforrahman.flutter_qr_bar_scanner.QrDetector.onSuccess(QrDetector.java:22)
at com.google.android.gms.tasks.zzm.run(com.google.android.gms:play-services-tasks@@18.0.1:1)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:233)
at android.app.ActivityThread.main(ActivityThread.java:7225)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:499)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:962)

Module 'flutter_qr_bar_scanner' not found

hello sir hope you are doing well
sir i have impletement your package and it is working fine in android but when i run on ios device then i get Module 'flutter_qr_bar_scanner' not found although i have set minimum deployement version 11 and i have done flutter clean,podspec.lock delete and pod install multiple times can you please guide me how can i get rid from this problem
Thanks in advance

iOS camera aspect ratio wrong

I tried creating the widget in 2 ways and both show the aspect ratio wrong

// specify fit
QRBarScannerCamera(
  fit: BoxFit.cover,
  onError: (context, error) => <error code>,
  qrCodeCallback: (code) {
    _qrCallback(context, code);
  },
);

// don't specify fit
QRBarScannerCamera(
  onError: (context, error) => <error code>,
  qrCodeCallback: (code) {
    _qrCallback(context, code);
  },
);

Both approaches result in the same output format on the iOS camera:
IMG_0427

Support for torch/flashlight

As the title suggests, is there any plan to open support for this? I don't think other torch libraries can be used when the current camera context is already being captured.

One time app shutdown after granting permission to camera

Hi, I have found the following issue (hopefully it is not caused by my incompetence, in that case, I'm sorry for bothering you): When I access a screen with the scanner for the first time, a permission request pops up. After confirming, the app crashes. However, when I start the app for the second time, everything works well.

Here are logs that appeared after entering the screen before granting the permission:
W/IInputConnectionWrapper(22220): getTextBeforeCursor on inactive InputConnection W/IInputConnectionWrapper(22220): getSelectedText on inactive InputConnection W/IInputConnectionWrapper(22220): getTextAfterCursor on inactive InputConnection W/IInputConnectionWrapper(22220): beginBatchEdit on inactive InputConnection W/IInputConnectionWrapper(22220): endBatchEdit on inactive InputConnection I/cgl.fqs.QrReader(22220): Using new camera API. I/cgl.fqs.QrDetector(22220): Making detector2 for formats: 256 W/DynamiteModule(22220): Local module descriptor class for com.google.android.gms.vision.dynamite.barcode not found. I/DynamiteModule(22220): Considering local module com.google.android.gms.vision.dynamite.barcode:0 and remote module com.google.android.gms.vision.dynamite.barcode:0 D/BarcodeNativeHandle(22220): Cannot load feature, fall back to load whole module. W/DynamiteModule(22220): Local module descriptor class for com.google.android.gms.vision.dynamite not found. W/b.disciplinova(22220): Unsupported class loader W/b.disciplinova(22220): Skipping duplicate class check due to unsupported classloader I/DynamiteModule(22220): Considering local module com.google.android.gms.vision.dynamite:0 and remote module com.google.android.gms.vision.dynamite:2703 I/DynamiteModule(22220): Selected remote version of com.google.android.gms.vision.dynamite, version >= 2703 V/DynamiteModule(22220): Dynamite loader version >= 2, using loadModule2NoCrashUtils I/DynamiteLoaderV2(22220): [71] Dynamitemodulesa W/b.disciplinova(22220): Unsupported class loader W/b.disciplinova(22220): Skipping duplicate class check due to unsupported classloader I/DynamiteModule(22220): Considering local module com.google.android.gms.vision.barcode:0 and remote module com.google.android.gms.vision.barcode:1 I/DynamiteModule(22220): Selected remote version of com.google.android.gms.vision.barcode, version >= 1 I/DynamiteLoaderV2(22220): [71] VisionBarcode.optional W/b.disciplinova(22220): Unsupported class loader W/b.disciplinova(22220): Skipping duplicate class check due to unsupported classloader W/b.disciplinova(22220): Accessing hidden field Ljava/nio/Buffer;->address:J (light greylist, reflection) I/ActivityThread(22220): com.google.android.gms.phenotype acquiringCount 2

And here after granting the permission:
I/cgl.fqs.FlutterQrBarScannerPlugin(22220): Permissions request granted. I/cgl.fqs.FlutterQrBarScannerPlugin(22220): Permissions request granted. D/AndroidRuntime(22220): Shutting down VM E/AndroidRuntime(22220): FATAL EXCEPTION: main E/AndroidRuntime(22220): Process: com.ondrejholub.disciplinovac, PID: 22220 E/AndroidRuntime(22220): java.lang.RuntimeException: Failure delivering result ResultInfo{who=@android:requestPermissions:, request=1, result=-1, data=Intent { act=android.content.pm.action.REQUEST_PERMISSIONS (has extras) }} to activity {com.ondrejholub.disciplinovac/com.example.disciplinovac.MainActivity}: java.lang.NullPointerException: Attempt to read from field 'com.github.contactlutforrahman.flutter_qr_bar_scanner.QrReader com.github.contactlutforrahman.flutter_qr_bar_scanner.FlutterQrBarScannerPlugin$ReadingInstance.reader' on a null object reference E/AndroidRuntime(22220): at android.app.ActivityThread.deliverResults(ActivityThread.java:4382) E/AndroidRuntime(22220): at android.app.ActivityThread.handleSendResult(ActivityThread.java:4424) E/AndroidRuntime(22220): at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:49) E/AndroidRuntime(22220): at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108) E/AndroidRuntime(22220): at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68) E/AndroidRuntime(22220): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1818) E/AndroidRuntime(22220): at android.os.Handler.dispatchMessage(Handler.java:106) E/AndroidRuntime(22220): at android.os.Looper.loop(Looper.java:193) E/AndroidRuntime(22220): at android.app.ActivityThread.main(ActivityThread.java:6762) E/AndroidRuntime(22220): at java.lang.reflect.Method.invoke(Native Method) E/AndroidRuntime(22220): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) E/AndroidRuntime(22220): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) E/AndroidRuntime(22220): Caused by: java.lang.NullPointerException: Attempt to read from field 'com.github.contactlutforrahman.flutter_qr_bar_scanner.QrReader com.github.contactlutforrahman.flutter_qr_bar_scanner.FlutterQrBarScannerPlugin$ReadingInstance.reader' on a null object reference E/AndroidRuntime(22220): at com.github.contactlutforrahman.flutter_qr_bar_scanner.FlutterQrBarScannerPlugin.stopReader(FlutterQrBarScannerPlugin.java:73) E/AndroidRuntime(22220): at com.github.contactlutforrahman.flutter_qr_bar_scanner.FlutterQrBarScannerPlugin.onRequestPermissionsResult(FlutterQrBarScannerPlugin.java:60) E/AndroidRuntime(22220): at io.flutter.embedding.engine.FlutterEnginePluginRegistry$FlutterEngineActivityPluginBinding.onRequestPermissionsResult(FlutterEnginePluginRegistry.java:612) E/AndroidRuntime(22220): at io.flutter.embedding.engine.FlutterEnginePluginRegistry.onRequestPermissionsResult(FlutterEnginePluginRegistry.java:356) E/AndroidRuntime(22220): at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onRequestPermissionsResult(FlutterActivityAndFragmentDelegate.java:509) E/AndroidRuntime(22220): at io.flutter.embedding.android.FlutterActivity.onRequestPermissionsResult(FlutterActivity.java:611) E/AndroidRuntime(22220): at android.app.Activity.dispatchRequestPermissionsResult(Activity.java:7608) E/AndroidRuntime(22220): at android.app.Activity.dispatchActivityResult(Activity.java:7458) E/AndroidRuntime(22220): at android.app.ActivityThread.deliverResults(ActivityThread.java:4375) E/AndroidRuntime(22220): ... 11 more I/Process (22220): Sending signal. PID: 22220 SIG: 9 Lost connection to device.

The scanner part of my source code (_camState sets true on initState):

SizedBox(
  width: 300,
  height: 300,
  child: _camState ?
           QRBarScannerCamera(
             notStartedBuilder: (BuildContext context){
               return Text('Loading...');
             },
             onError: (context, error) => Text(
               error.toString(),
               style: TextStyle(color: Colors.red),
             ),
             formats: [BarcodeFormats.QR_CODE],
             qrCodeCallback: (code){
                . . .
             });
           }
         )
         :
         Text('Wait')
         )

Is there any existing solution I'm missing out, or is it a real issue? Thanks!

so many repeat errors, how to avoid

Describe the bug
there are so many following errors repeatly :
I/GRALLOC (31642): LockFlexLayout: baseFormat: 11, yStride: 1280, ySize: 921600, uOffset: 921600, uStride: 1280

To Reproduce
when QRBarScannerCamera get called .

Logs
I/GRALLOC (31642): LockFlexLayout: baseFormat: 11, yStride: 1280, ySize: 921600, uOffset: 921600, uStride: 1280
I/GRALLOC (31642): LockFlexLayout: baseFormat: 11, yStride: 1280, ySize: 921600, uOffset: 921600, uStride: 1280
I/GRALLOC (31642): LockFlexLayout: baseFormat: 11, yStride: 1280, ySize: 921600, uOffset: 921600, uStride: 1280
I/GRALLOC (31642): LockFlexLayout: baseFormat: 11, yStride: 1280, ySize: 921600, uOffset: 921600, uStride: 1280
I/GRALLOC (31642): LockFlexLayout: baseFormat: 11, yStride: 1280, ySize: 921600, uOffset: 921600, uStride: 1280
I/GRALLOC (31642): LockFlexLayout: baseFormat: 11, yStride: 1280, ySize: 921600, uOffset: 921600, uStride: 1280
I/GRALLOC (31642): LockFlexLayout: baseFormat: 11, yStride: 1280, ySize: 921600, uOffset: 921600, uStride: 1280
I/GRALLOC (31642): LockFlexLayout: baseFormat: 11, yStride: 1280, ySize: 921600, uOffset: 921600, uStride: 1280
I/GRALLOC (31642): LockFlexLayout: baseFormat: 11, yStride: 1280, ySize: 921600, uOffset: 921600, uStride: 1280

Environment (please complete the following information):
] Android 9
Nexus 6
barcode_scan: ^3.0.1
Flutter 1.22.0-10.0.pre.87

Additional context
Flutter doctor :
/Users/amr/Dev/flutter/bin/flutter doctor --verbose
[✓] Flutter (Channel master, 1.22.0-10.0.pre.87, on Mac OS X 10.15.6 19G2021, locale en-SA)
• Flutter version 1.22.0-10.0.pre.87 at /Users/amr/Dev/flutter
• Framework revision 4732a214a7 (5 days ago), 2020-09-04 21:05:02 -0400
• Engine revision ac8b9c4c52
• Dart version 2.10.0 (build 2.10.0-86.0.dev)

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at /Users/amr/Library/Android/sdk
• Platform android-29, build-tools 29.0.2
• ANDROID_HOME = /Users/amr/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.7)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.7, Build version 11E801a
• CocoaPods version 1.8.4

[✓] Android Studio (version 4.0)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 49.0.2
• Dart plugin version 193.7547
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

[✓] Connected device (2 available)
• JSN L22 (mobile) • GBT4C18A26003173 • android-arm64 • Android 10 (API 29)
• AOSP on IA Emulator (mobile) • emulator-5554 • android-x86 • Android 9 (API 28) (emulator)

• No issues found!
Process finished with exit code 0

Android auto focus does not work

I'm using an Android8.1 Kyocera Torque G03 (Japan) phone, and the focal length does not seem to update after starting the barcode scan preview.

The QRCameraC2 camera class is what gets used, with afMode being set to 3 (CONTROL_AF_MODE_CONTINUOUS_VIDEO).

I believe the issue is with the CONTROL_AF_TRIGGER settings done in startCamera.

if (afMode == CONTROL_AF_MODE_AUTO) {
    previewBuilder.set(CaptureRequest.CONTROL_AF_TRIGGER, CaptureRequest.CONTROL_AF_TRIGGER_START);
} else {
    previewBuilder.set(CaptureRequest.CONTROL_AF_TRIGGER, CaptureRequest.CONTROL_AF_TRIGGER_CANCEL);
}

According to the Android docs

Generally, applications should set this entry to START or CANCEL for only a single capture, and then return it to IDLE (or not set at all). Specifying START for multiple captures in a row means restarting the AF operation over and over again.

While the wording here leaves a bit up to interpretation, I believe the two options being suggested are:

  1. set this entry (CONTROL_AF_TRIGGER) to START or CANCEL for only a single capture, and then return it to IDLE
  2. do not set (CONTROL_AF_TRIGGER) at all

I have removed the above lines setting CaptureRequest.CONTROL_AF_TRIGGER on previewBuilder, and the problem seems to be resolved (option 2, not setting CONTROL_AF_TRIGGER at all). If you'd like a pull request, I'll be happy to create one.

Looking at the Camera plugin, they seem to go with option 1.

scanner bug

hi , i try to run example project it runs correctly but it can not scan any bar or qr codes
Annotation 2020-08-25 163809

Strange behavior on Xiaomi mi max2

When I use Xiaomi Redmi note 7 and mi 9t pro - plugin works fine, but on Xiaomi mi max2 result below:
Camera:

flutter_qr_bar_scanner:

Hot Restart (and likely any reuse of the widget) causes platform exception

I've added this widget as a full screen camera/scanner using the following constructor:

QRBarScannerCamera(
  fit: BoxFit.cover,
  onError: (context, error) => Center(
    child: Padding(
      padding: const EdgeInsets.all(40),
      child: Text(
        error.toString(),
        style: TextStyle(color: Colors.red),
      ),
    ),
  ),
  qrCodeCallback: (code) {
    if (!_isCoolingDown) {
      _qrCallback(context, code);
    }
  },
);

It opens the camera and I can scan barcodes successfully, however if I hit SHIFT + R to Hot Restart I get the following platform exception, is there any way to dispose this and/or stop the camera to avoid this exception?
IMG_0429

Low resolution cameras

I've been writing an app that scans barcodes, and realized the results aren't reliable when scanning on devices with really low camera resolution (sub 8mp). Any suggestions on what I can do to increase the scanning reliability on such devices?

Widget w/ AnimatedOpacity- always running

Hi all...i'm hoping for some advice. I'm attempting to use this widget within an AnimatedOpacity (that triggers when it was intended to be scanning...) and that is initially not visible (and i thought would be not active). However, it is still reading QR codes "behind the scenes" triggering the callback even when widget is not visible, nor should be scanning.

Is there a better way to be triggering this (i can stop the reader in a postFrameCallback after the initial build, but don't successfully get it restarted.

any advice or recommendations from others on how to better handle this usage that may be started and stopped?

podspec syntax error

Got this syntax error while pod install on mac

it was needed to edit the file to proceed with the pod install

aa

Package contains UIWebView - Depreciated

When i try to publish my app with this package i get this error ->

ITMS-90809: Deprecated API Usage - New apps that use UIWebView are no longer accepted. Instead, use WKWebView for improved security and reliability.

Will this be fixed or patched ?

Thanks

MissingPluginException - IOS

[!] Failed to load 'flutter_qr_bar_scanner' podspec:
[!] Invalid flutter_qr_bar_scanner.podspec file: syntax error, unexpected tIDENTIFIER, expecting end
...g QR & Bar codes using Google's Mobile Vision API'

Possible conflict with ml_kit and Image Recognition

Once we added in the google_ml_kit dependency and started to use Image Recognition the barcode reader stopped working. It shows camera preview but it will not detect any QR code.

I also found there is different meta options mlkit vs gms in AndroidManifest - what is the proper way to override this in our Manifest?

 <meta-data
                android:name="com.google.mlkit.vision.DEPENDENCIES"
                android:value="ica,barcode,ocr"
                tools:replace="android:value" />

            <meta-data
                android:name="com.google.android.gms.vision.DEPENDENCIES"
                android:value="ica,barcode,ocr"
                tools:replace="android:value" />

not working on any device!

I try to run on Xiaomi Redmi 8 and not find any QR code or Barcode but on Huawei y9 device or Nexus 5 emulator is working...

Outdated dependency for Flutter 2.+

Hi,
latest version of flutter_qr_bar_scanner (1.0.2) depends on al old version of native_device_orientation (0.3.0) wich cause issues on build with Flutter 2.+.

Thanks a lot

Hi! Questions about the capture area

Your package is simply fantastic, but I couldn't identify how to limit a capture area, in the case of 2 codes on the same page, capture the first one that the camera identifies, wherever it is. Would it be possible to limit the catch area?

QrDetector Exception

Production version apk released to google play throws an exception:

Fatal Exception: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/mlkit/vision/barcode/Barcode;
       at com.github.contactlutforrahman.flutter_qr_bar_scanner.QrDetector.onSuccess(QrDetector.java:14)
       at com.github.contactlutforrahman.flutter_qr_bar_scanner.QrDetector.onSuccess(QrDetector.java:2)
       at com.google.android.gms.tasks.zzm.run(zzm.java:25)
       at android.os.Handler.handleCallback(Handler.java:938)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loop(Looper.java:236)
       at android.app.ActivityThread.main(ActivityThread.java:7889)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:600)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:967)

Versions:

flutter_qr_bar_scanner: ^3.0.2
google_ml_kit: ^0.9.0

Capture area support?

Hello,

Is there any way i can use the full screen camera, but limit the capture area to a smaller rectangle. This would be very useful when trying to scan a single code out from many.

Android V2 Embedding

The plugin flutter_qr_bar_scanner uses a deprecated version of the Android embedding.
To avoid unexpected runtime failures or future build failures, try to see if this plugin supports the Android V2 embedding. Otherwise, consider removing it since a future release of Flutter will remove these deprecated APIs.
If you are a plugin author, take a look at the docs for migrating the plugin to the V2 embedding.

Stop scanning & restart camera

Is there a way I could stop & restart the camera?
For example the stop method is exposed and we can do:
FlutterQrReader.stop()

How can I start the camera again?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.