Commit dbf1cfdb authored by Hans Muller's avatar Hans Muller Committed by GitHub

Do not pad the Input/InputContainer icon (#7282)

parent 895aaa9a
...@@ -87,6 +87,7 @@ class TextFieldDemoState extends State<TextFieldDemo> { ...@@ -87,6 +87,7 @@ class TextFieldDemoState extends State<TextFieldDemo> {
validator: _validateName, validator: _validateName,
builder: (FormFieldState<InputValue> field) { builder: (FormFieldState<InputValue> field) {
return new Input( return new Input(
icon: new Icon(Icons.person),
hintText: 'What do people call you?', hintText: 'What do people call you?',
labelText: 'Name', labelText: 'Name',
value: field.value, value: field.value,
...@@ -96,6 +97,7 @@ class TextFieldDemoState extends State<TextFieldDemo> { ...@@ -96,6 +97,7 @@ class TextFieldDemoState extends State<TextFieldDemo> {
}, },
), ),
new InputFormField( new InputFormField(
icon: new Icon(Icons.phone),
hintText: 'Where can we reach you?', hintText: 'Where can we reach you?',
labelText: 'Phone Number', labelText: 'Phone Number',
keyboardType: TextInputType.phone, keyboardType: TextInputType.phone,
......
...@@ -358,7 +358,7 @@ class _InputContainerState extends State<InputContainer> { ...@@ -358,7 +358,7 @@ class _InputContainerState extends State<InputContainer> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
new Container( new Container(
margin: new EdgeInsets.only(right: 16.0, top: iconTop), margin: new EdgeInsets.only(top: iconTop),
width: config.isDense ? 40.0 : 48.0, width: config.isDense ? 40.0 : 48.0,
child: new IconTheme.merge( child: new IconTheme.merge(
context: context, context: context,
......
...@@ -810,4 +810,23 @@ void main() { ...@@ -810,4 +810,23 @@ void main() {
newPos = tester.getTopLeft(find.text('Second')); newPos = tester.getTopLeft(find.text('Second'));
expect(newPos.y, lessThan(pos.y)); 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));
});
} }
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