confirmationScreen function

Widget confirmationScreen(
  1. dynamic context,
  2. EnxController obj
)

Implementation

Widget confirmationScreen(context, EnxController obj) {
  int safeAreaHeight = (Get.window.viewPadding.bottom.toInt() == 0)
      ? 20
      : Get.window.viewPadding.bottom.toInt();
  double appbar=Scaffold.of(context).hasAppBar ? AppBar().preferredSize.height : 0.0;
  return Container(
    color: Colors.white,
    child: Column(
      children: [
        MediaQuery.of(context).orientation == Orientation.portrait
            ? Stack(
                alignment: Alignment.bottomCenter,
                children: [

                  Center(
                    child: SizedBox(
                      width: MediaQuery.of(context).size.width -
                          MediaQuery.of(context).padding.left +
                          MediaQuery.of(context).padding.right,
                      height: Platform.isIOS
                          ? MediaQuery.of(context).size.height - safeAreaHeight
                          : Get.height -appbar -
                          Get.window.viewPadding.top / 2.5 -
                          Get.window.viewPadding.bottom,

                      child: Stack(
                        children: [
                          obj.isSelect.value[1] || obj.isSelect.value[2]
                              ?Container(
                            width: MediaQuery.of(context).size.width,
                            height: MediaQuery.of(context).size.height,
                                color: Colors.grey,
                                child: const Icon(Icons.videocam_off_outlined),
                              )
                              :  EnxPlayerWidget(
                            0,
                            local: true,
                            zMediaOverlay: false,
                            height: MediaQuery.of(context).size.height ~/ 1.6,
                            width:MediaQuery.of(context).size.width.toInt() ,
                          ),
                          Align(
                            alignment: Alignment.topLeft,
                            child: Padding(
                              padding: EdgeInsets.all(8.0),
                              child: Container(
                                decoration: BoxDecoration(
                                  boxShadow: [
                                    BoxShadow(
                                      color: Colors.black.withOpacity(0.5), // Shadow color
                                      spreadRadius: 2, // Spread radius of the shadow
                                      blurRadius: 5,   // Blur radius of the shadow
                                      offset: Offset(3, 3), // Offset to create the shadow in a specific direction
                                    ),
                                  ],
                                ),
                                child: IconButton(
                                  icon: Icon(
                                    Icons.flip_camera_ios_outlined,
                                    color: Colors.white,
                                  ),
                                  onPressed: () {
                                         if(EnxSetting.instance.isFontCamera) {
                                           obj.switchCameraPreview();
                                         }else{
                                           obj.handleSingleClick();

                                         }



                                  },
                                ),
                              ),
                            ),
                          ),

                        ],
                      ),
                    ),
                  ),

                  Padding(
                    padding:
                        EdgeInsets.all(MediaQuery.of(context).size.width / 35),
                    child: Card(
                      shape: RoundedRectangleBorder(
                        borderRadius: BorderRadius.circular(
                            MediaQuery.of(context).size.width / 20),
                      ),
                      elevation: 15,
                      child: Padding(
                        padding: EdgeInsets.only(
                          left: MediaQuery.of(context).size.width / 20,
                          top: MediaQuery.of(context).size.width / 18,
                          bottom: MediaQuery.of(context).size.width / 18,
                          right: MediaQuery.of(context).size.width / 20,
                        ),
                        child: Column(
                          mainAxisSize: MainAxisSize.min,
                          children: [
                            Row(
                              mainAxisAlignment: MainAxisAlignment.spaceBetween,
                              children: [
                                Flexible(
                                  child: ToggleButtons(
                                    children: <Widget>[
                                      obj.isSelect.value.first
                                          ? Icon(Icons.mic_off_outlined)
                                          : Icon(Icons.mic_none_outlined),
                                      obj.isSelect.value[1]
                                          ? Icon(Icons.videocam_off_outlined)
                                          : Icon(Icons.video_call_outlined),
                                      Padding(
                                        padding: EdgeInsets.all(
                                            MediaQuery.of(context).size.width /
                                                48),
                                        child: Row(
                                          children: [
                                            Icon(Icons.mic_none_outlined),
                                            Text("Audio Only"),
                                          ],
                                        ),
                                      ),
                                    ],
                                    isSelected: obj.isSelect.value,
                                    onPressed: (int index) {
                                      if (index == 2) {
                                        obj.isSelect.value[index] =
                                            !obj.isSelect.value[index];
                                        if (obj.isVideoSelected.value) {
                                          obj.isSelect.value[1] =
                                              obj.isSelect.value[1];
                                        } else {
                                          obj.isSelect.value[1] =
                                              !obj.isSelect.value[1];
                                        }
                                      } else {
                                        if (obj.isSelect[2]) {
                                          if (obj.isSelect[1]) {
                                            obj.isSelect.value[1] =
                                                obj.isSelect.value[1];
                                          }
                                        } else {
                                          if (index == 1) {
                                            obj.isVideoSelected.value =
                                                !obj.isVideoSelected.value;
                                          }
                                          obj.isSelect.value[index] =
                                              !obj.isSelect.value[index];
                                        }
                                      }
                                      obj.isSelect.refresh();
                                    },
                                    color: Colors.grey,
                                    selectedColor: CustomColors.themeColor,
                                    borderColor: Colors.grey,
                                    selectedBorderColor:
                                        CustomColors.themeColor,
                                    constraints: BoxConstraints(
                                      minHeight: 40,
                                      minWidth:
                                          MediaQuery.of(context).size.width /
                                              6, // Adjusted minWidth
                                    ),
                                  ),
                                ),
                                GestureDetector(
                                  onTap: () {
                                    obj.settingListItem();
                                    Get.to(
                                      () => SettingScreen(obj),
                                      transition: Platform.isAndroid?Transition.leftToRight:Transition.cupertino,
                                      duration: const Duration(seconds: 1),
                                    );
                                  },
                                  child: Container(
                                    decoration: BoxDecoration(
                                      border: Border.all(color: Colors.grey),
                                    ),
                                    child: Padding(
                                      padding: EdgeInsets.all(
                                          MediaQuery.of(context).size.width /
                                              50),
                                      child: Icon(Icons.settings_outlined),
                                    ),
                                  ),
                                ),
                              ],
                            ),
                            Padding(
                              padding: EdgeInsets.only(
                                  top: MediaQuery.of(context).size.width / 20),
                              child: Center(
                                child: DecoratedBox(
                                  decoration: BoxDecoration(
                                    gradient: const LinearGradient(
                                      colors: [
                                        Colors.pinkAccent,
                                        Colors.pink,
                                        CustomColors.themeColor,
                                      ],
                                    ),
                                    borderRadius: BorderRadius.circular(15),
                                  ),
                                  child: ElevatedButton(
                                    child:  Text(
                                   " ${EnxSetting.instance.joinText}",
                                      style: const TextStyle(
                                          color: Colors.white,
                                          fontWeight: FontWeight.w400,
                                          fontSize: 15),
                                    ),
                                    style: ElevatedButton.styleFrom(
                                      backgroundColor: Colors.transparent,
                                      disabledForegroundColor:
                                          Colors.transparent.withOpacity(0.38),
                                      disabledBackgroundColor:
                                          Colors.transparent.withOpacity(0.12),
                                      shadowColor: Colors.transparent,
                                      elevation: 5,
                                      shape: RoundedRectangleBorder(
                                        borderRadius:
                                            BorderRadius.circular(15.0),
                                      ),
                                      fixedSize: Size(
                                          MediaQuery.of(context).size.width / 2,
                                          50),
                                    ),
                                    onPressed: () {
                                      obj.isConfirmation.value = false;
                                      obj.cleanPreviewResource();
                                      EnxSetting.instance.isAudioOnlyCall(obj.isSelect.value[2]);
                                      EnxSetting.instance.joinAsVideoMute(obj.isSelect.value[1]);
                                      EnxSetting.instance.joinAsAudioMute(obj.isSelect.value.first);
                                      obj.configureRoom();


                                    },
                                  ),
                                ),
                              ),
                            ),
                          ],
                        ),
                      ),
                    ),
                  ),

                ],
              )
            : Row(
          crossAxisAlignment: CrossAxisAlignment.center,
          children: [
            SizedBox(
              width: MediaQuery.of(context).size.width / 2,
              height: MediaQuery.of(context).size.height - 35,
              child: obj.isSelect.value[1] || obj.isSelect.value[2]
                  ? Container(
                color: Colors.grey,
                child: const Icon(Icons.videocam_off_outlined),
              )
                  :  EnxPlayerWidget(
                0,
                local: true,
                zMediaOverlay: false,
                height: MediaQuery.of(context).size.height ~/ 1.6,
              )

            ),
            SizedBox(
              width: MediaQuery.of(context).size.width / 2,
              child: Wrap(
                alignment: WrapAlignment.center,
                children: [
                  Row(
                    mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                    children: [
                      ToggleButtons(
                        children: <Widget>[
                          obj.isSelect.value.first
                              ? Icon(Icons.mic_off_outlined)
                              : Icon(Icons.mic_none_outlined),
                          obj.isSelect.value[1]
                              ? Icon(Icons.videocam_off_outlined)
                              : Icon(Icons.video_call_outlined),
                          Padding(
                            padding: EdgeInsets.all(
                                MediaQuery.of(context).size.height / 55),
                            child: const Row(
                              children: [
                                Icon(Icons.mic_none_outlined),
                                Text("Audio Only"),
                              ],
                            ),
                          ),
                        ],
                        isSelected: obj.isSelect.value,
                        onPressed: (int index) {
                          if (index == 2) {
                            obj.isSelect.value[index] = !obj.isSelect.value[index];
                            if (obj.isVideoSelected.value) {
                              obj.isSelect.value[1] = obj.isSelect.value[1];
                            } else {
                              obj.isSelect.value[1] = !obj.isSelect.value[1];
                            }
                          } else {
                            if (obj.isSelect.value[2]) {
                              if (obj.isSelect.value[1]) {
                                obj.isSelect.value[1] = obj.isSelect.value[1];
                              }
                            } else {
                              if (index == 1) {
                                obj.isVideoSelected.value =
                                !obj.isVideoSelected.value;
                              }
                              obj.isSelect.value[index] = !obj.isSelect.value[index];
                            }
                          }
                          obj.isSelect.refresh();
                        },
                        color: Colors.grey,
                        selectedColor: CustomColors.themeColor,
                        borderColor: Colors.grey,
                        selectedBorderColor: CustomColors.themeColor,
                        constraints: BoxConstraints(
                          minHeight: 40,
                          minWidth: MediaQuery.of(context).size.width / 10,
                        ),
                      ),
                      GestureDetector(
                        onTap: () {
                          obj.settingListItem();
                          Get.to(() => SettingScreen(obj),
                              transition: Transition.leftToRight,
                              duration: const Duration(seconds: 1));
                        },
                        child: Container(
                          decoration: BoxDecoration(
                            border: Border.all(color: Colors.grey),
                          ),
                          child: Padding(
                            padding: EdgeInsets.all(
                                MediaQuery.of(context).size.height / 45),
                            child: Icon(Icons.settings_outlined),
                          ),
                        ),
                      ),
                    ],
                  ),
                  Padding(
                    padding: EdgeInsets.only(
                      top: MediaQuery.of(context).size.height / 20,
                      left: MediaQuery.of(context).size.height / 8,
                      right: MediaQuery.of(context).size.height / 8,
                    ),
                    child: Center(
                      child: DecoratedBox(
                        decoration: BoxDecoration(
                          gradient: const LinearGradient(
                            colors: [
                              Colors.pinkAccent,
                              Colors.pink,
                              CustomColors.themeColor,
                            ],
                          ),
                          borderRadius: BorderRadius.circular(15),
                        ),
                        child: ElevatedButton(
                          child:  Text(
                           " ${EnxSetting.instance.joinText}" ,
                            style: const TextStyle(
                                color: Colors.white,
                                fontWeight: FontWeight.w400,
                                fontSize: 15),
                          ),
                          style: ElevatedButton.styleFrom(
                            backgroundColor: Colors.transparent,
                            disabledForegroundColor:
                            Colors.transparent.withOpacity(0.38),
                            disabledBackgroundColor:
                            Colors.transparent.withOpacity(0.12),
                            shadowColor: Colors.transparent,
                            elevation: 5,
                            shape: RoundedRectangleBorder(
                              borderRadius: BorderRadius.circular(15.0),
                            ),
                            fixedSize: Size(
                                MediaQuery.of(context).size.width / 2, 50),
                          ),
                          onPressed: () {
                            obj.isConfirmation.value = false;
                            obj.configureRoom();
                          },
                        ),
                      ),
                    ),
                  ),
                ],
              ),
            )
          ],
        )

      ],
    ),
  );
}