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

Make the scan area of on Windows more larger #37

Open
tringuyen53 opened this issue Nov 24, 2023 · 8 comments
Open

Make the scan area of on Windows more larger #37

tringuyen53 opened this issue Nov 24, 2023 · 8 comments

Comments

@tringuyen53
Copy link

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

@CodingWithTashi
Copy link
Owner

@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
Copy link

mogbebs commented Mar 13, 2024

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
Copy link
Author

tringuyen53 commented Mar 13, 2024

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
Copy link

mogbebs commented Mar 13, 2024 via email

@tringuyen53
Copy link
Author

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
Copy link

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
Copy link

jojoneku commented May 7, 2024

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
Copy link

fg0611 commented Jun 12, 2024

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.

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

6 participants