code_field icon indicating copy to clipboard operation
code_field copied to clipboard

Shifting scroll highlight when scrolling beyond bounds of code editor

Open mack-at-pieces opened this issue 2 years ago • 3 comments

I'm currently using the CodeEditor for MacOS and experiencing an issue where the scroll highlight shakes and shifts when dragging past the bounds of the CodeEditor.

I'm unsure where this issue lies, whether it be something wrong with my code or the editor itself, but perhaps @BertrandBev or @alexeyinkin you may be able to shed some light here.

@alexeyinkin I noticed you do not experience this problem in your project here (https://play.beam.apache.org/), so perhaps there's something I can do to also resolve this.

Video attached.

https://user-images.githubusercontent.com/30325757/175952195-35a111e2-6b36-4703-9b61-8ff120359573.mov

mack-at-pieces avatar Jun 27 '22 13:06 mack-at-pieces

I don't have a Mac to verify this. I only develop for web and test regression on Android. Looks like you are building a native Mac app, so everything is completely different there.

I suggest you try to run the official example and see if it happens there. It is kind of bare boned. If it reproduces there, try ordinary TextField with ordinary TextEditingController. If it reproduces there as well, look if this is reported in Flutter issues and file a new one if it is not.

If bare TextField works alright but CodeField does not, then it is possible to strip this package's code method-by-method until bare TextField and TextEditingController are left and to pinpoint the problem.

Unfortunately, I am not the one to do this as we stick to our project scope.

alexeyinkin avatar Jun 27 '22 18:06 alexeyinkin

@alexeyinkin Thanks for the response. I figured I'd check before diving in that deep. Will be exploring this further over the coming days.

mack-at-pieces avatar Jun 27 '22 18:06 mack-at-pieces

@alexeyinkin @BertrandBev Found that this is caused by a conflict between the built-in TextField scroll and a SingleChildScrollView wrapping the CodeEditor.

It is in fact reproduced in the example app. I was able to get around this by setting expanded: true on the CodeField and removing the SingleChildScrollView.

This is not a problem with the Flutter TextField given that a bare widget with maxLines: null and a constrained container do not show this issue.

mack-at-pieces avatar Jun 27 '22 21:06 mack-at-pieces