Skip to content

SizedBox ignores the scaling factor on a child Transform #5874

@mpcomplete

Description

@mpcomplete

Try this sample:

  runApp(new Align(
    alignment: FractionalOffset.topCenter,
    child: new SizedBox(
      height: 50.0,
      child: new Transform(
        transform: new Matrix4.identity()
                   ..scale(1.0, 0.5),
        child: new Column(
          children: <Widget>[
            new Flexible(flex: null, child: new Container(decoration: new BoxDecoration(backgroundColor: Colors.green[500]), height: 2.0*20.0)),
            new Flexible(flex: null, child: new Container(decoration: new BoxDecoration(backgroundColor: Colors.white), height: 2.0*30.0)),
          ]
        )
      )
    )
  ));

The Transform has a 100px high child, which it scales to 50px high. This should fit fine inside the SizedBox, but the SizedBox paints an angry red overflow indicator on the bottom half of its child. If the SizedBox instead has an untransformed 50px child, everything is fine. It seems the SizedBox applies its constraints to the child before the transform is applied.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions