|
|
@ -15,8 +15,8 @@ class NotesNotePage extends StatefulWidget { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
class _NotesNotePageState extends State<NotesNotePage> { |
|
|
|
class _NotesNotePageState extends State<NotesNotePage> { |
|
|
|
late final _contentController = TextEditingController()..text = widget.bloc.initialContent; |
|
|
|
final _contentController = TextEditingController(); |
|
|
|
late final _titleController = TextEditingController()..text = widget.bloc.initialTitle; |
|
|
|
final _titleController = TextEditingController(); |
|
|
|
final _contentFocusNode = FocusNode(); |
|
|
|
final _contentFocusNode = FocusNode(); |
|
|
|
final _titleFocusNode = FocusNode(); |
|
|
|
final _titleFocusNode = FocusNode(); |
|
|
|
bool _showEditor = false; |
|
|
|
bool _showEditor = false; |
|
|
@ -36,6 +36,9 @@ class _NotesNotePageState extends State<NotesNotePage> { |
|
|
|
handleNotesException(context, error); |
|
|
|
handleNotesException(context, error); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_contentController.text = widget.bloc.initialContent; |
|
|
|
|
|
|
|
_titleController.text = widget.bloc.initialTitle; |
|
|
|
|
|
|
|
|
|
|
|
_contentStreamController.stream.debounceTime(const Duration(seconds: 1)).listen(widget.bloc.updateContent); |
|
|
|
_contentStreamController.stream.debounceTime(const Duration(seconds: 1)).listen(widget.bloc.updateContent); |
|
|
|
_titleStreamController.stream.debounceTime(const Duration(seconds: 1)).listen(widget.bloc.updateTitle); |
|
|
|
_titleStreamController.stream.debounceTime(const Duration(seconds: 1)).listen(widget.bloc.updateTitle); |
|
|
|
_contentController.addListener(() => _contentStreamController.add(_contentController.text)); |
|
|
|
_contentController.addListener(() => _contentStreamController.add(_contentController.text)); |
|
|
@ -56,6 +59,8 @@ class _NotesNotePageState extends State<NotesNotePage> { |
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
@override |
|
|
|
void dispose() { |
|
|
|
void dispose() { |
|
|
|
|
|
|
|
_contentController.dispose(); |
|
|
|
|
|
|
|
_titleController.dispose(); |
|
|
|
unawaited(_contentStreamController.close()); |
|
|
|
unawaited(_contentStreamController.close()); |
|
|
|
unawaited(_titleStreamController.close()); |
|
|
|
unawaited(_titleStreamController.close()); |
|
|
|
super.dispose(); |
|
|
|
super.dispose(); |
|
|
|