flutter-code-editor icon indicating copy to clipboard operation
flutter-code-editor copied to clipboard

Refactor suggestions

Open alexeyinkin opened this issue 1 year ago • 1 comments

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.

alexeyinkin avatar Apr 11 '23 12:04 alexeyinkin

The idea is to have CodeFieldOverlay widget that has:

  • CodeController controller
  • CodeField child (or maybe we can allow CodeField 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.

alexeyinkin avatar Apr 11 '23 13:04 alexeyinkin