liControl_BTN method
dynamic
liControl_BTN(
- T lav,
- void setState(
- void ()
Implementation
liControl_BTN(T lav, void Function(void Function()) setState) {
// print(widget.xApp.state.cameras.length);
Color color_BackGroundBTNactions = Color.fromARGB(255, 0, 45, 97);
return widget.photoController == null
? []
: [
if (kIsWeb.not())
Container(
width: 60,
decoration: BoxDecoration(color: color_BackGroundBTNactions, borderRadius: BorderRadius.circular(10)),
child: IconButton(
icon: Icon(Icons.flash_on_outlined),
color: widget.photoController!.value.flashMode == FlashMode.off
? Colors.white
: widget.photoController!.value.isInitialized && widget.photoController!.value.flashMode == FlashMode.torch
? Colors.yellow
: Colors.white,
onPressed: widget.photoController!.value.isInitialized
? widget.photoController!.value.flashMode == FlashMode.off
? () => setFlashMode(FlashMode.torch, setState)
: () => setFlashMode(FlashMode.off, setState)
: null,
)),
if (kIsWeb.not()) SizedBox(width: 4),
widget.photoController!.value.isRecordingVideo || isRecording_Audio
? Container(
width: 60,
decoration: BoxDecoration(color: color_BackGroundBTNactions, borderRadius: BorderRadius.circular(10)),
child: IconButton(
icon: Icon(Icons.delete_outline),
color: Colors.red,
onPressed: () async {
if (isRecording_Audio) {
recorderController.stop();
setState(() {
isRecording_Audio = false;
});
} else {
if (kIsWeb) {
// await stopRecording();
} else {
await widget.photoController!.stopVideoRecording();
}
}
widget.onEndTakeVideo!(setState);
},
))
: Container(),
SizedBox(width: 4),
isRecording_Audio
? Container()
: widget.photoController!.value.isRecordingVideo.not()
? Container()
: Container(
width: 60,
decoration: BoxDecoration(color: color_BackGroundBTNactions, borderRadius: BorderRadius.circular(10)),
child: IconButton(
icon: widget.photoController!.value.isRecordingPaused ? Icon(Icons.play_arrow) : Icon(Icons.pause),
color: Colors.white,
onPressed: widget.photoController!.value.isInitialized && widget.photoController!.value.isRecordingVideo
? (widget.photoController!.value.isRecordingPaused)
? () => onResumeButtonPressed(setState)
: () => onPauseButtonPressed(setState)
: null,
)),
SizedBox(width: 4),
isRecording_Audio
? Container()
: widget.photoController!.value.isRecordingVideo.not()
? Container()
: Container(
width: 60,
decoration: BoxDecoration(color: color_BackGroundBTNactions, borderRadius: BorderRadius.circular(10)),
child: IconButton(
icon: Icon(Icons.stop),
color: Colors.red,
onPressed: widget.photoController!.value.isInitialized && widget.photoController!.value.isRecordingVideo ? () async => await onStopButtonPressed(lav, setState) : null,
)),
// SizedBox(width: 4),
// widget.photoController!.value.isRecordingVideo || isRecording_Audio
// ? Container()
// : Container(
// decoration: BoxDecoration(color: color_BackGroundBTNactions, borderRadius: BorderRadius.circular(10)),
// child: IconButton(
// icon: Icon(Icons.video_camera_back_outlined),
// color: outCamera ? Colors.green : Colors.white,
// onPressed: widget.photoController!.value.isInitialized && !widget.photoController!.value.isRecordingVideo ? () => cmdViewAnotherCamera() : null,
// )),
SizedBox(width: 4),
widget.photoController!.value.isRecordingVideo
? Container()
: kIsWeb.not()
? Container(
width: 60,
decoration: BoxDecoration(color: color_BackGroundBTNactions, borderRadius: BorderRadius.circular(10)),
child: IconButton(
icon: Icon(isRecording_Audio.not() ? Icons.mic : Icons.stop),
color: isRecording_Audio.not() ? Colors.blue : Colors.red,
onPressed: () async => await _startOrStopRecording_Audio(lav as XFDataItem),
))
: Container(),
SizedBox(width: 4),
isRecording_Audio
? Container()
: kIsWeb.not()
? Container(
width: 60,
decoration: BoxDecoration(color: color_BackGroundBTNactions, borderRadius: BorderRadius.circular(10)),
child: IconButton(
icon: Icon(Icons.videocam),
color: Colors.white,
onPressed: widget.photoController!.value.isInitialized && !widget.photoController!.value.isRecordingVideo ? () async => await onVideoRecordButtonPressed(lav, setState) : null,
))
: Container(),
SizedBox(width: 4),
widget.photoController!.value.isRecordingVideo || isRecording_Audio
? Container()
: Container(
width: 60,
decoration: BoxDecoration(color: color_BackGroundBTNactions, borderRadius: BorderRadius.circular(10)),
child: IconButton(
icon: Icon(Icons.camera_alt),
color: Colors.white,
onPressed: widget.photoController!.value.isInitialized ? () => onTakePictureButtonPressed(lav, setState) : null,
)),
SizedBox(width: widget.xApp.state.cameras.length > 1 ? 4 : 0),
widget.xApp.state.cameras.length > 2
? Container(
width: 60,
height: 40,
decoration: BoxDecoration(color: color_BackGroundBTNactions, borderRadius: BorderRadius.circular(10)),
child: PopupMenuButton(
child: Icon(Icons.change_circle),
itemBuilder: (context) => widget.xApp.state.cameras
.map((e) => PopupMenuItem<CameraDescription>(
value: e,
onTap: () async {
XMediaRecorder.xCurrentCamera = e;
await widget.photoController!.setDescription(XMediaRecorder.xCurrentCamera!);
// print("Camera Selected: ${e.name}");
// print("CONTROLLER Camera: ${widget.photoController!.value}");
},
child: Container(width: 120, height: 40, color: Colors.grey[900], child: Text(e.lensDirection.name, textAlign: TextAlign.center, style: XStyles.xStyTextForLabel(textColor: Colors.white))),
))
.toList(),
))
: widget.xApp.state.cameras.length > 1
? Container(
width: 60,
height: 40,
decoration: BoxDecoration(color: color_BackGroundBTNactions, borderRadius: BorderRadius.circular(10)),
child: XBtnbase(
icon: Icons.change_circle,
onPressed: () async {
XMediaRecorder.xCurrentCamera = widget.xApp.state.cameras.firstWhere((element) => element.name != widget.photoController!.description.name);
await widget.photoController!.setDescription(XMediaRecorder.xCurrentCamera!);
},
label_Color: Colors.white,
))
: Container(height: 0, width: 0),
// Container(
// margin: EdgeInsets.only(right: 5, bottom: 10, left: 6),
// width: 100,
// height: 35,
// child: DropdownMenu<CameraDescription>(
// inputDecorationTheme: InputDecorationTheme(
// contentPadding: EdgeInsets.symmetric(horizontal: 4),
// isDense: true,
// border: OutlineInputBorder(borderSide: BorderSide(color: Colors.white)),
// disabledBorder: OutlineInputBorder(borderSide: BorderSide(color: Colors.white)),
// enabledBorder: OutlineInputBorder(borderSide: BorderSide(color: Colors.white)),
// focusedBorder: OutlineInputBorder(borderSide: BorderSide(color: Colors.white)),
// outlineBorder: BorderSide(color: Colors.white),
// ),
// enableSearch: false,
// enableFilter: false,
// onSelected: (value) {
// print(value);
// // widget.photoController!.pausePreview();
// var x = widget.xApp.state.cameras.firstWhere((element) => element.name == value!.name);
// widget.photoController!.setDescription(x);
// // widget.photoController!.resumePreview();
// },
// label: Text("Camera", style: XStyles.xStyTextForDescr(textColor: Colors.white)),
// textStyle: XStyles.xStyTextForLabel(textColor: Colors.white),
// menuStyle: MenuStyle(),
// dropdownMenuEntries: widget.xApp.state.cameras
// .map((e) => DropdownMenuEntry<CameraDescription>(
// value: e,
// style: ButtonStyle(
// textStyle: WidgetStateProperty.all(XStyles.xStyTextForLabel(textColor: Colors.white)),
// backgroundColor: WidgetStateProperty.all(Colors.red[900]),
// foregroundColor: WidgetStateProperty.all(Colors.white),
// ),
// label: e.name))
// .toList()),
// ),
];
}