code_field
code_field copied to clipboard
cannot select multi lines when wrap CodeField in a SingleChildScrollView
same issue
@itzhoujun maybe try this https://github.com/akvelon/flutter-code-editor, this package contains a lot of other features
@guchengxi1994 thanks.
@guchengxi1994 flutter-code-editor has same issue. Any idea to fix it?
@itzhoujun @guchengxi1994 My fork has this solved: https://github.com/mack-at-pieces/code_field. Feel free to use!
@mack-at-pieces Great!
@itzhoujun @guchengxi1994 My fork has this solved: https://github.com/mack-at-pieces/code_field. Feel free to use!
Hi, which commit is to fix it? I want to fix it at https://github.com/akvelon/flutter-code-editor
@itzhoujun I think this one. https://github.com/BertrandBev/code_field/commit/565d61adb6de8acc56a6afe85f166cceb62ca4b3
@mack-at-pieces would you mind putting together a PR to merge your fix in?
Hi all @guchengxi1994 @BertrandBev my apologies - I forgot my fix for this isn't within the code editor itself, it's related to the implementation. If you are wrapping the CodeField
with a SingleChildScrollView
, then you will run into scrolling conflicts with the scroll view and the internal scrolling of the underlying TextField
, which creates this buggy effect.
My solution was to eliminate any scroll widgets wrapping the CodeField and put expands: true
on the CodeField itself.
What this looks like in practice using the example app in the package:

There may be another fundamental change to the CodeField itself that that would solve the issue, but this is what I found for now.
@itzhoujun I think this one. 565d61a
This fix is actually related to the scrollbar sometimes appearing in the line number column.