fix(mobile): photo grid reflows on foldable display fold/unfold#24529
Closed
mmolehant-tech wants to merge 1 commit intoimmich-app:mainfrom
Closed
fix(mobile): photo grid reflows on foldable display fold/unfold#24529mmolehant-tech wants to merge 1 commit intoimmich-app:mainfrom
mmolehant-tech wants to merge 1 commit intoimmich-app:mainfrom
Conversation
Fixes immich-app#20466 The photo grid now properly reflows when switching between folded and unfolded displays on foldable devices. Previously, the grid would remain stuck in the layout from when the app was opened. The fix adds a ValueKey to the ProviderScope based on significant dimension changes (50+ pixels), which forces Flutter to recreate the timeline widget tree when the screen size changes during fold/unfold. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Collaborator
|
This works, but it essentially rebuilds the whole timeline, causing it to reset to the top. |
Contributor
|
#25088 created a different version that keeps the current position in the view. |
Member
|
As @YarosMallorca, This just causes the timeline to be reloaded and that is not something that we want. Closing this in favour of #24573 |
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.
Summary
ValueKeytoProviderScopein timeline widget to force widget rebuild when screen dimensions change significantlyRoot Cause
The
LayoutBuilderintimeline.widget.dartcorrectly rebuilds with new constraints when the screen size changes, but the childProviderScopehad no key. This caused Flutter to reuse the existing widget state instead of creating a new one with the updated dimensions.Solution
Added a
ValueKeybased on rounded dimensions (divided by 50 to avoid rebuilds for tiny changes). When the key changes significantly (e.g., on fold/unfold), Flutter discards and recreates the widget subtree, properly propagating the new dimensions.Test plan
Fixes #20466