portraitView function

Widget portraitView(
  1. BuildContext context,
  2. EnxController enxController
)

Implementation

Widget portraitView(BuildContext context, EnxController enxController) {
  final mediaQuery = MediaQuery.of(context);
  final availableHeight = mediaQuery.size.height - mediaQuery.padding.vertical;
  final availableWidth = mediaQuery.size.width;

  return Column(
    children: [
      enxController.activeTalkerList.isNotEmpty
          ? Card(
              color: EnxUiKitTheme.surfaceContainer(context),
              child: SizedBox(
                height: enxController.activeTalkerList.length > 1
                    ? availableHeight - 188.h
                    : availableHeight - 35.h,
                width: availableWidth,
                child: EnxPlayerWidget(
                  enxController.activeTalkerList[0].streamId!,
                  local: false,
                  height: 200.h.toInt(),
                  width: 100.w.toInt(),
                ),
              ))
          : Text(
              'Wait for others to join',
              style: TextStyle(color: Colors.white, fontSize: 16.sp),
            ),
      enxController.activeTalkerList.length > 1
          ? Container(
              height: 150.h,
              width: availableWidth,
              alignment: Alignment.bottomCenter,
              child: ListView.builder(
                shrinkWrap: true,
                scrollDirection: Axis.horizontal,
                itemCount: enxController.activeTalkerList.length,
                itemBuilder: (BuildContext context, int index) {
                  return index > 0
                      ? Padding(
                          key: Key('$index'),
                          padding: EdgeInsets.zero,
                          child: Card(
                            color: EnxUiKitTheme.surfaceContainer(context),
                            child: SizedBox(
                                width: availableWidth / 2,
                                child: EnxPlayerWidget(
                                  enxController
                                      .activeTalkerList[index].streamId!,
                                  local: false,
                                  height: 150.h.toInt(),
                                  width: 100.w.toInt(),
                                )),
                          ),
                        )
                      : Container();
                },
              ),
            )
          : Container(),
    ],
  );
}