showRoomSettingDialog function

Future showRoomSettingDialog(
  1. BuildContext context,
  2. EnxController obj
)

Implementation

Future showRoomSettingDialog(BuildContext context, EnxController obj) {
  return showGeneralDialog(
    context: context,
    barrierDismissible: true,
    barrierLabel: 'Dismiss room settings',
    barrierColor: EnxUiKitTheme.scrim(context),
    transitionDuration: const Duration(milliseconds: 300),
    pageBuilder: (context, animation, secondaryAnimation) {
      return SafeArea(
        child: OrientationBuilder(
          builder: (context, orientation) {
            final mediaQuery = MediaQuery.of(context);
            final panelWidth =
                EnxUiKitTheme.sidePanelWidth(mediaQuery.size, orientation);

            return Align(
              alignment: Alignment.centerRight,
              child: Obx(
                () => Container(
                  width: panelWidth,
                  height: double.infinity,
                  decoration: BoxDecoration(
                    color: EnxUiKitTheme.surface(context),
                    border: Border.all(color: EnxUiKitTheme.border(context)),
                    borderRadius: const BorderRadius.only(
                      topLeft: Radius.circular(15.0),
                      bottomLeft: Radius.circular(15.0),
                    ),
                  ),
                  child: Material(
                    type: MaterialType.transparency,
                    child: ListView(
                      padding: EdgeInsets.fromLTRB(
                        20,
                        24,
                        20,
                        mediaQuery.padding.bottom + 24,
                      ),
                      children: [
                        Text(
                          "Screen Share Control",
                          style: EnxUiKitTheme.titleStyle(context)?.copyWith(
                            fontSize: 18,
                            fontWeight: FontWeight.w700,
                          ),
                        ),
                        const SizedBox(height: 20),
                        DropdownButtonFormField<String>(
                          initialValue: obj.selected.value,
                          isExpanded: true,
                          decoration: InputDecoration(
                            contentPadding: const EdgeInsets.symmetric(
                              horizontal: 16,
                              vertical: 12,
                            ),
                            border: OutlineInputBorder(
                              borderRadius: BorderRadius.circular(12),
                            ),
                            enabledBorder: OutlineInputBorder(
                              borderRadius: BorderRadius.circular(12),
                              borderSide: BorderSide(
                                  color: EnxUiKitTheme.border(context)),
                            ),
                          ),
                          onChanged: (newValue) {
                            obj.selected.value = newValue!;
                          },
                          items: [
                            for (var value in obj.listType)
                              DropdownMenuItem(
                                value: value,
                                child: Text(
                                  value,
                                  overflow: TextOverflow.ellipsis,
                                ),
                              ),
                          ],
                        ),
                        const SizedBox(height: 24),
                        SizedBox(
                          width: double.infinity,
                          child: DecoratedBox(
                            decoration: BoxDecoration(
                              gradient: const LinearGradient(
                                colors: [
                                  Colors.pinkAccent,
                                  Colors.pink,
                                  CustomColors.themeColor,
                                ],
                              ),
                              borderRadius: BorderRadius.circular(15),
                            ),
                            child: ElevatedButton(
                              style: ElevatedButton.styleFrom(
                                backgroundColor: Colors.transparent,
                                disabledForegroundColor:
                                    Colors.transparent.withAlpha(97),
                                disabledBackgroundColor:
                                    Colors.transparent.withAlpha(31),
                                shadowColor: Colors.transparent,
                                elevation: 5,
                                shape: RoundedRectangleBorder(
                                  borderRadius: BorderRadius.circular(15.0),
                                ),
                                minimumSize: const Size.fromHeight(44),
                              ),
                              onPressed: () {
                                EnxPubMode enxPubMode = EnxPubMode.all;

                                if (obj.selected.value == 'Everyone') {
                                  enxPubMode = EnxPubMode.all;
                                } else if (obj.selected.value ==
                                    'Moderator Only') {
                                  enxPubMode = EnxPubMode.moderators;
                                } else if (obj.selected.value ==
                                    'Moderator grants Permission') {
                                  enxPubMode = EnxPubMode.authorize;
                                }
                                obj.setPermissionInShareMode(enxPubMode);
                                Get.back();
                              },
                              child: const Text(
                                "Apply",
                                style: TextStyle(
                                  color: Colors.white,
                                  fontWeight: FontWeight.w600,
                                  fontSize: 15,
                                ),
                              ),
                            ),
                          ),
                        ),
                      ],
                    ),
                  ),
                ),
              ),
            );
          },
        ),
      );
    },
    transitionBuilder: (context, animation, secondaryAnimation, child) {
      return SlideTransition(
        position: Tween<Offset>(
          begin: const Offset(1, 0),
          end: Offset.zero,
        ).animate(CurvedAnimation(
          parent: animation,
          curve: Curves.easeOut,
        )),
        child: child,
      );
    },
  );
}