mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-29 18:38:36 +08:00
NoteTagEditor: Add the tag when hitting Enter
This commit is contained in:
@ -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 = "";
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user