mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Do not pad the Input/InputContainer icon (#7282)
This commit is contained in:
parent
895aaa9a2e
commit
dbf1cfdbf0
@ -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));
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user