Commit 67ff122f authored by Dio Maulana's avatar Dio Maulana

get camera base on list

parent af6dfec2
...@@ -65,10 +65,10 @@ class _AbsentCameraViewState extends State<AbsentCameraView> { ...@@ -65,10 +65,10 @@ class _AbsentCameraViewState extends State<AbsentCameraView> {
getCameraDescrption().then((value) { getCameraDescrption().then((value) {
cameras = value; cameras = value;
if (cameras!.length > 1) { if (cameras!.length > 1) {
_cameraDescription = cameras!.last; _cameraDescription = cameras![1];
} else { } else {
if (cameras!.isNotEmpty) { if (cameras!.isNotEmpty) {
_cameraDescription = cameras!.first; _cameraDescription = cameras![0];
} else { } else {
_cameraDescription = null; _cameraDescription = null;
} }
...@@ -149,7 +149,7 @@ class _AbsentCameraViewState extends State<AbsentCameraView> { ...@@ -149,7 +149,7 @@ class _AbsentCameraViewState extends State<AbsentCameraView> {
) )
: Image.memory( : Image.memory(
imagePath!, imagePath!,
fit: BoxFit.fill, // fit: BoxFit.fill,
) )
: CameraPreview( : CameraPreview(
_controller!, _controller!,
...@@ -344,12 +344,12 @@ class _AbsentCameraViewState extends State<AbsentCameraView> { ...@@ -344,12 +344,12 @@ class _AbsentCameraViewState extends State<AbsentCameraView> {
if (cameras!.length > 1) { if (cameras!.length > 1) {
setState(() { setState(() {
if (_cameraDescription == if (_cameraDescription ==
cameras!.first) { cameras![0]) {
_cameraDescription = _cameraDescription =
cameras!.last; cameras![1];
} else { } else {
_cameraDescription = _cameraDescription =
cameras!.first; cameras![0];
} }
_controller = CameraController( _controller = CameraController(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment