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

Leading zeroes in barcodes are truncated #54

Closed
chukwumaokere opened this issue Nov 18, 2019 · 7 comments
Closed

Leading zeroes in barcodes are truncated #54

chukwumaokere opened this issue Nov 18, 2019 · 7 comments
Labels
awaiting-response Waiting for user response

Comments

@chukwumaokere
Copy link

Describe the bug
Whenever I scan a barcode like this:
image
The result that gets printed is only the digits after the leading zeroes.

To Reproduce
Steps to reproduce the behavior:

  1. Go to the barcode scanner app
  2. Scan the barcode attached
  3. Check result

Expected behavior
When the barcode is scanned, the value should be 00002408, not 2408.

Smartphone (please complete the following information):

  • Device: iPhone 7
  • OS: 13

Additional context
I take the value and I run these functions:

...

sBarcode(someVal) async {
  String bCode = await FlutterBarcodeScanner.scanBarcode("#ff6666", "Cancel", true);
  print(bCode);
  someVal.enterBarcode(bCode);
  return;
}
...
enterBarcode(barc) {
  flutterWebViewPlugin.evalJavascript(`document.getElementById('barcodenumber').value="${barc}";`);
  }
@irperera
Copy link

interesting, for me it adds a extra 0. hmm

@AmolGangadhare
Copy link
Owner

Hi @chukwumaokere

I've checked the barcode, it is working fine. I've tested it on iPhone 8 plus (13.2.2).

One more thing,

sBarcode(someVal) async {
  String bCode = await FlutterBarcodeScanner.scanBarcode("#ff6666", "Cancel", true);
  print(bCode);    -> What does it print?
  someVal.enterBarcode(bCode);
  return;
}

Here, in print statement what does it prints?

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

AmolGangadhare commented Nov 26, 2019

@chukwumaokere

I'm not able to reproduce this issue on both Android and iOS.

Are you still facing the same issue?

@chukwumaokere
Copy link
Author

I've modified my code to add the leading zeroes programatically using javascript, since all my barcodes are always 8 digits long, so right now im not necessarily "having" the issue but It would exist if I removed my workaround

@AmolGangadhare
Copy link
Owner

@chukwumaokere Can you post some sample code with which you are facing the issue so that I can try to reproduce this?

@chukwumaokere
Copy link
Author

chukwumaokere commented Nov 30, 2019

Im attaching it
test

This is a barcode type: Interleaved2of5
Whenever I scan this barcode I expect the result to be 00002463 but I'm getting "1331" as a result

Any ideas why?
I've been trying to debug this
You can even test here: https://www.barcodesinc.com/generator/image.php?code=00002463&style=453&type=I25&width=300&height=125&xres=2&font=3

@chukwumaokere
Copy link
Author

Nevermind I've solved the error.
Instead of doing this:

sBarcode(someVal) async {
  String bCode = await FlutterBarcodeScanner.scanBarcode("#ff6666", "Cancel", true);
  print(bCode);
  someVal.enterBarcode(bCode);
  return;
}
...
enterBarcode(barc) {
  flutterWebViewPlugin.evalJavascript(`document.getElementById('barcodenumber').value="${barc}";`);
  }

Do this

sBarcode(someVal) async {
  String bCode = await FlutterBarcodeScanner.scanBarcode("#ff6666", "Cancel", true);
  print(bCode);
  someVal.enterBarcode(bCode);
  return;
}
...
enterBarcode(barc) {
    String js = "document.getElementById('barcodenumber').value='$barc'";
    flutterWebViewPlugin.evalJavascript(js);
	flutterWebViewPlugin.evalJavascript("document.getElementById('barcodenumber').dispatchEvent(event)");
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-response Waiting for user response
Projects
None yet
Development

No branches or pull requests

3 participants