Giter Site home page Giter Site logo

bigship / barcode.flutter Goto Github PK

View Code? Open in Web Editor NEW
59.0 9.0 27.0 169 KB

barcode generate library for Flutter

License: BSD 2-Clause "Simplified" License

Java 0.49% Objective-C 1.02% Dart 97.47% Ruby 1.02%
dart dart-library flutter flutter-package flutter-plugin flutter-widget flutter-examples barcode-generator barcode-images barcode

barcode.flutter's Issues

Barcode not centered

The barcode painter is not centered inside the barcode image as you can see on the image.

screenshot_1543666980

Steps to Reproduce:

BarCodeImage( data: "1234243534557", codeType: BarCodeType.CodeEAN13, lineWidth: 3.0, backgroundColor: Colors.blue, ),

Barcode text paints outside the canvas

If the barcode height is set to 50, the text section is partially painted outside the canvas.
The image below shows Code39 but it happens for all formats.

text outside canvas

Invalid ean8 checksum algorithm

In _drawBarCodeEAN8 checkCode is computed like

    checkCode = 10 - (sum2nd*3+sum3rd) % 10;

If sum in bracets = 0, then checkCode will be 10, then it will throw.

Algorithm should be like analogue to current EAN13 or UPC,

    if ((sum2nd + sum3rd * 3) % 10 == 0) {
      checkCode = 0;
    } else {
      checkCode = 10 - (sum2nd + sum3rd * 3) % 10;
    }

I could not google standard for this. only resources like this

Barcode is rendered outside the canvas

@sooxiaotong FittedBox does not help with this. I've attached a screenshot to show that the barcode width is larger than the width computed by the package. And I am also generationg barcode for code128. I know the _calcCanvasWIdth() should be modified but I would have to invest some time to figure out how to do it.

Anyway, I was hoping the author would provide some direct help. Thanks.

screenshot

Originally posted by @kaciula in #1 (comment)

EAN8 with error

Hi!
I try to display an EAN-8 barcode with value '90311130'.
But I get an exception 'RangeError (index): Invalid value: Not in range 0..9, inclusive: 10'

return Center( child: Container( child: BarCodeImage( data: '90311130', codeType: BarCodeType.CodeEAN8, barHeight: 100.0, hasText: true, onError: (error) { print("Generate barcode failed. error msg: $error"); }, ), ));

Exception:

════════ Exception caught by rendering library ═════════════════════════════════
The following RangeError was thrown during paint():
RangeError (index): Invalid value: Not in range 0..9, inclusive: 10

User-created ancestor of the error-causing widget was
BarCodeImage
lib/pages/mobil_cards.dart:392
When the exception was thrown, this was the stack
#0 List.[] (dart:core-patch/growable_array.dart:147:60)
#1 BarCodePainter._drawBarCodeEAN8
package:barcode_flutter/src/barcode_painter.dart:574
#2 BarCodePainter.paint
package:barcode_flutter/src/barcode_painter.dart:30
#3 RenderCustomPaint._paintWithPainter
package:flutter/…/rendering/custom_paint.dart:528
#4 RenderCustomPaint.paint
package:flutter/…/rendering/custom_paint.dart:566
...
The following RenderObject was being processed when the exception was fired: RenderCustomPaint#74661
RenderObject: RenderCustomPaint#74661
parentData: offset=Offset(5.0, 5.0) (can use size)
constraints: BoxConstraints(w=152.0, h=98.0)
size: Size(152.0, 98.0)
════════════════════════════════════════════════════════════════════════════════

get the result image

I want to a function to enlarge the two-dimensional code picture, so i need to get the two-dimensional code picture object. How can I get it

some barcode can not scan

test to generate two barcode, the sencod can't not scan
new BarCodeItem(type: BarCodeType.Code128, codeStr: "FS23030049234", description: "Code128", hasText: true),
new BarCodeItem(type: BarCodeType.Code128, codeStr: "FS23030049MDUxMQ==", description: "Code128", hasText: true),

barcode

thanks~

Just Scan Barcode

Hello, How can I define the library to just scan barcode, I don't need scan QR in my project.

Code93 barcode has extra bars on the end

Compare the following two barcode images.

The first is identical to that produced by several on-line barcode generators and matches the specification for code93 in wikipedia,
barcode
The second is from this package.
code93 demo

The package generated barcode has two extra solid bars and three extra spaces.
In all other respects, they are identical and both versions scan successfully.

Longer bar code renders outside canvas

This is not the same as #15. That was a miscalculation of the canvas size required to paint the barcode value with the specified line width.

This issue occurs when the barcode widget is contained by a widget that is smaller than the calculated canvas size. In the example below, the barcode is in an Expanded widget between two SizedBox widgets. The code snippet below shows how the border around the canvas is applied.

    return Container(
      padding: EdgeInsets.all(8),
      decoration: BoxDecoration(
        color: Colors.red,
      ),
      child: BarCodeImage(
        data: "62733538535715976",
        codeType: BarCodeType.Code39,
        lineWidth: 2.5,
        barHeight: 150.0,
      ),
    );

long barcode outside canvas

So, rather than this, it would be better if the painter was aware of the actual width of canvas it has to work with and, if the canvas is too small, scale the barcode line width accordingly.

Can't correctly display Code128

There are two issues.

  1. According to your codes, this plugin only display code128B.
    Code128C is compression format if there are only digits
  2. I am trying to take byte array as input instead of string.
    Since code128 can be mixed with code128a/code128B/code128C.
    For example,
    1645907 is code128c with last digit is code128a
    The real raw bytes are 105, 16, 45, 90, 101, 23, 73,106
    101 indicate code128a is used and therefore, 23 represents '7' (not '07' in code128c)

Null safety support

Hi, flutter 2.0 was landed and null safety is stable. Do you have any plan to migrate barcode_flutter to null safety?

Add Image

I need to add to an image ('package: image / image.dart') how can I do it?

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.