Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not close the scanning activity after every scan. #18

Closed
Baileypollard opened this issue Jun 26, 2019 · 27 comments
Closed

Do not close the scanning activity after every scan. #18

Baileypollard opened this issue Jun 26, 2019 · 27 comments
Labels
Android enhancement New feature or request iOS The issue persist in iOS only resolved The issue has been addressed in latest release.

Comments

@Baileypollard
Copy link

Is your feature request related to a problem? Please describe.
My customers need a way to scan products quickly, thus meaning that they need the activity to stay open after a scan has happened so that they can scan the next item.

Describe the solution you'd like
Give an optional parameter for closing the scan activity after every scan.

Describe alternatives you've considered
None that I can think of.

Additional context
None.

@Baileypollard Baileypollard added the enhancement New feature or request label Jun 26, 2019
@AmolGangadhare
Copy link
Owner

Thanks for using the plugin.
That's a good idea to have continuous scanning. First will have to go through that if it is possible to make continuous streaming from native to dart. I'll update you on this soon.

@Baileypollard
Copy link
Author

Baileypollard commented Jul 5, 2019

@AmolGangadhare Why not just handle the scanning through a dart camera widget of some sort, that way all the camera view can be added directly in the dart code?

@AmolGangadhare
Copy link
Owner

hi, the plugin has been updated with continuous scan support. Please try it out and provide your feedback. Thanks

@AmolGangadhare AmolGangadhare added the awaiting-response Waiting for user response label Jul 10, 2019
@afornes
Copy link

afornes commented Jul 17, 2019

I've tried continuous scan on Android. It opens the viewer but never finds any barcode. I've tried it on a OnePlus 5T phone

@AmolGangadhare
Copy link
Owner

AmolGangadhare commented Jul 19, 2019

@afornes thanks for using the plugin. It scans continuously whenever a barcode is detected. Is there any error logs?

@afornes
Copy link

afornes commented Jul 19, 2019

@AmolGangadhare There are no errors. I've set breakpoints and also prints inside the "listen" callback and they are never triggered

@AmolGangadhare
Copy link
Owner

sounds weird, give me some time to figure it out. One more thing, is that specific to a QR code or barcode? can you provide a sample you are referring(if possible)?

@afornes
Copy link

afornes commented Jul 19, 2019

I'm trying to scan an EAN13 barcode. This is the code I'm trying to scan: 8434506077280
Generated with this tool.

I've tried using other libraries and it works fine

@AmolGangadhare
Copy link
Owner

@afornes thanks for details, I'm looking into it and will update you shortly on this.

@AmolGangadhare
Copy link
Owner

AmolGangadhare commented Jul 19, 2019

@afornes it was a threading issue in the plugin bridge. unfortunately, I missed this. I've made a fix to this. Will test it thoroughly, and upload the latest version to the pub shortly. Thanks for helping to improve this plugin.

@AmolGangadhare AmolGangadhare removed the awaiting-response Waiting for user response label Jul 19, 2019
@AmolGangadhare
Copy link
Owner

plugin 0.1.3 is uploaded with issue fix.

@troncomputers
Copy link

Hi.
Is there a chance to show dialog on every barcode found with TextField for quantity? I'm trying to fire showDialog() inside getBarcodeStreamReceiver("#ff6666", "Cancel", true).listen((barcode) {} but it's openning only after I click Cancel, not during scanning.

@irperera
Copy link

irperera commented Sep 5, 2019

can someone point me in the right direction? I need to know how to use the continuous scan.

@AmolGangadhare
Copy link
Owner

Hi.
Is there a chance to show dialog on every barcode found with TextField for quantity? I'm trying to fire showDialog() inside getBarcodeStreamReceiver("#ff6666", "Cancel", true).listen((barcode) {} but it's openning only after I click Cancel, not during scanning.

Sorry for the late reply.

Showing an alert dialog in getBarcodeStreamReceiver won't work well.
This has to be done in plugin code.

@troncomputers
Copy link

@irperera
I did a quick workaround

var barcode = await _searchByBarcode();
while (barcode.isNotEmpty) {
    barcode = await _searchByBarcode();
});
Future<String> _searchByBarcode() async {
String barcodeScanRes;
try {
      barcodeScanRes = await FlutterBarcodeScanner.scanBarcode("#ff6666", "Anuluj", true);
} on PlatformException {
        barcodeScanRes = 'Failed to get platform version.';
      }
    return barcodeScanRes;
  }

@AmolGangadhare
Copy link
Owner

For continuous scan, there is a method getBarcodeStreamReceiver. It will return continuous barcode stream until user press cancel button.

FlutterBarcodeScanner.getBarcodeStreamReceiver("#ff6666", "Cancel", false)
         .listen((barcode) { 
         /// barcode to be used
         });

@troncomputers
Copy link

@AmolGangadhare
I can't use getBarcodeStreamReceiver in my case, because I am asking a user for an amount of read products.

@AmolGangadhare
Copy link
Owner

Ok.
After the platform views become stable we can embed the barcode scanning screen in the app itself.

@irperera
Copy link

irperera commented Sep 5, 2019

@troncomputers
I got the scan to work,

Future<void> startBarcodeScanStream() async {
    FlutterBarcodeScanner.getBarcodeStreamReceiver("#ed0001", "Done", false)
        .listen((barcode) {
      _scanBarcode = barcode;
      setState(() {
        codes.add(_scanBarcode);
      });
    });
  }

how can I prompt the user that they are actually scanning.

@troncomputers
Copy link

@irperera
That is why I used FlutterBarcodeScanner.scanBarcode() in a while loop. There is no "found barcode" event In getBarcodeStreamReceiver.

@irperera
Copy link

irperera commented Sep 6, 2019

@troncomputers

thanks, I need continuous scanning, can you show me how to do that.

thanks again.

@troncomputers
Copy link

I did show you and you gave me "thumbs up" 🤔
Continuous scanning in this thread

@irperera
Copy link

irperera commented Sep 6, 2019

thanks I'll try it

@irperera
Copy link

irperera commented Sep 6, 2019

@troncomputers
where in the code you put the dialog?

@troncomputers
Copy link

@irperera
I have a button to initialize scanning

@AmolGangadhare
Copy link
Owner

This feature has been included in the plugin so closing this.

@AmolGangadhare AmolGangadhare added resolved The issue has been addressed in latest release. iOS The issue persist in iOS only Android labels Jan 10, 2020
@waseemsourcecode
Copy link

Hello I’m using your plugin and it works very well but there is one thing missing that’s is the auto closing it mean what if I want to wait for the result maybe for 10 sec and if it’s not found then I want to close the scanner but I’m unable to close it without pressing cancel button so can you fix that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Android enhancement New feature or request iOS The issue persist in iOS only resolved The issue has been addressed in latest release.
Projects
Development

No branches or pull requests

6 participants