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> {
validator: _validateName,
builder: (FormFieldState<InputValue> 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<TextFieldDemo> {
},
),
new InputFormField(
icon: new Icon(Icons.phone),
hintText: 'Where can we reach you?',
labelText: 'Phone Number',
keyboardType: TextInputType.phone,
......
......@@ -358,7 +358,7 @@ class _InputContainerState extends State<InputContainer> {
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
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,
......
......@@ -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));
});
}
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