diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index 20069d5b..bbe891c3 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -13,6 +13,7 @@ "refreshAuth": "Refresh login", "totpToken": "TOTP Token (if needed)", "cancel": "Cancel", + "okay": "Okay", "rename": "Rename", "replace": "Replace", "continue_": "Continue", diff --git a/lib/src/widgets/tags/tag_editor.dart b/lib/src/widgets/tags/tag_editor.dart index c5b2f8c4..d98575b0 100644 --- a/lib/src/widgets/tags/tag_editor.dart +++ b/lib/src/widgets/tags/tag_editor.dart @@ -111,14 +111,32 @@ class _TagEditorState extends State { padding: const EdgeInsets.only(right: 8), child: FilledButton( onPressed: () async { - final tag = await ac.setTag( - Tag( - id: widget.tag.id, - tag: _tagController.text, - backgroundColor: _backgroundColor, - textColor: _textColor, - ), - ); + Tag tag; + try { + tag = await ac.setTag( + Tag( + id: widget.tag.id, + tag: _tagController.text, + backgroundColor: _backgroundColor, + textColor: _textColor, + ), + ); + } catch (err) { + if (!context.mounted) return; + await showDialog( + context: context, + builder: (context) => AlertDialog( + title: Text(l(context).tags_exist), + actions: [ + OutlinedButton( + onPressed: () => Navigator.pop(context), + child: Text(l(context).okay), + ), + ], + ), + ); + return; + } widget.onUpdate(tag); if (!context.mounted) return; Navigator.pop(context);