|
|
@ -390,9 +390,7 @@ class _ReaderWidgetState extends State<ReaderWidget> |
|
|
|
child: Row( |
|
|
|
child: Row( |
|
|
|
mainAxisSize: MainAxisSize.min, |
|
|
|
mainAxisSize: MainAxisSize.min, |
|
|
|
children: <Widget>[ |
|
|
|
children: <Widget>[ |
|
|
|
if (widget.showFlashlight && |
|
|
|
if (widget.showFlashlight && _isFlashAvailable) |
|
|
|
isCameraReady && |
|
|
|
|
|
|
|
_isFlashAvailable) |
|
|
|
|
|
|
|
IconButton( |
|
|
|
IconButton( |
|
|
|
onPressed: _onFlashButtonTapped, |
|
|
|
onPressed: _onFlashButtonTapped, |
|
|
|
color: Colors.white, |
|
|
|
color: Colors.white, |
|
|
@ -401,13 +399,13 @@ class _ReaderWidgetState extends State<ReaderWidget> |
|
|
|
controller?.value.flashMode ?? FlashMode.off), |
|
|
|
controller?.value.flashMode ?? FlashMode.off), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
if (widget.showGallery && isCameraReady) |
|
|
|
if (widget.showGallery) |
|
|
|
IconButton( |
|
|
|
IconButton( |
|
|
|
onPressed: _onGalleryButtonTapped, |
|
|
|
onPressed: _onGalleryButtonTapped, |
|
|
|
color: Colors.white, |
|
|
|
color: Colors.white, |
|
|
|
icon: const Icon(Icons.photo_library), |
|
|
|
icon: const Icon(Icons.photo_library), |
|
|
|
), |
|
|
|
), |
|
|
|
if (widget.showToggleCamera && isCameraReady) |
|
|
|
if (widget.showToggleCamera) |
|
|
|
IconButton( |
|
|
|
IconButton( |
|
|
|
onPressed: _onCameraButtonTapped, |
|
|
|
onPressed: _onCameraButtonTapped, |
|
|
|
color: Colors.white, |
|
|
|
color: Colors.white, |
|
|
@ -439,7 +437,7 @@ class _ReaderWidgetState extends State<ReaderWidget> |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void _onFlashButtonTapped() { |
|
|
|
void _onFlashButtonTapped() { |
|
|
|
FlashMode mode = controller!.value.flashMode; |
|
|
|
FlashMode mode = controller?.value.flashMode ?? FlashMode.off; |
|
|
|
if (mode == FlashMode.torch) { |
|
|
|
if (mode == FlashMode.torch) { |
|
|
|
mode = FlashMode.off; |
|
|
|
mode = FlashMode.off; |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -471,6 +469,9 @@ class _ReaderWidgetState extends State<ReaderWidget> |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void _onCameraButtonTapped() { |
|
|
|
void _onCameraButtonTapped() { |
|
|
|
|
|
|
|
if (cameras.isEmpty || controller == null) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
final int cameraIndex = cameras.indexOf(controller!.description); |
|
|
|
final int cameraIndex = cameras.indexOf(controller!.description); |
|
|
|
final int nextCameraIndex = (cameraIndex + 1) % cameras.length; |
|
|
|
final int nextCameraIndex = (cameraIndex + 1) % cameras.length; |
|
|
|
selectedCamera = cameras[nextCameraIndex]; |
|
|
|
selectedCamera = cameras[nextCameraIndex]; |
|
|
|