Skip to content

Commit 751bbc0

Browse files
committed
🚀 Make camera switching available.
Resolves #5 .
1 parent 89bb14e commit 751bbc0

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

lib/src/widget/camera_picker.dart

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ class CameraPickerState extends State<CameraPicker> {
329329
/// Initialize cameras instances.
330330
/// 初始化相机实例
331331
Future<void> initCameras({CameraDescription cameraDescription}) async {
332-
cameraController?.dispose();
332+
await cameraController?.dispose();
333333

334334
/// When it's null, which means this is the first time initializing the cameras.
335335
/// So cameras should fetch.
@@ -516,10 +516,11 @@ class CameraPickerState extends State<CameraPicker> {
516516
return Padding(
517517
padding: const EdgeInsets.symmetric(horizontal: 12.0),
518518
child: Row(
519-
children: const <Widget>[
520-
Spacer(),
519+
children: <Widget>[
520+
const Spacer(),
521521
// TODO(Alex): There's an issue tracking NPE of the camera plugin, so switching is temporary disabled .
522-
// if ((cameras?.length ?? 0) > 1) switchCamerasButton,
522+
if ((cameras?.length ?? 0) > 1)
523+
switchCamerasButton,
523524
],
524525
),
525526
);

0 commit comments

Comments
 (0)