participantView function

Widget participantView(
  1. EnxController enxController,
  2. RxList<ActiveList> activeTalkerList,
  3. MediaQueryData mediaQueryData,
  4. BuildContext context,
)

Implementation

Widget participantView(EnxController enxController, RxList<ActiveList> activeTalkerList,
    MediaQueryData mediaQueryData, BuildContext context){
  var screenSize = MediaQuery.of(context).size;
  int itemCount = activeTalkerList.value.length;
  switch (itemCount){
    case 1:
      return videoView(activeTalkerList[0].streamId!,mediaQueryData,context);
    case 2:
     return Center(
       child: Row(
         mainAxisAlignment: MainAxisAlignment.center,
          children: activeTalkerList.map((item) => Expanded(child: videoView(item.streamId!,mediaQueryData,context))).toList(),
        ),
     );

    case 3:
      return Center(
        child: Row(
          mainAxisAlignment: MainAxisAlignment.center,
          children: activeTalkerList.map((item) => Expanded(child: videoView(item.streamId!,mediaQueryData,context))).toList(),
        ),
      );

    case 4:
      return Center(
        child: Column(
          children: [
            Expanded(
              child: Row(
                mainAxisAlignment: MainAxisAlignment.center,
                children: activeTalkerList.sublist(0, 2).map((item) => Expanded(child: videoView(item.streamId!,mediaQueryData,context))).toList(),
              ),
            ),
          Expanded(
          child:   Row(
            mainAxisAlignment: MainAxisAlignment.center,
              children: activeTalkerList.sublist(2, 4).map((item) => Expanded(child: videoView(item.streamId!,mediaQueryData,context))).toList(),
            ),)
          ],
        ),
      );

    case 5:
      return Center(
        child: Column(
          children: [
            Expanded(
              child: Row(
                mainAxisAlignment: MainAxisAlignment.center,
                children: activeTalkerList.sublist(0, 3).map((item) => Expanded(child: videoView(item.streamId!,mediaQueryData,context))).toList(),
              ),
            ),
          Expanded(
          child:  Row(
            mainAxisAlignment: MainAxisAlignment.center,
              children: activeTalkerList.sublist(3, 5).map((item) => Expanded(child: videoView(item.streamId!,mediaQueryData,context))).toList(),
            ),)
          ],
        ),
      );

    case 6:
      return Center(
        child: Column(
          children: [
            Expanded(
              child: Row(
                mainAxisAlignment: MainAxisAlignment.center,
                children: activeTalkerList.sublist(0, 3).map((item) => Expanded(child: videoView(item.streamId!,mediaQueryData,context))).toList(),
              ),
            ),
          Expanded(
          child:  Row(
            mainAxisAlignment: MainAxisAlignment.center,
              children: activeTalkerList.sublist(3, 6).map((item) => Expanded(child: videoView(item.streamId!,mediaQueryData,context))).toList(),
            ),)
          ],
        ),
      );

    default:
      return const Center(child: Text('Unsupported participant count'));
  }


}