ParticipantScreenNew function
Implementation
Widget ParticipantScreenNew(EnxController enxController,BuildContext context){
EnxController enxController = Get.find<EnxController>();
bool isAudio = false, isVideo = false, isChat = false, isDisconnect = false;
if(kDebugMode) {
print("1211${enxController.userList.length}");
}
Map<ParticipantListOption, Widget> buttonTopMap =
<ParticipantListOption, Widget>{};
var setting = EnxSetting.instance;
print("212112${setting.participantListOption.length}");
if (setting.participantListOption.isNotEmpty) {
for (var element in setting.participantListOption) {
if (element == ParticipantListOption.audio) {
isAudio = true;
} else if (element == ParticipantListOption.video) {
isVideo = true;
} else if (element == ParticipantListOption.chat) {
isChat = true;
} else if (element == ParticipantListOption.disconnect) {
isDisconnect = true;
}
}
}
print("21211212$isDisconnect +");
return Obx(() => Container(
color: Colors.white,
height:MediaQuery.of(context).orientation == Orientation.portrait
? MediaQuery.of(context).size.height / 1.58
: MediaQuery.of(context).size.height / 1.3,
child: SingleChildScrollView(
padding: EdgeInsets.only(bottom: MediaQuery.of(context).orientation==Orientation.portrait? MediaQuery.of(context).size.width/10:MediaQuery.of(context).size.height/5),
physics: const AlwaysScrollableScrollPhysics(),
child: Wrap(
children: [
Container(
width:MediaQuery.of(context).orientation==Orientation.portrait? MediaQuery.of(context).size.width:MediaQuery.of(context).size.height,
color: CustomColors.themeColor,
child: Align(
alignment: Alignment.centerLeft,
child: Padding(
padding: const EdgeInsets.all(12.0),
child: Text(
'Moderators(${enxController.moderatorsList.length})',
style: const TextStyle(color: Colors.white),
)
))),
Container(
width:MediaQuery.of(context).orientation==Orientation.portrait? MediaQuery.of(context).size.width:MediaQuery.of(context).size.height,
color: Colors.white,
child: ListView.separated(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
// Let the ListView know how many items it needs to build.
itemCount: enxController.moderatorsList.length,
// Provide a builder function. This is where the magic happens.
// Convert each item into a widget based on the type of item it is.
itemBuilder: (context, index) {
final item = enxController.moderatorsList[index];
return SizedBox(
width:MediaQuery.of(context).orientation==Orientation.portrait? MediaQuery.of(context).size.width:MediaQuery.of(context).size.height,
child: ListTile(
leading: const Icon(Icons.person),
title: Text(
enxController.userModelSelf!.clientId == item.clientId
? '${item.name!} (Me)'
: item.name!,
overflow: TextOverflow.ellipsis,
maxLines: 1,
style:
const TextStyle(color: Colors.black, fontSize: 13)),
trailing: participantButtonOption(context,item,setting.participantListOption,true,enxController,isAudio,isVideo,isChat,isDisconnect),
),
);
},
separatorBuilder: (BuildContext context, int index) {
return const Divider();
},
),
),
Container(
width:MediaQuery.of(context).orientation==Orientation.portrait? MediaQuery.of(context).size.width:MediaQuery.of(context).size.height,
color: CustomColors.themeColor,
child: Padding(
padding: const EdgeInsets.all(12.0),
child: Text(
'Participants (${enxController.participantsList.length})',
style: const TextStyle(color: Colors.white),
),
)),
ListView.separated(
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
// Let the ListView know how many items it needs to build.
itemCount: enxController.participantsList.length,
// Provide a builder function. This is where the magic happens.
// Convert each item into a widget based on the type of item it is.
itemBuilder: (context, index) {
final item = enxController.participantsList[index];
return SizedBox(
width:MediaQuery.of(context).orientation==Orientation.portrait? MediaQuery.of(context).size.width:MediaQuery.of(context).size.height,
child: ListTile(
leading: const Icon(Icons.person),
title: Text(
enxController.userModelSelf!.clientId == item.clientId
? '${item.name!} (Me)'
: item.name!,
overflow: TextOverflow.ellipsis,
maxLines: 1,
style:
const TextStyle(color: Colors.black, fontSize: 13)),
trailing:participantButtonOption(context, item, setting.participantListOption,false,enxController,isAudio,isVideo,isChat,isDisconnect),
),
);
},
separatorBuilder: (BuildContext context, int index) {
return const Divider();
},
),
],
),
),
));
}