showExitConfirmationDialog static method

Future<bool> showExitConfirmationDialog(
  1. BuildContext context
)

Implementation

static Future<bool> showExitConfirmationDialog(BuildContext context) async {
  return await showDialog<bool>(
    context: context,
    builder: (context) => AlertDialog(
      backgroundColor: AppColor.getMain(),
      title: Text(AppProperties.getAppName().capitalize),
      content: Text(CommonTranslationConstants.wantToCloseApp.tr),
      actions: <Widget>[
        TextButton(
          child: Text(
            AppTranslationConstants.no.tr,
            style: const TextStyle(color: AppColor.white),
          ),
          onPressed: () => Navigator.of(context).pop(false),
        ),
        TextButton(
          child: Text(
            AppTranslationConstants.yes.tr,
            style: const TextStyle(color: AppColor.white),
          ),
          onPressed: () => Navigator.of(context).pop(true),
        ),
      ],
    ),
  ) ?? false;
}