showLogOutDialog static method

void showLogOutDialog({
  1. required BuildContext context,
})

Implementation

static void showLogOutDialog({
  required BuildContext context,
  // required Function() loOugMethod;
}) {
  BuildContext? dialogContext = NavigatorService.navigatorKey.currentContext;
  if (dialogContext != null) {
  } else {}
  Dialogs.materialDialog(
      msg: 'logout_msg'.tr,
      title: 'logout_title'.tr,
      context: context,
      actions: [
        IconsOutlineButton(
          onPressed: () {
            Navigator.of(context).pop();
            // Navigator.of(dialogContext!).pop();
          },
          text: 'lbl_cancel'.tr,
          iconData: Icons.cancel_outlined,
          textStyle: TextStyle(color: Colors.grey),
          iconColor: Colors.grey,
        ),
        IconsButton(
          onPressed: () async {
            SharedPreferences prefs = await SharedPreferences.getInstance();
            String? sessionToken = prefs.getString('sessionToken');

            if (sessionToken != null) {
              await prefs.remove('sessionToken');

              // final user = await ParseUser.currentUser() as ParseUser;
              // var response = await user.logout();

              // if (response.success) {
              //   Logger.log("User was successfully logged out");
              //   NavigatorService.pushNamedAndRemoveUntil(
              //       AppRoutes.f1WelcomebackScreen);
              // } else {
              //   Logger.log("Error LOG OUT");
              // }
            }
          },
          text: 'Log out',
          iconData: Icons.logout,
          color: Colors.red,
          textStyle: TextStyle(color: Colors.white),
          iconColor: Colors.white,
        ),
      ]);
}