Unverified Commit 11771b2d authored by Ari Weiland's avatar Ari Weiland Committed by GitHub

Remove NavigationToolbar condition that leading widget cannot be larger than...

Remove NavigationToolbar condition that leading widget cannot be larger than 1/3 the total space available. (#112548)
parent 84221538
...@@ -106,7 +106,7 @@ class _ToolbarLayout extends MultiChildLayoutDelegate { ...@@ -106,7 +106,7 @@ class _ToolbarLayout extends MultiChildLayoutDelegate {
if (hasChild(_ToolbarSlot.leading)) { if (hasChild(_ToolbarSlot.leading)) {
final BoxConstraints constraints = BoxConstraints( final BoxConstraints constraints = BoxConstraints(
maxWidth: size.width / 3.0, // The leading widget shouldn't take up more than 1/3 of the space. maxWidth: size.width,
minHeight: size.height, // The height should be exactly the height of the bar. minHeight: size.height, // The height should be exactly the height of the bar.
maxHeight: size.height, maxHeight: size.height,
); );
......
...@@ -3680,4 +3680,34 @@ void main() { ...@@ -3680,4 +3680,34 @@ void main() {
await tester.pumpWidget(buildApp()); await tester.pumpWidget(buildApp());
expect(tester.getTopLeft(title).dx, 16.0); expect(tester.getTopLeft(title).dx, 16.0);
}); });
testWidgets('AppBar leading widget can take up arbitrary space', (WidgetTester tester) async {
final Key leadingKey = UniqueKey();
final Key titleKey = UniqueKey();
late double leadingWidth;
Widget buildApp() {
return MaterialApp(
home: LayoutBuilder(
builder: (BuildContext context, BoxConstraints constraints) {
leadingWidth = constraints.maxWidth / 2;
return Scaffold(
appBar: AppBar(
leading: Container(
key: leadingKey,
width: leadingWidth,
),
leadingWidth: leadingWidth,
title: Text('Title', key: titleKey),
),
);
}
),
);
}
await tester.pumpWidget(buildApp());
expect(tester.getTopLeft(find.byKey(titleKey)).dx, leadingWidth + 16.0);
expect(tester.getSize(find.byKey(leadingKey)).width, leadingWidth);
});
} }
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