-
-
Notifications
You must be signed in to change notification settings - Fork 277
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
Lag when soft keyboard is opened / closed in a chat #1569
Comments
Is there a way to avoid all these expensive Another thing to note is that even while, the previous screen is not visible, it seems to be still completely rebuilt. This seems to be the biggest culprit of UI jank since it takes around 60ms of a 175ms render. So around 34% |
After literal days of debugging, I've found where the issue originates. All widgets rebuild when a keyboard opens because in
Commenting these out and replacing them with appropriate boolean values ( for your respective test device. I tested with a phone and so both needed to be false ) gives you perfect framerates with no excessive rebuilds. I added debug statements in many
And after the change, nothing when opening / closing keyboard. So I guess this boosts performance by an absolute crapload since you're not wasting time rebuilding everything but now I gotta find a way to refractor these 2 variables somewhere less... expensive. Putting these variables here might have seemed like a great idea at the time but when a lot of widgets and children reference this down the tree, essentially they're all depending on
This is my current "fix". Now, This will break all responsiveness so while it's a nightmare for web, its manageable for mobile I'll be looking to creating something like a |
Bug Description
In ChatView, ( essentially in a room ), when soft keyboard opened/ closed, there is an enormous lag spike when all the widgets are being rebuilt. Adding
resizeToAvoidBottomInset: false
to the parentScaffold
fixes this but inputfield is now covered by keyboard, not to mention the bottom half of the chat.Tested on Android, Tab s9+ and A55. The faster tab gives better framerates but still noticeable stutter.
This is a pretty well documented issue in flutterI think but as a chat application that requires constant opening and closing of keyboard this kind of takes away from the UX imo.Steps to Reproduce
Expected Behavior
No stutter, keyboard opens fluidly
App Version
Self compiled from commit
6f18f716
with flutter 3.27.1. Also present in release1.23.0
Additional Platform Information
Android, A55, Tab s9+
Additional Context
I only recently started learning flutter but is there a way to move the whole screen "up" without rebuilding? Another possible workaround would be to add an element which matches the height of the keyboard exactly which would move the chats upward, then somehow "detaching" the input field and moving it above the keyboard as well.
The text was updated successfully, but these errors were encountered: