DavBfr / dart_barcode

Barcode generation library
https://pub.dev/packages/barcode
Apache License 2.0
134 stars 39 forks source link

BarcodeException drawError looks not user frindly #7

Closed kw2019ltd closed 4 years ago

kw2019ltd commented 4 years ago

hi can you enhance below code to display nicer widget instead of below big red container.

from UI prescriptive its looks not nice, or you can add optional error Builder widget inside Barcode Widget where user can give its own widget to display the error or let the user catch the exception and handle it on its own way.

on BarcodeException catch (error) {
      FlutterError.reportError(FlutterErrorDetails(
        exception: error,
        library: 'Barcode Widget',
      ));

      assert(() {
        drawError(context, offset, error.message);
        return true;
      }());

image

kw2019ltd commented 4 years ago

image

DavBfr commented 4 years ago

This red message will be displayed only in debug mode, in release build it will simply draw nothing and log the error.

You can check that the barcode is correct ahead of time with Barcode.verify() It will throw an exception with an explanation if the barcode cannot be generated.

Check this example.

kw2019ltd commented 4 years ago

Sure will try it.

Small q, regarding upce and upca, in case of upce barcode contain 8 digit somehow i need to convert it to upca that contains 12 digits If i will not do that iam getting barcode exception.

On Mon, May 18, 2020, 23:35 David PHAM-VAN notifications@github.com wrote:

This red message will be displayed only in debug mode, in release build it will simply draw nothing and log the error.

You can check that the barcode is correct ahead of time with Barcode.verify() It will throw an exception with an explanation if the barcode cannot be generated.

Check this example https://github.com/DavBfr/dart_barcode/blob/788f7106c3160af2a645afc8a90b5e6484250e6f/flutter/example/lib/main.dart#L166 .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/DavBfr/dart_barcode/issues/7#issuecomment-630421528, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALJEI6T6IUX7TRQR7BRCNVLRSGLZLANCNFSM4NEMU2GA .

DavBfr commented 4 years ago

Yes, you cannot print anything with UPC E, it's really a compressed representation of UPC A with strict rules.

kw2019ltd commented 4 years ago

Yes so if I have upce code how i can show barcode widget do i need to convert it to upca? And show upca widget?

On Tue, May 19, 2020, 00:43 David PHAM-VAN notifications@github.com wrote:

Yes, you cannot print anything with UPC E, it's really a compressed representation of UPC A with strict rules.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/DavBfr/dart_barcode/issues/7#issuecomment-630450655, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALJEI6SALXR22542XMYFVSTRSGTXBANCNFSM4NEMU2GA .

DavBfr commented 4 years ago

we can add a method to convert upce to upca.

kw2019ltd commented 4 years ago

Can you do that as part of the plugin?

On Tue, May 19, 2020, 01:03 David PHAM-VAN notifications@github.com wrote:

we can add a method to convert upce to upca.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/DavBfr/dart_barcode/issues/7#issuecomment-630458130, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALJEI6X6EGW3HQCVOI43BL3RSGWBNANCNFSM4NEMU2GA .

DavBfr commented 4 years ago

There you are, version 1.10.0. Don't hesitate to Buy Me A Coffee.

kw2019ltd commented 4 years ago

worked like a charm.

what is you bitcoin address

On Tue, May 19, 2020 at 4:02 AM David PHAM-VAN notifications@github.com wrote:

There you are, version 1.10.0. Don't hesitate to Buy Me A Coffee https://www.buymeacoffee.com/JORBmbw9h .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/DavBfr/dart_barcode/issues/7#issuecomment-630513946, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALJEI6RA4TJ4LH7XOFBLBS3RSHLC7ANCNFSM4NEMU2GA .

DavBfr commented 4 years ago

Here is my address: 1277Vtm81fXmyWt8tmQrGQWzcuofumjGtx

kw2019ltd commented 4 years ago

1277Vtm81fXmyWt8tmQrGQWzcuofumjGtx https://blockchair.com/bitcoin/address/1277Vtm81fXmyWt8tmQrGQWzcuofumjGtx 0.00060000 BTCUnspent

done TRX ID: https://blockchair.com/bitcoin/transaction/3583e4962cd2c209da17eb12dcec6ecfb6348af562128777bf3c999fbd80a255

soon you will get it.

On Tue, May 19, 2020 at 2:15 PM David PHAM-VAN notifications@github.com wrote:

Here is my address: 1277Vtm81fXmyWt8tmQrGQWzcuofumjGtx

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/DavBfr/dart_barcode/issues/7#issuecomment-630752777, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALJEI6SYSN2IXU3BTL3AV73RSJS37ANCNFSM4NEMU2GA .

DavBfr commented 4 years ago

Thanks!