showRequestDialog function

Future showRequestDialog(
  1. dynamic context,
  2. EnxController obj
)

Implementation

Future showRequestDialog(context, EnxController obj)  {

 return
   showDialog(
       context: context,
       useSafeArea: true,
       builder: (BuildContext context) {
         return obj.lobbyRequestArrayList.isEmpty
             ? SimpleDialog(elevation: 20, children: [
           Center(
               child: Text(
                 'No Request found',
                 style: TextStyle(color: Colors.black, fontSize: 17.sp),
               ))
         ])
             : Obx(() =>Dialog(

             insetPadding: const EdgeInsets.all(10),
             child: ListView(shrinkWrap: true, children: [
               for (var item in obj.lobbyRequestArrayList)
                 Padding(
                   padding: const EdgeInsets.all(8.0),
                   child: ListTile(
                     leading: const Icon(Icons.person_outlined,size: 35,),
                     title: Text(
                       '${item.name}  has joined meeting. Please allow or deny the entry.',
                    style: TextStyle(fontSize: MediaQuery.of(context).size.width/22,fontWeight: FontWeight.w500), ),
                     subtitle: Padding(
                       padding: const EdgeInsets.all(8.0),
                       child: Row(
                         mainAxisAlignment: MainAxisAlignment.spaceAround,
                         mainAxisSize: MainAxisSize.max,

                         children: [
                           ElevatedButton(
                             onPressed: () {
                               obj.approveAwaitedUser(item);
                              // obj.acceptFloors(item.clientId);
                               Get.back();
                             },
                             child: const Padding(
                               padding: EdgeInsets.only(left: 20.0,right: 20.0),
                               child: Text('Allow'),
                             ),
                             style: ButtonStyle(
                                 backgroundColor:
                                 WidgetStateProperty.all<Color>(
                                     CustomColors.themeColor),
                                 shape: WidgetStateProperty.all<
                                     RoundedRectangleBorder>(
                                     RoundedRectangleBorder(
                                         borderRadius:
                                         BorderRadius.circular(12.0),
                                         side: const BorderSide(
                                             color: CustomColors.themeColor)))),
                           ),
                           Padding(
                             padding: const EdgeInsets.only(left: 2.0),
                             child: ElevatedButton(
                               onPressed: () {

                                 obj.denyAwaitedUser(item);
                                 obj.lobbyRequestArrayList.remove(item);
                                 obj.refresh();
                                 if(obj.lobbyRequestArrayList.isEmpty) {
                                   Get.back();
                                 }
                               },
                               child: const Padding(
                                 padding:  EdgeInsets.only(left: 20.0,right: 20),
                                 child: Text('Deny'),
                               ),
                               style: ButtonStyle(
                                   backgroundColor:
                                   WidgetStateProperty.all<Color>(
                                       CustomColors.themeColor),
                                   shape: WidgetStateProperty.all<
                                       RoundedRectangleBorder>(
                                       RoundedRectangleBorder(
                                           borderRadius:
                                           BorderRadius.circular(12.0),
                                           side: const BorderSide(
                                               color: CustomColors.themeColor)))),
                             ),
                           ),

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

}