Repository navigation
fix(chat): make a search hit actually scroll into view - #13
Merged
Merged
Conversation
Picking a result did nothing visible. `_jumpToMessage` widened the rendered window and then called `ensureVisible`, but a list only builds what is near the viewport: growing the tail added messages *above* the scroll position, which are never built, so there was no context to scroll to and the retry silently gave up. The same path backs the reply quote and the date jump. The window is now cut down to the target instead of only grown: with the target five messages below the top of the rendered slice, `jumpTo(0)` lands on it and `ensureVisible` only fine-tunes the alignment. A target that is already inside a large window but far below the screen is reached by walking up one viewport at a time until its bubble exists. A `_jumping` flag keeps the window growth in `_onScroll` from moving the offset during the walk. The two window/offset calculations live in `chat_scroll.dart` and are covered by unit tests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Picking a search result did nothing visible.
Root cause:
_jumpToMessagewidened the rendered window and then calledScrollable.ensureVisible, but a list only builds widgets near the viewport. Growing the tail adds messages above the scroll position, so they are never built,_messageKeys[sentAt]stayed null and the retry silently gave up. The same path backs tapping a reply quote and the date jump, so all three were affected for anything older than the rendered window.Fix:
jumpTo(0)lands on it andensureVisibleonly adjusts the alignment._jumpingstops_onScroll's window growth from moving the offset during the walk.lib/utils/chat_scroll.dartwith unit tests.Verification:
flutter analyze --no-fatal-infosclean,flutter test147/147. The scroll behaviour itself is not verified on a device — no display in this session.