simple_barcode_scanner icon indicating copy to clipboard operation
simple_barcode_scanner copied to clipboard

Make the scan area of on Windows more larger

Open tringuyen53 opened this issue 1 year ago • 8 comments

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

tringuyen53 avatar Nov 24 '23 10:11 tringuyen53

@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.

CodingWithTashi avatar Nov 24 '23 11:11 CodingWithTashi

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

mogbebs avatar Mar 13 '24 12:03 mogbebs

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.

tringuyen53 avatar Mar 13 '24 15:03 tringuyen53

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: @.***>

mogbebs avatar Mar 13 '24 15:03 mogbebs

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

tringuyen53 avatar Mar 13 '24 16:03 tringuyen53

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
    }
};

zoenie123 avatar May 03 '24 09:05 zoenie123

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

jojoneku avatar May 07 '24 15:05 jojoneku

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.

fg0611 avatar Jun 12 '24 22:06 fg0611