portraitView function

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

Implementation

Widget portraitView(BuildContext context, EnxController enxController) {
  return Column(
    children: [
      enxController.activeTalkerList.isNotEmpty
          ? Card(
              child: SizedBox(
              height: enxController.activeTalkerList.length > 1
                  ? MediaQuery.of(context).size.height - 188.h
                  : MediaQuery.of(context).size.height - 35.h,
              width: MediaQuery.of(context).size.width,
              child: Expanded(
                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: MediaQuery.of(context).size.width,
              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(
                            child: SizedBox(
                                width: MediaQuery.of(context).size.width / 2,
                                child: Platform.isAndroid
                                    ? EnxPlayerWidget(
                                        enxController
                                            .activeTalkerList[index].streamId!,
                                        local: false,
                                        height: 150.h.toInt(),
                                        width: 100.w.toInt(),
                                      )
                                    : AspectRatio(
                                        aspectRatio: 3 / 2,
                                        child: EnxPlayerWidget(
                                          enxController.activeTalkerList[index]
                                              .streamId!,
                                          local: false,
                                          height: 150.h.toInt(),
                                          width: 100.w.toInt(),
                                        ))),
                          ),
                        )
                      : Container();
                },
              ),
            )
          : Container(),
    ],
  );
}