From 199bcf5cbbeff4dfa1ac092bbe59070c365dfc21 Mon Sep 17 00:00:00 2001 From: Richard Shiue <71320345+richardshiue@users.noreply.github.com> Date: Wed, 4 Sep 2024 17:18:08 +0800 Subject: [PATCH] chore: use standard dialog componet --- .../database/widgets/field/field_editor.dart | 35 ++++++++++--------- frontend/resources/translations/en.json | 3 +- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/field/field_editor.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/field/field_editor.dart index f96220a61d183..baad43c5326a1 100644 --- a/frontend/appflowy_flutter/lib/plugins/database/widgets/field/field_editor.dart +++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/field/field_editor.dart @@ -86,9 +86,9 @@ class _FieldEditorState extends State { builder: (context, isNull) { return isNull ? const SizedBox.shrink() - : _currentPage == FieldEditorPage.details - ? _fieldDetails() - : _fieldGeneral(); + : _currentPage == FieldEditorPage.general + ? _fieldGeneral() + : _fieldDetails(); }, ), ); @@ -336,32 +336,33 @@ enum FieldAction { ); break; case FieldAction.clearData: - NavigatorAlertDialog( - constraints: const BoxConstraints( - maxWidth: 250, - maxHeight: 260, - ), - title: LocaleKeys.grid_field_clearFieldPromptMessage.tr(), - confirm: () { + PopoverContainer.of(context).closeAll(); + showCancelAndConfirmDialog( + context: context, + title: LocaleKeys.grid_field_label.tr(), + description: LocaleKeys.grid_field_clearFieldPromptMessage.tr(), + confirmLabel: LocaleKeys.button_confirm.tr(), + onConfirm: () { FieldBackendService.clearField( viewId: viewId, fieldId: fieldInfo.id, ); }, - ).show(context); - PopoverContainer.of(context).close(); + ); break; case FieldAction.delete: - NavigatorAlertDialog( - title: LocaleKeys.grid_field_deleteFieldPromptMessage.tr(), - confirm: () { + PopoverContainer.of(context).closeAll(); + showConfirmDeletionDialog( + context: context, + name: LocaleKeys.grid_field_label.tr(), + description: LocaleKeys.grid_field_deleteFieldPromptMessage.tr(), + onConfirm: () { FieldBackendService.deleteField( viewId: viewId, fieldId: fieldInfo.id, ); }, - ).show(context); - PopoverContainer.of(context).closeAll(); + ); break; case FieldAction.wrap: context diff --git a/frontend/resources/translations/en.json b/frontend/resources/translations/en.json index 9e1e271445f95..36aad541bded0 100644 --- a/frontend/resources/translations/en.json +++ b/frontend/resources/translations/en.json @@ -1294,6 +1294,7 @@ "isNotEmpty": "Is not empty" }, "field": { + "label": "Property", "hide": "Hide", "show": "Show", "insertLeft": "Insert Left", @@ -1346,7 +1347,7 @@ "editProperty": "Edit property", "newProperty": "New property", "openRowDocument": "Open as a page", - "deleteFieldPromptMessage": "Are you sure? This property will be deleted", + "deleteFieldPromptMessage": "Are you sure? This property and all its data will be deleted", "clearFieldPromptMessage": "Are you sure? All cells in this column will be emptied", "newColumn": "New Column", "format": "Format",