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

Flex items didn't get adjusted by inner contents's size. #560

Open
1 task done
andycall opened this issue Feb 27, 2024 · 1 comment
Open
1 task done

Flex items didn't get adjusted by inner contents's size. #560

andycall opened this issue Feb 27, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@andycall
Copy link
Member

Affected version

main

Flutter versions

3.16.3

No same issues found.

  • Yes, I search all issues but not found.

Steps to Reproduce

Code example

<!DOCTYPE html>
<html>
<head>
  <style>
  .flex-wrap{
    width: 400px;
    background: pink;
    display: flex;
    padding: 10px;
  }
  .flex1 {
    width: 40px;
    height: 40px;
    background: yellow
  }
  .flex2 {
    flex: 1;
    background: forestgreen;
  }
  .flex3 {
    max-width: 80px;
  }
    </style>
</head>
<body>
<div class="container">
  <div class="flex-wrap">
    <div class="flex2">
      <!-- lass="checkbox" type="checkbox" disabled name="" lass="checkbox" type="checkbox" disabled name="" -->
      <p class="p1">class="checkbox" type="checkbox" disabled name="" type="checkbox" disabled name=""</p>
      <p class="p1">class="checkbox" type="checkbox" d isabled name="" type="checkbox" disabled name=""</p>
    </div>
    <div class="flex3">43242423</div>
    <p class="flex1" >aaa</p>
  </div>
</div>

</body>
</html>

Expected results

image

Actual results

image
@andycall andycall added the bug Something isn't working label Feb 27, 2024
@drugsloveyou
Copy link

drugsloveyou commented Apr 2, 2024

Maybe temporary solution that I found, in _recordRunsMainSize (or directly in webf/lib/src/rendering/flow.dart: 886)

if (runChild is RenderBoxModel) {
- runChildMainSize = runChild.boxSize?.width ?? 0.0;
+ runChildMainSize = runChild.minContentWidth;
  double childMarginLeft = runChild.renderStyle.marginLeft.computedValue;
  double childMarginRight = runChild.renderStyle.marginRight.computedValue;
  runChildMainSize += childMarginLeft + childMarginRight;
}

after fix:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants