[two_dimensional_scrollables] Add alignment to TreeView and TableView#11353
[two_dimensional_scrollables] Add alignment to TreeView and TableView#11353auto-submit[bot] merged 2 commits intoflutter:mainfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces an alignment property to TableView and TreeView widgets, allowing content to be aligned within the viewport when its extent is smaller than the viewport. The implementation involves adding the alignment property to the widget, viewport, and render object constructors, calculating horizontal and vertical alignment offsets in the render objects, and applying these offsets during layout and painting, considering pinned elements and reversed scroll directions. The package version has been updated to 0.4.0, and new comprehensive tests have been added for both TableView and TreeView to validate the alignment functionality across various scenarios. There is no feedback to provide.
Hari-07
left a comment
There was a problem hiding this comment.
LGTM, but maybe we can have a test for the default case too? So that the default behaviour does not change unexpectedly in the future
|
Good call! Thanks! I added the default test cases. |
flutter/packages@5909bdd...0dd2410 2026-03-25 katelovett@google.com [two_dimensional_scrollables] Add alignment to TreeView and TableView (flutter/packages#11353) 2026-03-25 47866232+chunhtai@users.noreply.github.com [ci] Update create pull request script in github actions (flutter/packages#11350) 2026-03-25 engine-flutter-autoroll@skia.org Manual roll Flutter from dd64978 to 82d96ef (89 revisions) (flutter/packages#11345) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC flutter-ecosystem@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…flutter#11353) This PR implements declarative alignment for the content of TableView and TreeView widgets when that content is smaller than the viewport extent. Users can now use the alignment property to center or otherwise position the entire table/tree within the viewport. Alignment correctly reverts to start for axes that exceed viewport dimensions. Fixes flutter/flutter#170349 - TableView - Added an alignment property of type AlignmentGeometry (defaults to Alignment.topLeft). - Full support for both horizontal and vertical alignment. - Supports AlignmentDirectional to correctly handle TextDirection (LTR/RTL). - Works with pinned rows and columns, as well as reversed axis directions. - TreeView - Added an alignment property of type AlignmentGeometry (defaults to Alignment.topLeft). - Caveat: Currently only supports the vertical component of the alignment. The tree remains aligned to the horizontal "start" to maintain consistent indentation logic and avoid layout jumps caused by dynamic, lazily-loaded node widths. ## Pre-Review Checklist **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. [^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.
…r#184198) flutter/packages@5909bdd...0dd2410 2026-03-25 katelovett@google.com [two_dimensional_scrollables] Add alignment to TreeView and TableView (flutter/packages#11353) 2026-03-25 47866232+chunhtai@users.noreply.github.com [ci] Update create pull request script in github actions (flutter/packages#11350) 2026-03-25 engine-flutter-autoroll@skia.org Manual roll Flutter from dd64978 to 82d96ef (89 revisions) (flutter/packages#11345) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC flutter-ecosystem@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
This PR implements declarative alignment for the content of TableView and TreeView widgets when that content is smaller than the viewport extent. Users can now use the alignment property to center or otherwise position the entire table/tree within the viewport.
Alignment correctly reverts to start for axes that exceed viewport dimensions.
Fixes flutter/flutter#170349
TableView
TreeView
aligned to the horizontal "start" to maintain consistent indentation logic and avoid layout
jumps caused by dynamic, lazily-loaded node widths.
Pre-Review Checklist
[shared_preferences]///).If you need help, consider asking for advice on the #hackers-new channel on Discord.
Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the
gemini-code-assistbot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.Footnotes
Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. ↩ ↩2