mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-07-02 04:47:01 +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'),
|
hintText: tr('editors.common.tags'),
|
||||||
hintStyle: theme.inputDecorationTheme.hintStyle,
|
hintStyle: theme.inputDecorationTheme.hintStyle,
|
||||||
),
|
),
|
||||||
|
onSubmitted: _addTag,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
body: buildView(_textController.text),
|
body: buildView(_textController.text),
|
||||||
@ -109,13 +110,15 @@ class _NoteTagEditorState extends State<NoteTagEditor> {
|
|||||||
return ListTile(
|
return ListTile(
|
||||||
leading: const Icon(Icons.add),
|
leading: const Icon(Icons.add),
|
||||||
title: Text(tag),
|
title: Text(tag),
|
||||||
onTap: () {
|
onTap: () => _addTag(tag),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _addTag(String tag) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_selectedTags.add(tag);
|
_selectedTags.add(tag);
|
||||||
_allTags.add(tag);
|
_allTags.add(tag);
|
||||||
_textController.text = "";
|
_textController.text = "";
|
||||||
});
|
});
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user