participantButtonOption function
Widget
participantButtonOption(
- BuildContext context,
- UserModel item,
- Set<
ParticipantListOption> participantListOption, - bool isMod,
- EnxController enxController,
- bool isAudio,
- bool isVideo,
- bool isChat,
- bool isDisconnect,
Implementation
Widget participantButtonOption(BuildContext context, UserModel item, Set<ParticipantListOption> participantListOption, bool isMod,EnxController enxController,bool isAudio,bool isVideo,bool isChat,bool isDisconnect){
return participantListOption.isNotEmpty? Wrap(
spacing: 8, // space between two icons
children: <Widget>[
isAudio? CustomMaterialButton(
onPressed: () => {
if (enxController.userModelSelf!.clientId ==
item.clientId)
{enxController.toggleMuteAudio()}
else
{
if (enxController.userModelSelf!.role !=
'participant')
{
if (item.isAudioMuted)
enxController
.toggleHardUnMuteAudio(item.clientId)
else
enxController
.toggleHardMuteAudio(item.clientId)
}
}
},
child: Icon(
item.isAudioMuted
? Icons.mic_off_outlined
: Icons.mic_none_outlined,
color: item.isAudioMuted
? CustomColors.themeColor
: Colors.grey,
),
elevation: 2.0,
padding: const EdgeInsets.all(12.0),
):const SizedBox(), // icon-1
isVideo? CustomMaterialButton(
onPressed: () => {
if (enxController.userModelSelf!.clientId ==
item.clientId)
{enxController.toggleMuteVideo()}
else
{
if (enxController.userModelSelf!.role !=
'participant')
{
if (item.isVideoMuted)
enxController
.toggleHardUnMuteVideo(item.clientId)
else
enxController
.toggleHardMuteVideo(item.clientId)
}
}
},
child: Icon(
item.isVideoMuted
? Icons.videocam_off_outlined
: Icons.videocam_outlined,
color: item.isVideoMuted
? CustomColors.themeColor
: Colors.grey),
elevation: 2.0,
padding: EdgeInsets.all(12.0),
):const SizedBox(),
enxController.userModelSelf!.clientId == item.clientId
? const SizedBox()
: isChat?CustomMaterialButton(
onPressed: () {
enxController.chatType.value = 'private';
Get.to(
() => ChatPage(
enxController,
item.name,
clientId: item.clientId,
),
transition: Transition.leftToRight,
duration: const Duration(seconds: 1));
},
child: Image.asset(
"assets/image/chat_icon.png",
package: 'enx_uikit_flutter',
width: 30,
height: 30,
),
elevation: 2.0,
):const SizedBox(),
isMod? enxController.userModelSelf!.role == 'participant'
? const SizedBox()
: isDisconnect?CustomMaterialButton(
onPressed: () => _onCallEnd(
context, [item.clientId],enxController,
clientId: enxController
.userModelSelf!.clientId ==
item.clientId
? enxController.userModelSelf!.clientId
: ''),
child: const Icon(Icons.call_end_rounded,
color: Colors.white, size: 20),
shape: const CircleBorder(),
elevation: 2.0,
fillColor: CustomColors.themeColor,
):const SizedBox() : (enxController.userModelSelf!.role == 'participant')
? enxController.userModelSelf!.clientId ==
item.clientId
? isDisconnect?CustomMaterialButton(
onPressed: () => _onCallEnd(
context, [item.clientId],enxController,
clientId: enxController
.userModelSelf!.clientId),
child: const Icon(Icons.call_end_rounded,
color: Colors.white, size: 20),
shape: const CircleBorder(),
elevation: 2.0,
fillColor: CustomColors.themeColor,
):const SizedBox()
: const SizedBox()
: enxController.userModelSelf!.clientId ==
item.clientId
? const SizedBox()
: isDisconnect?CustomMaterialButton(
onPressed: () => _onCallEnd(
context, [item.clientId],enxController,
clientId: ''),
child: const Icon(Icons.call_end_rounded,
color: Colors.white, size: 20),
shape: const CircleBorder(),
elevation: 2.0,
fillColor: CustomColors.themeColor,
):const SizedBox(),
],
):Wrap(
spacing: 8, // space between two icons
children: <Widget>[
CustomMaterialButton(
onPressed: () => {
if (enxController.userModelSelf!.clientId ==
item.clientId)
{enxController.toggleMuteAudio()}
else
{
if (enxController.userModelSelf!.role !=
'participant')
{
if (item.isAudioMuted)
enxController
.toggleHardUnMuteAudio(item.clientId)
else
enxController
.toggleHardMuteAudio(item.clientId)
}
}
},
child: Icon(
item.isAudioMuted
? Icons.mic_off_outlined
: Icons.mic_none_outlined,
color: item.isAudioMuted
? CustomColors.themeColor
: Colors.grey,
),
elevation: 2.0,
padding: const EdgeInsets.all(12.0),
), // icon-1
CustomMaterialButton(
onPressed: () => {
if (enxController.userModelSelf!.clientId ==
item.clientId)
{enxController.toggleMuteVideo()}
else
{
if (enxController.userModelSelf!.role !=
'participant')
{
if (item.isVideoMuted)
enxController
.toggleHardUnMuteVideo(item.clientId)
else
enxController
.toggleHardMuteVideo(item.clientId)
}
}
},
child: Icon(
item.isVideoMuted
? Icons.videocam_off_outlined
: Icons.videocam_outlined,
color: item.isVideoMuted
? CustomColors.themeColor
: Colors.grey),
elevation: 2.0,
padding: EdgeInsets.all(12.0),
),
enxController.userModelSelf!.clientId == item.clientId
? const SizedBox()
: CustomMaterialButton(
onPressed: () {
enxController.chatType.value = 'private';
Get.to(
() => ChatPage(
enxController,
item.name,
clientId: item.clientId,
),
transition: Transition.leftToRight,
duration: const Duration(seconds: 1));
},
child: Image.asset(
"assets/image/chat_icon.png",
package: 'enx_uikit_flutter',
width: 30,
height: 30,
),
elevation: 2.0,
),
isMod? enxController.userModelSelf!.role == 'participant'
? const SizedBox()
: CustomMaterialButton(
onPressed: () => _onCallEnd(
context, [item.clientId],enxController,
clientId: enxController
.userModelSelf!.clientId ==
item.clientId
? enxController.userModelSelf!.clientId
: ''),
child: const Icon(Icons.call_end_rounded,
color: Colors.white, size: 20),
shape: const CircleBorder(),
elevation: 2.0,
fillColor: CustomColors.themeColor,
): (enxController.userModelSelf!.role == 'participant')
? enxController.userModelSelf!.clientId ==
item.clientId
? CustomMaterialButton(
onPressed: () => _onCallEnd(
context, [item.clientId],enxController,
clientId: enxController
.userModelSelf!.clientId),
child: const Icon(Icons.call_end_rounded,
color: Colors.white, size: 20),
shape: const CircleBorder(),
elevation: 2.0,
fillColor: CustomColors.themeColor,
)
: const SizedBox()
: enxController.userModelSelf!.clientId ==
item.clientId
? const SizedBox()
: CustomMaterialButton(
onPressed: () => _onCallEnd(
context, [item.clientId],enxController,
clientId: ''),
child: const Icon(Icons.call_end_rounded,
color: Colors.white, size: 20),
shape: const CircleBorder(),
elevation: 2.0,
fillColor: CustomColors.themeColor,
),
],
);
}