|
|
@ -24,11 +24,6 @@ class _NotesNotePageState extends State<NotesNotePage> { |
|
|
|
bool _showEditor = false; |
|
|
|
bool _showEditor = false; |
|
|
|
bool _synced = true; |
|
|
|
bool _synced = true; |
|
|
|
|
|
|
|
|
|
|
|
void _focusEditor() { |
|
|
|
|
|
|
|
_contentFocusNode.requestFocus(); |
|
|
|
|
|
|
|
_contentController.selection = TextSelection.collapsed(offset: _contentController.text.length); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void _update([final String? selectedCategory]) { |
|
|
|
void _update([final String? selectedCategory]) { |
|
|
|
final updatedTitle = _note.title != _titleController.text ? _titleController.text : null; |
|
|
|
final updatedTitle = _note.title != _titleController.text ? _titleController.text : null; |
|
|
|
final updatedCategory = selectedCategory != null && _note.category != selectedCategory ? selectedCategory : null; |
|
|
|
final updatedCategory = selectedCategory != null && _note.category != selectedCategory ? selectedCategory : null; |
|
|
@ -137,7 +132,8 @@ class _NotesNotePageState extends State<NotesNotePage> { |
|
|
|
_showEditor = !_showEditor; |
|
|
|
_showEditor = !_showEditor; |
|
|
|
}); |
|
|
|
}); |
|
|
|
if (_showEditor) { |
|
|
|
if (_showEditor) { |
|
|
|
_focusEditor(); |
|
|
|
_contentFocusNode.requestFocus(); |
|
|
|
|
|
|
|
_contentController.selection = TextSelection.collapsed(offset: _contentController.text.length); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
// Prevent the cursor going back to the title field |
|
|
|
// Prevent the cursor going back to the title field |
|
|
|
_contentFocusNode.unfocus(); |
|
|
|
_contentFocusNode.unfocus(); |
|
|
@ -165,14 +161,7 @@ class _NotesNotePageState extends State<NotesNotePage> { |
|
|
|
), |
|
|
|
), |
|
|
|
], |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
body: GestureDetector( |
|
|
|
body: Container( |
|
|
|
onTap: () { |
|
|
|
|
|
|
|
setState(() { |
|
|
|
|
|
|
|
_showEditor = true; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
_focusEditor(); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
child: Container( |
|
|
|
|
|
|
|
padding: EdgeInsets.symmetric( |
|
|
|
padding: EdgeInsets.symmetric( |
|
|
|
vertical: 10, |
|
|
|
vertical: 10, |
|
|
|
horizontal: _showEditor ? 20 : 10, |
|
|
|
horizontal: _showEditor ? 20 : 10, |
|
|
@ -202,7 +191,6 @@ class _NotesNotePageState extends State<NotesNotePage> { |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
|
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|