buildCaptureActions method

Widget buildCaptureActions({
  1. required BuildContext context,
  2. required BoxConstraints constraints,
  3. CameraController? controller,
})

Capture action's widget. 拍照操作区

This displayed at the top of the screen. 该区域显示在屏幕下方。

Implementation

Widget buildCaptureActions({
  required BuildContext context,
  required BoxConstraints constraints,
  CameraController? controller,
}) {
  final orientation = controller?.value.deviceOrientation ??
      MediaQuery.of(context).orientation;
  final isPortrait = orientation.toString().contains('portrait');
  return SizedBox(
    width: isPortrait ? null : 118,
    height: isPortrait ? 118 : null,
    child: Flex(
      direction: isPortrait ? Axis.horizontal : Axis.vertical,
      verticalDirection: orientation == DeviceOrientation.landscapeLeft
          ? VerticalDirection.up
          : VerticalDirection.down,
      children: <Widget>[
        const Spacer(),
        Expanded(
          child: Center(
            child: buildCaptureButton(context, constraints),
          ),
        ),
        if (innerController != null && cameras.length > 1)
          Expanded(
            child: RotatedBox(
              quarterTurns: !enableScaledPreview ? cameraQuarterTurns : 0,
              child: buildCameraSwitch(context),
            ),
          )
        else
          const Spacer(),
      ],
    ),
  );
}