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

Longer bar code renders outside canvas #17

Open
bruceanwyl opened this issue Oct 5, 2019 · 1 comment
Open

Longer bar code renders outside canvas #17

bruceanwyl opened this issue Oct 5, 2019 · 1 comment

Comments

@bruceanwyl
Copy link

bruceanwyl commented Oct 5, 2019

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.

@v0l
Copy link
Contributor

v0l commented Oct 10, 2019

Put the BarCodeImage in a FittedBox and it will scale the barcode to your width constraints, otherwise i agree, it should use constraints to find out how much space it can use, if its not enough space it should produce an overflow like Text widget

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

No branches or pull requests

2 participants