diff --git a/packages/flutter_availability/lib/src/config/availability_translations.dart b/packages/flutter_availability/lib/src/config/availability_translations.dart index ceded7f..6b64007 100644 --- a/packages/flutter_availability/lib/src/config/availability_translations.dart +++ b/packages/flutter_availability/lib/src/config/availability_translations.dart @@ -45,6 +45,8 @@ class AvailabilityTranslations { required this.templateTitleLabel, required this.templateColorLabel, required this.weekTemplateOverviewTitle, + required this.templateDeleteDialogConfirmTitle, + required this.templateDeleteDialogConfirmDescription, required this.pause, required this.unavailable, required this.time, @@ -113,6 +115,9 @@ class AvailabilityTranslations { this.templateTitleLabel = "Template Title", this.templateColorLabel = "Colorlabel", this.weekTemplateOverviewTitle = "Overview availability", + this.templateDeleteDialogConfirmTitle = "Are you sure you want to delete?", + this.templateDeleteDialogConfirmDescription = + "You can't undo this deletion", this.pause = "Pause", this.unavailable = "Unavailable", this.time = "Time", @@ -247,6 +252,12 @@ class AvailabilityTranslations { /// The title for the week overview section final String weekTemplateOverviewTitle; + /// The title on the dialog for confirming the template delete + final String templateDeleteDialogConfirmTitle; + + /// The description on the dialog for confirming the template delete + final String templateDeleteDialogConfirmDescription; + /// The label used for pause final String pause; diff --git a/packages/flutter_availability/lib/src/ui/screens/template_day_modification.dart b/packages/flutter_availability/lib/src/ui/screens/template_day_modification.dart index 52154de..ea7181f 100644 --- a/packages/flutter_availability/lib/src/ui/screens/template_day_modification.dart +++ b/packages/flutter_availability/lib/src/ui/screens/template_day_modification.dart @@ -51,6 +51,13 @@ class _DayTemplateModificationScreenState var translations = options.translations; Future onDeletePressed() async { + var isConfirmed = await options.confirmationDialogBuilder( + context, + title: translations.templateDeleteDialogConfirmTitle, + description: translations.templateDeleteDialogConfirmDescription, + ); + if (!isConfirmed) return; + await service.deleteTemplate(widget.template!); widget.onExit(); }