showRoomSettingDialog function
Implementation
Future showRoomSettingDialog(context, EnxController obj) {
return showGeneralDialog(
context: context,
barrierDismissible: true,
barrierLabel: '',
barrierColor: Colors.black.withOpacity(0.5),
transitionDuration: const Duration(milliseconds: 300),
pageBuilder: (context, animation, secondaryAnimation) {
return SafeArea(
child: OrientationBuilder(
builder: (context, orientation) {
final isPortrait = orientation == Orientation.portrait;
final widthPercentage = isPortrait ? 0.8 : 0.5;
return Align(
alignment: Alignment.centerRight,
child: Obx(
() => Container(
width: MediaQuery.of(context).size.width * widthPercentage,
height: double.infinity,
margin: const EdgeInsets.only(left: 10),
decoration: BoxDecoration(
color: Colors.white,
border: Border.all(width: 1.0),
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(15.0),
bottomLeft: Radius.circular(15.0),
),
),
child: Material(
type: MaterialType.transparency,
child: ListView(
shrinkWrap: true,
children: [
Center(
child: Padding(
padding: EdgeInsets.all(20.h),
child: Text(
"Screen Share Control",
style: TextStyle(
fontSize: 18.sp,
color: Theme.of(context).primaryColor,
fontWeight: FontWeight.bold,
),
),
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Center(
child: Material(
elevation: 2,
borderRadius: BorderRadius.circular(8),
child: DropdownButton<String>(
onChanged: (newValue) {
obj.selected.value = newValue!;
},
value: obj.selected.value,
items: [
for (var value in obj.listType)
DropdownMenuItem(
value: value,
child: Text(value),
),
],
),
),
),
),
Center(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: DecoratedBox(
decoration: BoxDecoration(
gradient: const LinearGradient(
colors: [
Colors.pinkAccent,
Colors.pink,
CustomColors.themeColor,
],
),
borderRadius: BorderRadius.circular(15),
),
child: ElevatedButton(
child: const Text(
"Apply",
style: 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 / 3,
40,
),
),
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();
},
),
),
),
),
],
),
),
),
),
);
},
),
);
},
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,
);
},
);
}