-
Notifications
You must be signed in to change notification settings - Fork 761
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
QuillEditor
does not rebuild when scrolling
#1907
Comments
QuillEditor has focusNode property try to use it to set back the focus on quill editor when it is in view |
@salba360496 I suspect the problem is not with focus, but something else. Since the widget clearly does receive the scroll gesture, it just doesn't always re-render the widget upon scrolling (until you tap on it). Perhaps a missing |
I resolve this issue using this: bool canScroll = false; //set to false to apply just at the first time the setState
//Scrollbar is optional, any widget that uses notificationPredicate for scroll can resolve this (i guess)
Scrollbar(
notificationPredicate: (notification) {
if (!canScroll) {
canScroll = true;
setState(() {});
}
return notification.depth == 0;
},
child: <you editor>
), |
Thank you @CatHood0 , this workaround seems to fix it! I'll use this for now :) |
@AtlasAutocode do you have idea where can be the issue with the scroll? This just happens when you use a Scrollbar (in my case). |
I created a project following OP instructions and added the latest Flutter Quill package. I repeated the test on an Android emulator - switching between tabs was difficult because clicks did not register (seem to be obscured by a title bar?) but I could use the tab key to switch - again, the content of both tabs was scrollable using drag action. One time on windows, however, switching to Tab-2 and using the scroll bar did NOT work. Can't reproduce this so perhaps there is some time-sensitive initialization of something. This would tie into your fix of calling setState to reset/re-initialize the editor state. My guess is the problem is with scrollController but I can't find where or how it is used. I have found in raw_editor_state.dart:
it is set in initState function (L1107)
This might not get initialized if something asserted prior to its call and would explain why your fix works. |
Is there an existing issue for this?
Flutter Quill version
9.3.21
Steps to reproduce
flutter create quill_test
main.dart
with the code sampleQuillEditor
is scrollableQuillEditor
is no longer scrollableAdditionally, note that if in tab 2 you make a scrolling motion (even though the widget does not scroll yet), and then tap on
QuillEditor
, it is now scrolled. This indicates that theQuillEditor
widget does properly receive the scroll gesture, but the widget does not rebuild (and show the scrolled state) until you tap on it.If you then go back to tab 1, the same issue occurs. See video demonstration below.
Expected results
QuillEditor
is scrollable regardless of the tab, and regardless of whether you tap on the widget or not.Actual results
When
QuillEditor
is within aTabBarView
, it is no longer scrollable after switching tabs.See video demonstration below.
Code sample
Code sample
Screenshots or Video
Screenshots / Video demonstration
https://github.com/singerdmx/flutter-quill/assets/29568469/d1328ee4-f8bf-469b-9543-77a0226f313fLogs
Logs
No logs.
The text was updated successfully, but these errors were encountered: