-
-
Notifications
You must be signed in to change notification settings - Fork 34
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
Scanner Crash while Opening #84
Comments
Hi @ravi-uleeco Thanks for creating an issue. can you share your code with 3 back ticks for easy to read you code. it's best to use 3 back ticks with multi-line code. See https://www.markdownguide.org/extended-syntax/#syntax-highlighting It would also be helpful if you shared console logs. Device android version no: |
Can you please run the above code in Flutter you will get the idea bro. Don't have time to do this "share your code with 3 back ticks for easy to read you code". Device Name: Samsung M-315F |
Hi @ravi-uleeco, |
Add controller.stop(); on onDetect: (capture) {} & also try using canPop: false or true. |
Sometimes, the app scanner crashes. Can you guide me if anything I'm doing wrong?
This is my code:
`import 'package:ai_barcode_scanner/ai_barcode_scanner.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
class ScanBarcodePage extends GetView {
const ScanBarcodePage({super.key});
@OverRide
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.transparent,
body: _buildBody(context),
);
}
Widget _buildBody(BuildContext context) {
return Stack(
children: [
_scanView(context),
SizedBox(
width: MediaQuery.of(context).size.width,
child: SafeArea(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(
height: MediaQuery.of(context).size.height * 0.45,
),
const Text(
"Align barcode in frame to scan",
style: CTAppTextStyles.pageSmallTextStyle,
),
],
),
),
),
SafeArea(
child: Align(
alignment: Alignment.topCenter,
child: SizedBox(
height: 50,
child: Stack(
children: [
const Center(
child: Text(
"Scan Barcode",
style: TextStyle(color: CTColor.white),
),
),
IconButton(
onPressed: () {
Get.back();
},
icon: const Icon(
Icons.arrow_back_ios_new,
),
iconSize: 15,
),
],
),
),
),
)
],
);
}
Widget _scanView(BuildContext context) {
return AiBarcodeScanner(
onScan: (value) {
debugPrint("value: $value");
},
onDetect: (capture) {
final List barcodes = capture.barcodes;
for (final barcode in barcodes) {
debugPrint('Barcode found! ${barcode.rawValue}');
}
},
controller: MobileScannerController(
detectionSpeed: DetectionSpeed.noDuplicates,
),
bottomBar: Container(
height: 0,
width: Size.infinite.width,
color: Colors.transparent,
),
);
}
}
`
The text was updated successfully, but these errors were encountered: