shareRequestDialog function

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

Implementation

Future shareRequestDialog(context, EnxController obj) {
 return showDialog(
      context: context,
      builder: (BuildContext context) {
        return obj.shareRequestList.isEmpty
            ? SimpleDialog(elevation: 20, children: [
          Center(
              child: Text(
                'No Request found',
                style: TextStyle(color: Colors.black, fontSize: 17.sp),
              ))
        ])
            : Dialog(
            insetPadding: const EdgeInsets.all(10),
            child: ListView(shrinkWrap: true, children: [
              for (var item in obj.shareRequestList)
                ListTile(
                  leading: const Icon(Icons.person_outlined),
                  title: Text(
                    item.name,
                  ),
                  trailing: Row(
                    mainAxisSize: MainAxisSize.min,
                    children: [
                      Visibility(
                        visible: item.isRequestAccepted,
                        child: ElevatedButton(
                          onPressed: () {
                            obj.screenShareRequestAccepted(item);
                            Get.back();
                          },
                          child: const Text('Accept'),
                          style: ButtonStyle(
                              backgroundColor:
                              WidgetStateProperty.all<Color>(
                                  CustomColors.themeColor),
                              shape: WidgetStateProperty.all<
                                  RoundedRectangleBorder>(
                                  RoundedRectangleBorder(
                                      borderRadius:
                                      BorderRadius.circular(12.0),
                                      side: const BorderSide(
                                          color: CustomColors.themeColor)))),
                        ),
                      ),
                      Visibility(
                        visible: item.isRequestRejected,
                        child: Padding(
                          padding: const EdgeInsets.only(left: 2.0),
                          child: ElevatedButton(
                            onPressed: () {
                              obj.screenShareRequestRejected(item);
                              Get.back();
                            },
                            child: const Text('Reject'),
                            style: ButtonStyle(
                                backgroundColor:
                                WidgetStateProperty.all<Color>(
                                    CustomColors.themeColor),
                                shape: WidgetStateProperty.all<
                                    RoundedRectangleBorder>(
                                    RoundedRectangleBorder(
                                        borderRadius:
                                        BorderRadius.circular(12.0),
                                        side: const BorderSide(
                                            color: CustomColors.themeColor)))),
                          ),
                        ),
                      ),
                      Visibility(
                          visible: item.isRequestReleased,
                          child: Padding(
                            padding: const EdgeInsets.only(left: 2.0),
                            child: ElevatedButton(
                              onPressed: () {
                                obj.screenShareRequestRevoked(item);
                                Get.back();
                              },
                              child: const Text('Revoke'),
                              style: ButtonStyle(
                                  backgroundColor:
                                  WidgetStateProperty.all<Color>(
                                      CustomColors.themeColor),
                                  shape: WidgetStateProperty.all<
                                      RoundedRectangleBorder>(
                                      RoundedRectangleBorder(
                                          borderRadius:
                                          BorderRadius.circular(12.0),
                                          side: const BorderSide(
                                              color: CustomColors.themeColor)))),
                            ),
                          )),
                    ],
                  ),
                ),
            ]));
      });
}