|  |  |  | @ -24,6 +24,11 @@ class _NotesNotePageState extends State<NotesNotePage> { | 
			
		
	
		
			
				
					|  |  |  |  |   bool _showEditor = false; | 
			
		
	
		
			
				
					|  |  |  |  |   bool _synced = true; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |   void _focusEditor() { | 
			
		
	
		
			
				
					|  |  |  |  |     _contentFocusNode.requestFocus(); | 
			
		
	
		
			
				
					|  |  |  |  |     _contentController.selection = TextSelection.collapsed(offset: _contentController.text.length); | 
			
		
	
		
			
				
					|  |  |  |  |   } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |   void _update([final String? selectedCategory]) { | 
			
		
	
		
			
				
					|  |  |  |  |     final updatedTitle = _note.title != _titleController.text ? _titleController.text : null; | 
			
		
	
		
			
				
					|  |  |  |  |     final updatedCategory = selectedCategory != null && _note.category != selectedCategory ? selectedCategory : null; | 
			
		
	
	
		
			
				
					|  |  |  | @ -76,8 +81,7 @@ class _NotesNotePageState extends State<NotesNotePage> { | 
			
		
	
		
			
				
					|  |  |  |  |         setState(() { | 
			
		
	
		
			
				
					|  |  |  |  |           _showEditor = true; | 
			
		
	
		
			
				
					|  |  |  |  |         }); | 
			
		
	
		
			
				
					|  |  |  |  |         _contentFocusNode.requestFocus(); | 
			
		
	
		
			
				
					|  |  |  |  |         _contentController.selection = TextSelection.collapsed(offset: _contentController.text.length); | 
			
		
	
		
			
				
					|  |  |  |  |         _focusEditor(); | 
			
		
	
		
			
				
					|  |  |  |  |       } | 
			
		
	
		
			
				
					|  |  |  |  |     }); | 
			
		
	
		
			
				
					|  |  |  |  |   } | 
			
		
	
	
		
			
				
					|  |  |  | @ -132,8 +136,7 @@ class _NotesNotePageState extends State<NotesNotePage> { | 
			
		
	
		
			
				
					|  |  |  |  |                   _showEditor = !_showEditor; | 
			
		
	
		
			
				
					|  |  |  |  |                 }); | 
			
		
	
		
			
				
					|  |  |  |  |                 if (_showEditor) { | 
			
		
	
		
			
				
					|  |  |  |  |                   _contentFocusNode.requestFocus(); | 
			
		
	
		
			
				
					|  |  |  |  |                   _contentController.selection = TextSelection.collapsed(offset: _contentController.text.length); | 
			
		
	
		
			
				
					|  |  |  |  |                   _focusEditor(); | 
			
		
	
		
			
				
					|  |  |  |  |                 } else { | 
			
		
	
		
			
				
					|  |  |  |  |                   // Prevent the cursor going back to the title field | 
			
		
	
		
			
				
					|  |  |  |  |                   _contentFocusNode.unfocus(); | 
			
		
	
	
		
			
				
					|  |  |  | @ -161,34 +164,41 @@ class _NotesNotePageState extends State<NotesNotePage> { | 
			
		
	
		
			
				
					|  |  |  |  |             ), | 
			
		
	
		
			
				
					|  |  |  |  |           ], | 
			
		
	
		
			
				
					|  |  |  |  |         ), | 
			
		
	
		
			
				
					|  |  |  |  |         body: Container( | 
			
		
	
		
			
				
					|  |  |  |  |           padding: EdgeInsets.symmetric( | 
			
		
	
		
			
				
					|  |  |  |  |             vertical: 10, | 
			
		
	
		
			
				
					|  |  |  |  |             horizontal: _showEditor ? 20 : 10, | 
			
		
	
		
			
				
					|  |  |  |  |           ), | 
			
		
	
		
			
				
					|  |  |  |  |           color: Colors.transparent, | 
			
		
	
		
			
				
					|  |  |  |  |           constraints: const BoxConstraints.expand(), | 
			
		
	
		
			
				
					|  |  |  |  |           child: _showEditor | 
			
		
	
		
			
				
					|  |  |  |  |               ? TextField( | 
			
		
	
		
			
				
					|  |  |  |  |                   controller: _contentController, | 
			
		
	
		
			
				
					|  |  |  |  |                   focusNode: _contentFocusNode, | 
			
		
	
		
			
				
					|  |  |  |  |                   keyboardType: TextInputType.multiline, | 
			
		
	
		
			
				
					|  |  |  |  |                   maxLines: null, | 
			
		
	
		
			
				
					|  |  |  |  |                   decoration: const InputDecoration( | 
			
		
	
		
			
				
					|  |  |  |  |                     border: InputBorder.none, | 
			
		
	
		
			
				
					|  |  |  |  |         body: GestureDetector( | 
			
		
	
		
			
				
					|  |  |  |  |           onTap: () { | 
			
		
	
		
			
				
					|  |  |  |  |             setState(() { | 
			
		
	
		
			
				
					|  |  |  |  |               _showEditor = true; | 
			
		
	
		
			
				
					|  |  |  |  |             }); | 
			
		
	
		
			
				
					|  |  |  |  |           }, | 
			
		
	
		
			
				
					|  |  |  |  |           child: Container( | 
			
		
	
		
			
				
					|  |  |  |  |             padding: EdgeInsets.symmetric( | 
			
		
	
		
			
				
					|  |  |  |  |               vertical: 10, | 
			
		
	
		
			
				
					|  |  |  |  |               horizontal: _showEditor ? 20 : 10, | 
			
		
	
		
			
				
					|  |  |  |  |             ), | 
			
		
	
		
			
				
					|  |  |  |  |             color: Colors.transparent, | 
			
		
	
		
			
				
					|  |  |  |  |             constraints: const BoxConstraints.expand(), | 
			
		
	
		
			
				
					|  |  |  |  |             child: _showEditor | 
			
		
	
		
			
				
					|  |  |  |  |                 ? TextField( | 
			
		
	
		
			
				
					|  |  |  |  |                     controller: _contentController, | 
			
		
	
		
			
				
					|  |  |  |  |                     focusNode: _contentFocusNode, | 
			
		
	
		
			
				
					|  |  |  |  |                     keyboardType: TextInputType.multiline, | 
			
		
	
		
			
				
					|  |  |  |  |                     maxLines: null, | 
			
		
	
		
			
				
					|  |  |  |  |                     decoration: const InputDecoration( | 
			
		
	
		
			
				
					|  |  |  |  |                       border: InputBorder.none, | 
			
		
	
		
			
				
					|  |  |  |  |                     ), | 
			
		
	
		
			
				
					|  |  |  |  |                   ) | 
			
		
	
		
			
				
					|  |  |  |  |                 : MarkdownBody( | 
			
		
	
		
			
				
					|  |  |  |  |                     data: _contentController.text, | 
			
		
	
		
			
				
					|  |  |  |  |                     onTapLink: (final text, final href, final title) { | 
			
		
	
		
			
				
					|  |  |  |  |                       if (href != null) { | 
			
		
	
		
			
				
					|  |  |  |  |                         launchUrlString( | 
			
		
	
		
			
				
					|  |  |  |  |                           href, | 
			
		
	
		
			
				
					|  |  |  |  |                           mode: LaunchMode.externalApplication, | 
			
		
	
		
			
				
					|  |  |  |  |                         ); | 
			
		
	
		
			
				
					|  |  |  |  |                       } | 
			
		
	
		
			
				
					|  |  |  |  |                     }, | 
			
		
	
		
			
				
					|  |  |  |  |                   ), | 
			
		
	
		
			
				
					|  |  |  |  |                 ) | 
			
		
	
		
			
				
					|  |  |  |  |               : MarkdownBody( | 
			
		
	
		
			
				
					|  |  |  |  |                   data: _contentController.text, | 
			
		
	
		
			
				
					|  |  |  |  |                   onTapLink: (final text, final href, final title) { | 
			
		
	
		
			
				
					|  |  |  |  |                     if (href != null) { | 
			
		
	
		
			
				
					|  |  |  |  |                       launchUrlString( | 
			
		
	
		
			
				
					|  |  |  |  |                         href, | 
			
		
	
		
			
				
					|  |  |  |  |                         mode: LaunchMode.externalApplication, | 
			
		
	
		
			
				
					|  |  |  |  |                       ); | 
			
		
	
		
			
				
					|  |  |  |  |                     } | 
			
		
	
		
			
				
					|  |  |  |  |                   }, | 
			
		
	
		
			
				
					|  |  |  |  |                 ), | 
			
		
	
		
			
				
					|  |  |  |  |           ), | 
			
		
	
		
			
				
					|  |  |  |  |         ), | 
			
		
	
		
			
				
					|  |  |  |  |       ), | 
			
		
	
		
			
				
					|  |  |  |  |     ); | 
			
		
	
	
		
			
				
					|  |  |  | 
 |