mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-30 03:19:11 +08:00
Note Tag Editor: Add a FAB
It's not obvious that you can click on the app bar to start typing.
This commit is contained in:
@ -14,6 +14,7 @@ class NoteTagEditor extends StatefulWidget {
|
|||||||
|
|
||||||
class _NoteTagEditorState extends State<NoteTagEditor> {
|
class _NoteTagEditorState extends State<NoteTagEditor> {
|
||||||
TextEditingController _textController;
|
TextEditingController _textController;
|
||||||
|
FocusNode _focusNode;
|
||||||
|
|
||||||
Set<String> _selectedTags;
|
Set<String> _selectedTags;
|
||||||
Set<String> _allTags;
|
Set<String> _allTags;
|
||||||
@ -24,6 +25,7 @@ class _NoteTagEditorState extends State<NoteTagEditor> {
|
|||||||
|
|
||||||
_selectedTags = Set<String>.from(widget.selectedTags);
|
_selectedTags = Set<String>.from(widget.selectedTags);
|
||||||
_allTags = Set<String>.from(widget.allTags);
|
_allTags = Set<String>.from(widget.allTags);
|
||||||
|
_focusNode = FocusNode();
|
||||||
_textController = TextEditingController();
|
_textController = TextEditingController();
|
||||||
_textController.addListener(() {
|
_textController.addListener(() {
|
||||||
setState(() {});
|
setState(() {});
|
||||||
@ -43,6 +45,7 @@ class _NoteTagEditorState extends State<NoteTagEditor> {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
title: TextField(
|
title: TextField(
|
||||||
|
focusNode: _focusNode,
|
||||||
controller: _textController,
|
controller: _textController,
|
||||||
style: theme.textTheme.headline6,
|
style: theme.textTheme.headline6,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
@ -53,6 +56,12 @@ class _NoteTagEditorState extends State<NoteTagEditor> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
body: buildView(_textController.text),
|
body: buildView(_textController.text),
|
||||||
|
floatingActionButton: FloatingActionButton(
|
||||||
|
child: const Icon(Icons.add),
|
||||||
|
onPressed: () {
|
||||||
|
_focusNode.requestFocus();
|
||||||
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
return WillPopScope(
|
return WillPopScope(
|
||||||
|
Reference in New Issue
Block a user