|
|
@ -37,6 +37,7 @@ class ReaderWidget extends StatefulWidget { |
|
|
|
this.scanDelaySuccess = const Duration(milliseconds: 1000), |
|
|
|
this.scanDelaySuccess = const Duration(milliseconds: 1000), |
|
|
|
this.cropPercent = 0.5, // 50% of the screen |
|
|
|
this.cropPercent = 0.5, // 50% of the screen |
|
|
|
this.resolution = ResolutionPreset.high, |
|
|
|
this.resolution = ResolutionPreset.high, |
|
|
|
|
|
|
|
this.lensDirection = CameraLensDirection.back, |
|
|
|
this.loading = |
|
|
|
this.loading = |
|
|
|
const DecoratedBox(decoration: BoxDecoration(color: Colors.black)), |
|
|
|
const DecoratedBox(decoration: BoxDecoration(color: Colors.black)), |
|
|
|
}); |
|
|
|
}); |
|
|
@ -111,6 +112,9 @@ class ReaderWidget extends StatefulWidget { |
|
|
|
/// Camera resolution |
|
|
|
/// Camera resolution |
|
|
|
final ResolutionPreset resolution; |
|
|
|
final ResolutionPreset resolution; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// Camera lens direction |
|
|
|
|
|
|
|
final CameraLensDirection lensDirection; |
|
|
|
|
|
|
|
|
|
|
|
/// Delay between scans when a code is detected, will be ignored if isMultiScan is true |
|
|
|
/// Delay between scans when a code is detected, will be ignored if isMultiScan is true |
|
|
|
final Duration scanDelaySuccess; |
|
|
|
final Duration scanDelaySuccess; |
|
|
|
|
|
|
|
|
|
|
@ -158,7 +162,11 @@ class _ReaderWidgetState extends State<ReaderWidget> |
|
|
|
setState(() { |
|
|
|
setState(() { |
|
|
|
this.cameras = cameras; |
|
|
|
this.cameras = cameras; |
|
|
|
if (cameras.isNotEmpty) { |
|
|
|
if (cameras.isNotEmpty) { |
|
|
|
selectedCamera = cameras.first; |
|
|
|
selectedCamera = cameras.firstWhere( |
|
|
|
|
|
|
|
(CameraDescription camera) => |
|
|
|
|
|
|
|
camera.lensDirection == widget.lensDirection, |
|
|
|
|
|
|
|
orElse: () => cameras.first, |
|
|
|
|
|
|
|
); |
|
|
|
onNewCameraSelected(selectedCamera); |
|
|
|
onNewCameraSelected(selectedCamera); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|