CodingWithTashi / simple_barcode_scanner

Simple Barcode Scanner
https://pub.dev/packages/simple_barcode_scanner
MIT License
45 stars 60 forks source link

Make the scan area of on Windows more larger #37

Open tringuyen53 opened 10 months ago

tringuyen53 commented 10 months ago

Currently, the scan area on windows only suitable for barcode. Can you make it square when we change scanType to ScanType.qr?

CodingWithTashi commented 10 months ago

@tringuyen53 It is little more complicated then just setting ScanType.qr since It uses different mechanism for web and mobiles. I will look into it.

mogbebs commented 6 months ago

Hi tringuyen53, where you able to get the scanner to work on desktop app? The camera opens for mine but nothing at all happens when I put my QRCode in front of the camera to read. Where you able to solve this?

Please let me know

tringuyen53 commented 6 months ago

Hi tringuyen53, where you able to get the scanner to work on desktop app? The camera opens for mine but nothing at all happens when I put my QRCode in front of the camera to read. Where you able to solve this?

Please let me know

I think because of the scanning area is a bit small, I have to fork the repo to adjust the scanning area and it works for me. You can try editting the barcode.html the qrbox part.

mogbebs commented 6 months ago

Where in the code do I charge the scanning area please?

Thanks

On Wed, Mar 13, 2024, 16:30 Tri Nguyen Duong @.***> wrote:

Hi tringuyen53, where you able to get the scanner to work on desktop app? The camera opens for mine but nothing at all happens when I put my QRCode in front of the camera to read. Where you able to solve this?

Please let me know

I think because of the scanning area is a bit small, I have to folk the repo to adjust the scanning area and it works for me.

— Reply to this email directly, view it on GitHub https://github.com/CodingWithTashi/simple_barcode_scanner/issues/37#issuecomment-1994668654, or unsubscribe https://github.com/notifications/unsubscribe-auth/AK4FUFEDH5NWRK4MNYCHSU3YYBWGTAVCNFSM6AAAAAA7Y57SQ6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOJUGY3DQNRVGQ . You are receiving this because you commented.Message ID: @.***>

tringuyen53 commented 6 months ago

Where in the code do I charge the scanning area please? Thanks On Wed, Mar 13, 2024, 16:30 Tri Nguyen Duong @.> wrote: Hi tringuyen53, where you able to get the scanner to work on desktop app? The camera opens for mine but nothing at all happens when I put my QRCode in front of the camera to read. Where you able to solve this? Please let me know I think because of the scanning area is a bit small, I have to folk the repo to adjust the scanning area and it works for me. — Reply to this email directly, view it on GitHub <#37 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AK4FUFEDH5NWRK4MNYCHSU3YYBWGTAVCNFSM6AAAAAA7Y57SQ6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOJUGY3DQNRVGQ . You are receiving this because you commented.Message ID: @.>

https://github.com/CodingWithTashi/simple_barcode_scanner/blob/main/lib/assets/barcode.html You can try to change line 45,46. The width height of the qrbox

zoenie123 commented 5 months ago

Actually this should be default behaviour that you can set the parameters of the scan area. It's much too small for scanning QR codes with web camera on some devices. Here is some generated (unreviewed) code from ChatGPT, I hope one day something like this will get implemented into the library.

First, define parameters in your Dart code

class BarcodeScanner extends StatelessWidget {
  // Other code...

  final int qrBoxWidth;
  final int qrBoxHeight;

  const BarcodeScanner({
    Key? key,
    // Other parameters...
    required this.qrBoxWidth,
    required this.qrBoxHeight,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    // Other code...
  }
}

Then, pass these parameters to the HTML code embedded in the iframe

final html.IFrameElement iframe = html.IFrameElement()
  ..src = '${PackageConstant.barcodeFileWebPath}?width=$qrBoxWidth&height=$qrBoxHeight'
  // Other code...

In your HTML code, you need to parse these parameters and use them to configure the size of the scanning area

const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
const qrBoxWidth = parseInt(urlParams.get('width'));
const qrBoxHeight = parseInt(urlParams.get('height'));

const config = {
    fps: 10,
    qrbox: {
        width: qrBoxWidth || 280,
        height: qrBoxHeight || 120,
        aspectRatio: 1.7777778
    }
};
jojoneku commented 4 months ago

Where in the code do I charge the scanning area please? Thanks On Wed, Mar 13, 2024, 16:30 Tri Nguyen Duong @._> wrote: Hi tringuyen53, where you able to get the scanner to work on desktop app? The camera opens for mine but nothing at all happens when I put my QRCode in front of the camera to read. Where you able to solve this? Please let me know I think because of the scanning area is a bit small, I have to folk the repo to adjust the scanning area and it works for me. — Reply to this email directly, view it on GitHub <#37 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AK4FUFEDH5NWRK4MNYCHSU3YYBWGTAVCNFSM6AAAAAA7Y57SQ6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOJUGY3DQNRVGQ . You are receiving this because you commented.Message ID: _@_._>

https://github.com/CodingWithTashi/simple_barcode_scanner/blob/main/lib/assets/barcode.html You can try to change line 45,46. The width height of the qrbox

how do i change this when i am using the plugin from pub. dev

fg0611 commented 3 months ago

Where in the code do I charge the scanning area please? Thanks On Wed, Mar 13, 2024, 16:30 Tri Nguyen Duong @._> wrote: Hi tringuyen53, where you able to get the scanner to work on desktop app? The camera opens for mine but nothing at all happens when I put my QRCode in front of the camera to read. Where you able to solve this? Please let me know I think because of the scanning area is a bit small, I have to folk the repo to adjust the scanning area and it works for me. — Reply to this email directly, view it on GitHub <#37 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AK4FUFEDH5NWRK4MNYCHSU3YYBWGTAVCNFSM6AAAAAA7Y57SQ6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOJUGY3DQNRVGQ . You are receiving this because you commented.Message ID: _@_._>

https://github.com/CodingWithTashi/simple_barcode_scanner/blob/main/lib/assets/barcode.html You can try to change line 45,46. The width height of the qrbox

how do i change this when i am using the plugin from pub. dev

Follow the steps from this guy then just edit the local files. https://www.youtube.com/watch?v=Tms6TUIQVzE&t=311s This guy uses macOS but I use windows so cached packages should be at %LOCALAPPDATA%\Pub\Cache just and paste at dir input.