NoteTagEditor: Add the tag when hitting Enter

This commit is contained in:
Vishesh Handa
2020-07-09 17:51:01 +02:00
parent 27bcb09edf
commit 4e61c21088

View File

@ -53,6 +53,7 @@ class _NoteTagEditorState extends State<NoteTagEditor> {
hintText: tr('editors.common.tags'),
hintStyle: theme.inputDecorationTheme.hintStyle,
),
onSubmitted: _addTag,
),
),
body: buildView(_textController.text),
@ -109,13 +110,15 @@ class _NoteTagEditorState extends State<NoteTagEditor> {
return ListTile(
leading: const Icon(Icons.add),
title: Text(tag),
onTap: () {
setState(() {
_selectedTags.add(tag);
_allTags.add(tag);
_textController.text = "";
});
},
onTap: () => _addTag(tag),
);
}
void _addTag(String tag) {
setState(() {
_selectedTags.add(tag);
_allTags.add(tag);
_textController.text = "";
});
}
}