Repository navigation
fix: Position layout children that do not use a top left anchor - #4283
Merged
Merged
Conversation
RowComponent, ColumnComponent and PaddingComponent placed each child by calling setFrom on its topLeftPosition. That getter returns the position vector itself only for a top left anchor; for any other anchor it returns a fresh copy, so the child was never moved and stayed at its original position. Assign through the topLeftPosition setter instead.
Yasser-Ameur
marked this pull request as ready for review
December 1, 2026 08:21
spydon
approved these changes
Dec 1, 2026
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.
Description
RowComponent,ColumnComponentandPaddingComponentdo not position a child whose anchor is not top left. Three centred icons in a row all stay where they were created:The layout code moved a child with
child.topLeftPosition.setFrom(...). For a top left anchor that getter returns the position vector itself, so writing into it works. For any other anchor it returns a new vector, and the write is lost. The three places now assign through thetopLeftPositionsetter, which moves the component for every anchor. Children with a top left anchor end up where they did before.New tests in
linear_layout_component_test.dartandpadding_component_test.dartlay out centred children in a row, a column and a padding component; they fail onmainbecause the children do not move.Locally on Windows, from
packages/flame:dart format --output=none --set-exit-if-changedon the four changed files reports 0 changed,flutter analyzereports no issues, andtest/experimental test/layoutgives 124 passed. Themelosgates, cspell and the markdown check were not run.Checklist
docsand added dartdoc comments with///.examplesordocs.Breaking Change?
Related Issues