simple_barcode_scanner
simple_barcode_scanner copied to clipboard
Select front camera as default in the barcode scanner
As a developer, I want to make the front camera the default one.
can we select front camera as default??
Yes, you can set the front camera as the default when scanning barcodes using SimpleBarcodeScanner. Just set cameraFace: CameraFace.front in your scan configuration. Here's an example
String? barcodeScanRes = await SimpleBarcodeScanner.scanBarcode(
context,
barcodeAppBar: BarcodeAppBar(
appBarTitle: S.of(context).scanBarcode,
centerTitle: true,
enableBackButton: true,
backButtonIcon: const Icon(Icons.keyboard_double_arrow_right_rounded),
),
isShowFlashIcon: true,
delayMillis: 0,
cameraFace: CameraFace.front, // Set front camera as default
scanFormat: ScanFormat.ONLY_BARCODE,
scanType: ScanType.barcode,
lineColor: '#FF0000',
cancelButtonText: S.of(context).close,
);
Thank @MostafaSensei106 for your comment, I am not sure how I missed closing this issue, but I am closing now.