getSizeForPortrate function
Implementation
Widget getSizeForPortrate(int width, int height, RxList<ActiveList> activeTalkerList){
int itemCount = activeTalkerList.length;
switch (itemCount) {
case 1:
return getVideoView(activeTalkerList[0].streamId!, width, height);
case 2:
return Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: activeTalkerList.map((item) => Expanded(
child: getVideoView(item.streamId!, width, height ~/ 2 - 5)
)).toList(),
),
);
case 3:
return Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: activeTalkerList.map((item) => Expanded(
child: getVideoView(item.streamId!, width, height ~/ 3 - 5)
)).toList(),
),
);
case 4:
return Center(
child: Column(
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(
children: [
Expanded(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: activeTalkerList.sublist(0, 2).map((item) => Expanded(
child: getVideoView(item.streamId!, width ~/ 2, height ~/ 3)
)).toList(),
),
),
Expanded(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: activeTalkerList.sublist(2, 4).map((item) => Expanded(
child: getVideoView(item.streamId!, width ~/ 2 - 5, height ~/ 3 - 5)
)).toList(),
),
),
Expanded(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: activeTalkerList.sublist(4, 5).map((item) => Expanded(
child: getVideoView(item.streamId!, width, height ~/ 3 - 5)
)).toList(),
),
)
],
),
);
case 6:
return Center(
child: Column(
children: [
Expanded(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: activeTalkerList.sublist(0, 2).map((item) => Expanded(
child: getVideoView(item.streamId!, width ~/ 2 - 5, height ~/ 3 - 5)
)).toList(),
),
),
Expanded(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: activeTalkerList.sublist(2, 4).map((item) => Expanded(
child: getVideoView(item.streamId!, width ~/ 2 - 5, height ~/ 3 - 5)
)).toList(),
),
),
Expanded(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: activeTalkerList.sublist(4, 6).map((item) => Expanded(
child: getVideoView(item.streamId!, width ~/ 2 - 5, height ~/ 3 - 5)
)).toList(),
),
)
],
),
);
default:
return const Center(child: Text('Unsupported participant count'));
}
}