Skip to content
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

fix: flex item not stretch when child size changed #1229

Merged
merged 13 commits into from
Mar 23, 2022

Conversation

temper357
Copy link
Contributor

@temper357 temper357 commented Mar 18, 2022

Closes #1224

问题原因:当 flex item 有 flex-grow/flex-shrink/align-items stretch 时因 constraints 被设置成 tight,导致形成了 relayoutBoundary child markNeedsLayout 时 dirty 标识无法向上冒泡,从而 flex item 无法触发 layout。

fix:

  • 重构 flex layout 中当 flex-grow/flex-shrink/align-items stretch 存在时对 child 进行二次 layout constraints 的计算逻辑,使用设置 contentBoxLogicalLength 方式而不是设置 tight constraints 的方式来将变更后的 length 传递给 child(在 getConstraints 中会向上递归查找)。
  • 修复 flex-basis 大于主轴设置的 size 时报错。
  • 修复 flex item 为 replaced element 且 cross axis 的 size 未定义时,cross axis size 未用 intrinsic ratio 计算的问题。

@temper357 temper357 changed the title [WIP] fix: flex item child not stretch [WIP] fix: flex item not stretch when child size changed Mar 18, 2022
@temper357 temper357 changed the title [WIP] fix: flex item not stretch when child size changed fix: flex item not stretch when child size changed Mar 22, 2022
…m-child-stretch

# Conflicts:
#	kraken/lib/src/css/render_style.dart
#	kraken/lib/src/rendering/flex.dart
@yuanyan yuanyan merged commit 6e243b5 into main Mar 23, 2022
@yuanyan yuanyan deleted the fix/flex-item-child-stretch branch March 23, 2022 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

flex item 的 child 高度变化时 flex container 的高度未跟随变化
3 participants