flutter-code-editor
flutter-code-editor copied to clipboard
Refactor suggestions
The current problems with suggestions:
- ~~They cannot be disabled~~, #206
- CodeController is aware of them by owning PopupController and commanding it.
- They are generally poorly designed because we did not clean them up when got ownership.
- The widget cannot be customized.
- ~~Cannot be closed by Escape~~, #219
- Box is flipped if in the bottom there's not enough space for max suggestion box height not the actual needed height.
- Positioning is not covered by tests.
The idea is to have CodeFieldOverlay
widget that has:
-
CodeController controller
-
CodeField child
(or maybe we can allowCodeField
anywhere in the tree below).
CodeFieldOverlay
listens to controller
and can show and hide the popup.
To disable suggestions, CodeField
should be created without CodeFieldOverlay
.
To customize the suggestion box, one can copy our CodeFieldOverlay
and make it show any other box.
Later we can add overlay builders to CodeFieldOverlay
to simplify customization further.