From d3d4976f637ec9e228a94f0fe91c21cf3d6ccaf9 Mon Sep 17 00:00:00 2001 From: Hans Muller Date: Mon, 23 Apr 2018 13:53:15 -0700 Subject: [PATCH] InputDecorator input and hint widgets have the same width (#16894) --- packages/flutter/lib/src/material/input_decorator.dart | 2 +- packages/flutter/test/material/input_decorator_test.dart | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/flutter/lib/src/material/input_decorator.dart b/packages/flutter/lib/src/material/input_decorator.dart index 358527c8bc..af012b7338 100644 --- a/packages/flutter/lib/src/material/input_decorator.dart +++ b/packages/flutter/lib/src/material/input_decorator.dart @@ -771,11 +771,11 @@ class _RenderDecoration extends RenderBox { + contentPadding.right); boxConstraints = boxConstraints.copyWith(maxWidth: inputWidth); - layoutLineBox(hint); if (label != null) // The label is not baseline aligned. label.layout(boxConstraints, parentUsesSize: true); boxConstraints = boxConstraints.copyWith(minWidth: inputWidth); + layoutLineBox(hint); layoutLineBox(input); double inputBaseline = contentPadding.top + aboveBaseline; diff --git a/packages/flutter/test/material/input_decorator_test.dart b/packages/flutter/test/material/input_decorator_test.dart index b9d3dbcdf4..a3861c03f1 100644 --- a/packages/flutter/test/material/input_decorator_test.dart +++ b/packages/flutter/test/material/input_decorator_test.dart @@ -259,6 +259,8 @@ void main() { expect(tester.getBottomLeft(find.text('hint')).dy, 28.0); expect(getBorderBottom(tester), 40.0); expect(getBorderWeight(tester), 1.0); + + expect(tester.getSize(find.text('hint')).width, tester.getSize(find.text('text')).width); }); testWidgets('InputDecorator input/label/hint layout', (WidgetTester tester) async {