getSizeForlandScape function

Widget getSizeForlandScape(
  1. int width,
  2. int height,
  3. RxList<ActiveList> activeTalkerList
)

Implementation

Widget getSizeForlandScape(int width, int height, RxList<ActiveList> activeTalkerList){
  int itemCount = activeTalkerList.length;
  switch (itemCount){
    case 1:
      return Center(child: getVideoView(activeTalkerList[0].streamId!,width,height));
    case 2:
      return Center(
        child: Row(
          mainAxisAlignment: MainAxisAlignment.center,
          children: activeTalkerList.map((item) => Expanded(child: getVideoView(item.streamId!,width~/2 -5,height))).toList(),
        ),
      );

    case 3:
      return Center(
        child: Row(
          mainAxisAlignment: MainAxisAlignment.center,
          children: activeTalkerList.map((item) => Expanded(child: getVideoView(item.streamId!,width~/3 -5,height))).toList(),
        ),
      );

    case 4:
      return Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Expanded(
              child: Row(
                mainAxisAlignment: MainAxisAlignment.center,
                children: activeTalkerList.sublist(0, 2).map((item) => Expanded(child: getVideoView(item.streamId!,width~/2 -5,height~/2 -5))).toList(),
              ),
            ),
            Expanded(
              child:   Row(
                mainAxisAlignment: MainAxisAlignment.center,
                children: activeTalkerList.sublist(2, 4).map((item) => Expanded(child: getVideoView(item.streamId!,width~/2 -5,height~/2 -5))).toList(),
              ),)
          ],
        ),
      );

    case 5:
      return Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Expanded(
              child: Row(
                mainAxisAlignment: MainAxisAlignment.center,
                children: activeTalkerList.sublist(0, 3).map((item) => Expanded(child: getVideoView(item.streamId!,width~/3 -5,height~/2 -5))).toList(),
              ),
            ),
            Expanded(
              child:  Row(
                mainAxisAlignment: MainAxisAlignment.center,
                children: activeTalkerList.sublist(3, 5).map((item) => Expanded(child: getVideoView(item.streamId!,width~/2 -5,height~/2 -5))).toList(),
              ),)
          ],
        ),
      );

    case 6:
      return Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Expanded(
              child: Row(
                mainAxisAlignment: MainAxisAlignment.center,
                children: activeTalkerList.sublist(0, 3).map((item) => Expanded(child: getVideoView(item.streamId!,width~/3 -5,height~/2 -5))).toList(),
              ),
            ),
            Expanded(
              child:  Row(
                mainAxisAlignment: MainAxisAlignment.center,
                children: activeTalkerList.sublist(3, 6).map((item) => Expanded(child: getVideoView(item.streamId!,width~/3 -5,height~/2 -5))).toList(),
              ),)
          ],
        ),
      );

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

}