cameraButton method
Implementation
Widget cameraButton() {
return Container(
color: Colors.black.withValues(alpha: 0.4),
child: Padding(
padding: const EdgeInsets.all(15.0),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
if (modes.length > 1) silderView(),
const SizedBox(height: 12),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
widget._controller.allowGallery
? buttons(
icon: widget._controller.imagePickerIcon != null
? iconframework.Icon.fromModel(
widget._controller.imagePickerIcon!)
: Icon(Icons.photo_size_select_actual_outlined,
size: iconSize, color: iconColor),
backgroundColor: Colors.white.withValues(alpha: 0.1),
onPressed: selectImage,
)
: SizedBox(width: iconSize * 2, height: iconSize * 2),
InkWell(
onTap: capture,
child: Stack(
alignment: Alignment.center,
children: [
Icon(
Icons.circle,
color: _isVideoCameraSelected
? Colors.white
: Colors.white38,
size: 80,
),
Icon(
Icons.circle,
color:
_isVideoCameraSelected ? Colors.red : Colors.white,
size: 65,
),
_isVideoCameraSelected && isRecording
? const Icon(
Icons.stop_rounded,
color: Colors.white,
size: 32,
)
: Container(),
],
),
),
widget._controller.allowCameraRotate && cameras.length > 1
? buttons(
icon: widget._controller.cameraRotateIcon != null
? iconframework.Icon.fromModel(
widget._controller.cameraRotateIcon!)
: Icon(
Icons.flip_camera_ios_outlined,
size: iconSize,
color: iconColor,
),
backgroundColor: Colors.white.withValues(alpha: 0.1),
onPressed: () async {
try {
if (cameras.length <= 1) return;
currentModeIndex = 0;
setState(() {
isLoading = true;
});
await widget._controller.cameraController
?.dispose();
if (isFrontCamera) {
final back = cameras.firstWhere((camera) =>
camera.lensDirection ==
CameraLensDirection.back);
setCamera(cameraDescription: back);
isFrontCamera = false;
} else {
final front = cameras.firstWhere((camera) =>
camera.lensDirection ==
CameraLensDirection.front);
setCamera(cameraDescription: front);
isFrontCamera = true;
}
setState(() {
isLoading = false;
});
} on Exception catch (_) {
Navigator.pop(context);
}
})
: SizedBox(width: iconSize * 2, height: iconSize * 2)
],
),
],
),
),
);
}