diff --git a/examples/flutter_gallery/lib/demo/text_field_demo.dart b/examples/flutter_gallery/lib/demo/text_field_demo.dart index 8fa86547880..65ffbe63207 100644 --- a/examples/flutter_gallery/lib/demo/text_field_demo.dart +++ b/examples/flutter_gallery/lib/demo/text_field_demo.dart @@ -87,6 +87,7 @@ class TextFieldDemoState extends State { validator: _validateName, builder: (FormFieldState field) { return new Input( + icon: new Icon(Icons.person), hintText: 'What do people call you?', labelText: 'Name', value: field.value, @@ -96,6 +97,7 @@ class TextFieldDemoState extends State { }, ), new InputFormField( + icon: new Icon(Icons.phone), hintText: 'Where can we reach you?', labelText: 'Phone Number', keyboardType: TextInputType.phone, diff --git a/packages/flutter/lib/src/material/input.dart b/packages/flutter/lib/src/material/input.dart index 07760e6107d..226f61141d4 100644 --- a/packages/flutter/lib/src/material/input.dart +++ b/packages/flutter/lib/src/material/input.dart @@ -358,7 +358,7 @@ class _InputContainerState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ new Container( - margin: new EdgeInsets.only(right: 16.0, top: iconTop), + margin: new EdgeInsets.only(top: iconTop), width: config.isDense ? 40.0 : 48.0, child: new IconTheme.merge( context: context, diff --git a/packages/flutter/test/widgets/input_test.dart b/packages/flutter/test/widgets/input_test.dart index 6ff764062f5..862905a09d1 100644 --- a/packages/flutter/test/widgets/input_test.dart +++ b/packages/flutter/test/widgets/input_test.dart @@ -810,4 +810,23 @@ void main() { newPos = tester.getTopLeft(find.text('Second')); expect(newPos.y, lessThan(pos.y)); }); + + testWidgets('No space between Input icon and text', (WidgetTester tester) async { + await tester.pumpWidget( + new Center( + child: new Material( + child: new Input( + icon: new Icon(Icons.phone), + labelText: 'label', + value: InputValue.empty, + ), + ), + ), + ); + + final double iconRight = tester.getTopRight(find.byType(Icon)).x; + expect(iconRight, equals(tester.getTopLeft(find.text('label')).x)); + expect(iconRight, equals(tester.getTopLeft(find.byType(InputField)).x)); + }); + }