-
-
Notifications
You must be signed in to change notification settings - Fork 90
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
Delay the scanning #34
Comments
For now no, there is no such API, but what you just said make sense. I will probably add another field for delay. |
Thanks for your prompt reply. I'm new to flutter and I need this kind of logic in my project, can you suggest any alternative solution/idea for this? |
yes. that is what i just want to suggest too. |
The underlying package that I used for simple_barcode_scanner does not support same feature as well. either I will have to look into native code or retry with different native package. |
To introduce a delay in the processing of the barcode scan results, you can modify the stream that you receive from the getBarcodeStreamReceiver method. Since Dart streams don't have a built-in delay between events, you will need to create a new Stream and manage the timing yourself. Here's an updated version of your getBarcodeStreamReceiver method that introduces a delay between scan results: dart // ... (rest of your imports) class FlutterBarcodeScanner { static Stream? getBarcodeStreamReceiver(
} Remember, this approach assumes that scans won't come in more often than the delay; otherwise, they will start to stack up. If you need to handle scans more frequently than the delay, you will have to implement additional logic to decide which scans to keep or discard.....from chatGPT |
another answer from chatGPT.. If you want to introduce a delay before the barcode scanning begins, you will need to delay the display of the barcode scanning UI. You can achieve this by using a Future.delayed in combination with a Timer to start the scanning process after a specified delay. Here is an example of how you could introduce a delay before the scanner starts: dart // ... (rest of your imports) class SimpleBarcodeScannerPage extends StatefulWidget { const SimpleBarcodeScannerPage({ @OverRide class _SimpleBarcodeScannerPageState extends State { @OverRide @OverRide
} The scanner UI will only be built if isDelayOver is true, ensuring that there is a pause before the scanning starts. Adjust the duration in Duration(seconds: 1) to set how long the delay should be. |
I see you have shared updated code for FlutterBarcodeScanner as well. Since flutter_barcode_scanner is too old. I was planning to use different package but if this is working I will update same package or you can create PR on same. Thanks |
@CodingWithTashi |
Hi @ramaatamai , Thanks for using our package. I have added delay for android for now, Please note that I am working on ios now. It may take time since I don't have resource to test out myself. Will keep this issue posted |
@CodingWithTashi Thanks for the reply ,Once iOS completed let us know. |
Hi @ramaatamai Issue fixed #74, closing now |
@CodingWithTashi Thanks for reply |
@CodingWithTashi Did you release the latest version of simple barcode scanner? |
Yes, this issue is closed now. |
@CodingWithTashi If we scanning half Barcode in Android Qr page closed, But in IOS we scan half Barcode screen is not closing .We need to scan full qr code . Why different behaviour. |
I believe you are referring to this issue #78. Please track it here |
@CodingWithTashi Yes and one more i want the scanner in landscape only. |
@CodingWithTashi SystemChrome.setPreferredOrientations([
|
Hi, is that possible to delay the scanning? Like i dont want the to scan immediately after the function is call. Instead, i want it to wait for few second for the end user to hold for the right position, otherwise it the possibility of scanning wrong barcode in bunch of barcode is very high.
The text was updated successfully, but these errors were encountered: