mirror of
https://github.com/Iconica-Development/flutter_availability.git
synced 2025-05-19 05:03:44 +02:00
feat: add template deletion confirmation dialog
This commit is contained in:
parent
e8af49e694
commit
36d5cf3b92
2 changed files with 18 additions and 0 deletions
|
@ -45,6 +45,8 @@ class AvailabilityTranslations {
|
||||||
required this.templateTitleLabel,
|
required this.templateTitleLabel,
|
||||||
required this.templateColorLabel,
|
required this.templateColorLabel,
|
||||||
required this.weekTemplateOverviewTitle,
|
required this.weekTemplateOverviewTitle,
|
||||||
|
required this.templateDeleteDialogConfirmTitle,
|
||||||
|
required this.templateDeleteDialogConfirmDescription,
|
||||||
required this.pause,
|
required this.pause,
|
||||||
required this.unavailable,
|
required this.unavailable,
|
||||||
required this.time,
|
required this.time,
|
||||||
|
@ -113,6 +115,9 @@ class AvailabilityTranslations {
|
||||||
this.templateTitleLabel = "Template Title",
|
this.templateTitleLabel = "Template Title",
|
||||||
this.templateColorLabel = "Colorlabel",
|
this.templateColorLabel = "Colorlabel",
|
||||||
this.weekTemplateOverviewTitle = "Overview availability",
|
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.pause = "Pause",
|
||||||
this.unavailable = "Unavailable",
|
this.unavailable = "Unavailable",
|
||||||
this.time = "Time",
|
this.time = "Time",
|
||||||
|
@ -247,6 +252,12 @@ class AvailabilityTranslations {
|
||||||
/// The title for the week overview section
|
/// The title for the week overview section
|
||||||
final String weekTemplateOverviewTitle;
|
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
|
/// The label used for pause
|
||||||
final String pause;
|
final String pause;
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,13 @@ class _DayTemplateModificationScreenState
|
||||||
var translations = options.translations;
|
var translations = options.translations;
|
||||||
|
|
||||||
Future<void> onDeletePressed() async {
|
Future<void> onDeletePressed() async {
|
||||||
|
var isConfirmed = await options.confirmationDialogBuilder(
|
||||||
|
context,
|
||||||
|
title: translations.templateDeleteDialogConfirmTitle,
|
||||||
|
description: translations.templateDeleteDialogConfirmDescription,
|
||||||
|
);
|
||||||
|
if (!isConfirmed) return;
|
||||||
|
|
||||||
await service.deleteTemplate(widget.template!);
|
await service.deleteTemplate(widget.template!);
|
||||||
widget.onExit();
|
widget.onExit();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue