renderStreamsGrid function
List<Widget>
renderStreamsGrid(
- EnxController enxController,
- RxList<
ActiveList> activeTalkerList, - MediaQueryData mediaQueryData,
- BuildContext context,
Implementation
List<Widget> renderStreamsGrid(
EnxController enxController,
RxList<ActiveList> activeTalkerList,
MediaQueryData mediaQueryData,
BuildContext context) {
List<Widget> streamsExpanded = [];
print("talkerList12:${activeTalkerList.value.length}");
streamsExpanded.addAll(activeTalkerList
.map(
(entry) => Expanded(
child: GestureDetector(
onLongPress: () {
// if( enxController.isLongPressEnable){
// enxController.streamId.value=entry.streamId!;
// enxController.annotationShare();
//
// }
},
child: kIsWeb?Container(
decoration:
BoxDecoration(border: Border.all(color: Colors.grey)),
child: AspectRatio(aspectRatio: 4/3,
child: EnxPlayerWidget(
entry.streamId!,
local: false,
zMediaOverlay: false,
height: 300,
width: mediaQueryData.size.width.toInt(),
),
),
):Platform.isAndroid
? Container(
decoration:
BoxDecoration(border: Border.all(color: Colors.grey)),
child: EnxPlayerWidget(
entry.streamId!,
local: false,
zMediaOverlay: false,
height: 300,
width: mediaQueryData.size.width.toInt(),
),
)
: EnxPlayerWidget(
entry.streamId!,
local: false,
height: mediaQueryData.size.height.toInt(),
width: mediaQueryData.size.width.toInt(),
)),
),
)
.toList());
if (streamsExpanded.length > 2) {
List<Widget> rows = [];
for (var i = 0; i < streamsExpanded.length; i += 2) {
var chunkEndIndex = i + 2;
if (streamsExpanded.length < chunkEndIndex) {
chunkEndIndex = streamsExpanded.length;
}
var chunk = streamsExpanded.sublist(i, chunkEndIndex);
rows.add(
Expanded(
child: Align(
alignment: Alignment.center,
child:kIsWeb? Column(children: chunk): mediaQueryData.orientation == Orientation.portrait
? Row(children: chunk)
: Column(children: chunk),
),
),
);
}
return rows;
}
return streamsExpanded;
}