Unverified Commit 6294dd59 authored by Andre's avatar Andre Committed by GitHub

Make _RenderButtonBarRow.constraints null aware (#57261)

parent f2c12d7e
...@@ -334,7 +334,7 @@ class _RenderButtonBarRow extends RenderFlex { ...@@ -334,7 +334,7 @@ class _RenderButtonBarRow extends RenderFlex {
BoxConstraints get constraints { BoxConstraints get constraints {
if (_hasCheckedLayoutWidth) if (_hasCheckedLayoutWidth)
return super.constraints; return super.constraints;
return super.constraints.copyWith(maxWidth: double.infinity); return super.constraints?.copyWith(maxWidth: double.infinity);
} }
@override @override
......
...@@ -627,4 +627,18 @@ void main() { ...@@ -627,4 +627,18 @@ void main() {
}, },
); );
}); });
testWidgets('_RenderButtonBarRow.constraints works before layout', (WidgetTester tester) async {
await tester.pumpWidget(
const MaterialApp(home: ButtonBar()),
Duration.zero,
EnginePhase.build,
);
final Finder buttonBar = find.byWidgetPredicate((Widget w) => '${w.runtimeType}' == '_ButtonBarRow');
final RenderBox renderButtonBar = tester.renderObject(buttonBar) as RenderBox;
expect(renderButtonBar.debugNeedsLayout, isTrue);
expect(renderButtonBar.constraints, isNull);
});
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment