Skip to content

Commit 9356909

Browse files
committed
🚀 Bring camera switch button back.
ref: #23 (comment) .
1 parent dee77ef commit 9356909

File tree

1 file changed

+24
-6
lines changed

1 file changed

+24
-6
lines changed

lib/src/widget/camera_picker.dart

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -721,12 +721,30 @@ class CameraPickerState extends State<CameraPicker>
721721
/// This displayed at the top of the screen.
722722
/// 该区域显示在屏幕上方。
723723
Widget get settingsAction {
724-
return _initializeWrapper(
725-
builder: (CameraValue v, __) => Padding(
726-
padding: const EdgeInsets.symmetric(horizontal: 12.0),
727-
child: Row(
728-
children: <Widget>[const Spacer(), switchFlashesButton(v)],
729-
),
724+
return Padding(
725+
padding: const EdgeInsets.symmetric(horizontal: 12.0),
726+
child: Row(
727+
children: <Widget>[
728+
if ((cameras?.length ?? 0) > 1) switchCamerasButton,
729+
const Spacer(),
730+
_initializeWrapper(
731+
builder: (CameraValue v, __) => switchFlashesButton(v),
732+
),
733+
],
734+
),
735+
);
736+
}
737+
738+
/// The button to switch between cameras.
739+
/// 切换相机的按钮
740+
Widget get switchCamerasButton {
741+
return IconButton(
742+
onPressed: switchCameras,
743+
icon: Icon(
744+
Platform.isIOS
745+
? Icons.flip_camera_ios_outlined
746+
: Icons.flip_camera_android_outlined,
747+
size: 24,
730748
),
731749
);
732750
}

0 commit comments

Comments
 (0)