Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot select multi lines when wrap CodeField in a SingleChildScrollView #74

Open
guchengxi1994 opened this issue Jan 29, 2023 · 11 comments

Comments

@guchengxi1994
Copy link

bug

@itzhoujun
Copy link

same issue

@guchengxi1994
Copy link
Author

@itzhoujun maybe try this https://github.com/akvelon/flutter-code-editor, this package contains a lot of other features

@itzhoujun
Copy link

@guchengxi1994 thanks.

@itzhoujun
Copy link

@guchengxi1994 flutter-code-editor has same issue. Any idea to fix it?

@mack-at-pieces
Copy link
Contributor

@itzhoujun @guchengxi1994 My fork has this solved: https://github.com/mack-at-pieces/code_field. Feel free to use!

@guchengxi1994
Copy link
Author

@mack-at-pieces Great!

@itzhoujun
Copy link

@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

@guchengxi1994
Copy link
Author

@itzhoujun I think this one. 565d61a

@BertrandBev
Copy link
Owner

@mack-at-pieces would you mind putting together a PR to merge your fix in?

@mack-at-pieces
Copy link
Contributor

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:
Screenshot 2023-03-21 at 10 52 43 AM

Screenshot 2023-03-21 at 10 51 54 AM

There may be another fundamental change to the CodeField itself that that would solve the issue, but this is what I found for now.

@mack-at-pieces
Copy link
Contributor

@itzhoujun I think this one. 565d61a

This fix is actually related to the scrollbar sometimes appearing in the line number column.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants