bdlukaa / fluent_ui

Implements Microsoft's WinUI3 in Flutter.
https://bdlukaa.github.io/fluent_ui/
BSD 3-Clause "New" or "Revised" License
2.79k stars 435 forks source link

πŸ› A child of `Button` has an unbound height constraint. #1039

Closed fischerscode closed 2 months ago

fischerscode commented 3 months ago

Describe the bug A child of Button has an unbound height constraint.

To Reproduce Steps to reproduce the behavior:

  1. run this example
    void main() {
    runApp(FluentApp(
    home: Stack(
      children: [
        ConstrainedBox(
          constraints: BoxConstraints(
              maxHeight: 100, minHeight: 10, minWidth: 10, maxWidth: 100),
          child: LayoutBuilder(builder: (context, constraints) {
            print("outer: $constraints");
            return Button(
              child: LayoutBuilder(
                builder: (context, constraints) {
                  print("inner: $constraints");
                  return Container();
                },
              ),
              onPressed: () {},
            );
          }),
        ),
      ],
    ),
    ));
  2. Logs:
    flutter: outer: BoxConstraints(10.0<=w<=100.0, 10.0<=h<=100.0)
    flutter: inner: BoxConstraints(0.0<=w<=76.0, 0.0<=h<=Infinity)

Expected behavior Centering a child that's to small seems reasonable, but the upper bound should be respected.

Screenshots none

Additional context I think ef3cd8764915b7627d44b6bb7976b164130a4069 broke this.