Skip to content

Commit b863ee0

Browse files
Merge pull request #1907 from EnsembleUI/camera-bugs
2 parents 73f7544 + e82b757 commit b863ee0

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

modules/camera/lib/camera.dart

+10-6
Original file line numberDiff line numberDiff line change
@@ -1240,12 +1240,16 @@ class CameraState extends EWidgetState<Camera> with WidgetsBindingObserver {
12401240
itemBuilder: (context, index) {
12411241
return IconButton(
12421242
onPressed: () {
1243-
final page = (index + 1) % flashIcons.length;
1244-
_flashPageController.animateToPage(page,
1245-
duration: const Duration(milliseconds: 400),
1246-
curve: Curves.ease);
1247-
widget._controller.cameraController
1248-
?.setFlashMode(flashModes.elementAt(page));
1243+
try{
1244+
final page = (index + 1) % flashIcons.length;
1245+
_flashPageController.animateToPage(page,
1246+
duration: const Duration(milliseconds: 400),
1247+
curve: Curves.ease);
1248+
widget._controller.cameraController
1249+
?.setFlashMode(flashModes.elementAt(page));
1250+
} catch(e){
1251+
debugPrint("CameraException: ${e}");
1252+
}
12491253
},
12501254
icon: Icon(flashIcons.elementAt(index)),
12511255
color: Colors.white);

0 commit comments

Comments
 (0)