memspace / zefyr

Soft and gentle rich text editing for Flutter applications.
https://zefyr-editor.gitbook.io
2.22k stars 550 forks source link

FocusNode instance is not created if not given #522

Closed Amir-P closed 3 years ago

Amir-P commented 3 years ago

According to the comments of focusNode field of widgets/editor.dart, the focusNode can is optional and should be created by editor if is not given. But it's not implemented correctly and throws exception if you don't provide editor with a FocusNode.

Steps to Reproduce

  1. Create a ZefyrField or ZefyrEditor without setting focusNode
  2. Run

Logs

The following _CastError was thrown building ZefyrEditor(dirty, dependencies:
[_LocalizationsScope-[GlobalKey#14022], _InheritedTheme], state:
_ZefyrEditorState#d0f2e):
Null check operator used on a null value

When the exception was thrown, this was the stack:
#0      _ZefyrEditorState.build (package:zefyr/src/widgets/editor.dart:283:34)