Skip to content

Commit e334ac1

Browse files
authored
Revert "Update Cupertino text input padding (#113958)" (#114102)
This reverts commit 51acda8.
1 parent 7bca82c commit e334ac1

File tree

4 files changed

+43
-43
lines changed

4 files changed

+43
-43
lines changed

packages/flutter/lib/src/cupertino/search_field.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,10 @@ class CupertinoSearchTextField extends StatefulWidget {
109109
this.backgroundColor,
110110
this.borderRadius,
111111
this.keyboardType = TextInputType.text,
112-
this.padding = const EdgeInsetsDirectional.fromSTEB(5.5, 8, 5.5, 8),
112+
this.padding = const EdgeInsetsDirectional.fromSTEB(3.8, 8, 5, 8),
113113
this.itemColor = CupertinoColors.secondaryLabel,
114114
this.itemSize = 20.0,
115-
this.prefixInsets = const EdgeInsetsDirectional.fromSTEB(6, 0, 0, 3),
115+
this.prefixInsets = const EdgeInsetsDirectional.fromSTEB(6, 0, 0, 4),
116116
this.prefixIcon = const Icon(CupertinoIcons.search),
117117
this.suffixInsets = const EdgeInsetsDirectional.fromSTEB(0, 0, 5, 2),
118118
this.suffixIcon = const Icon(CupertinoIcons.xmark_circle_fill),

packages/flutter/lib/src/cupertino/text_field.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ class CupertinoTextField extends StatefulWidget {
214214
this.controller,
215215
this.focusNode,
216216
this.decoration = _kDefaultRoundedBorderDecoration,
217-
this.padding = const EdgeInsets.all(7.0),
217+
this.padding = const EdgeInsets.all(6.0),
218218
this.placeholder,
219219
this.placeholderStyle = const TextStyle(
220220
fontWeight: FontWeight.w400,
@@ -380,7 +380,7 @@ class CupertinoTextField extends StatefulWidget {
380380
this.controller,
381381
this.focusNode,
382382
this.decoration,
383-
this.padding = const EdgeInsets.all(7.0),
383+
this.padding = const EdgeInsets.all(6.0),
384384
this.placeholder,
385385
this.placeholderStyle = _kDefaultPlaceholderStyle,
386386
this.prefix,

packages/flutter/test/cupertino/search_field_test.dart

+5-5
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ void main() {
107107
expect(
108108
tester.getTopLeft(find.text('initial')) -
109109
tester.getTopLeft(find.byType(CupertinoSearchTextField)),
110-
const Offset(31.5, 8.0),
110+
const Offset(29.8, 8.0),
111111
);
112112
},
113113
);
@@ -231,15 +231,15 @@ void main() {
231231
);
232232

233233
expect(
234-
tester.getTopRight(find.byIcon(CupertinoIcons.search)).dx + 5.5,
234+
tester.getTopRight(find.byIcon(CupertinoIcons.search)).dx + 3.8,
235235
tester.getTopLeft(find.byType(EditableText)).dx,
236236
);
237237

238238
expect(
239239
tester.getTopLeft(find.byType(EditableText)).dx,
240240
tester.getTopLeft(find.byType(CupertinoSearchTextField)).dx +
241241
tester.getSize(find.byIcon(CupertinoIcons.search)).width +
242-
11.5,
242+
9.8,
243243
);
244244
},
245245
);
@@ -258,7 +258,7 @@ void main() {
258258
);
259259

260260
expect(
261-
tester.getTopRight(find.byType(EditableText)).dx + 5.5,
261+
tester.getTopRight(find.byType(EditableText)).dx + 5.0,
262262
tester.getTopLeft(find.byIcon(CupertinoIcons.xmark_circle_fill)).dx,
263263
);
264264

@@ -268,7 +268,7 @@ void main() {
268268
tester
269269
.getSize(find.byIcon(CupertinoIcons.xmark_circle_fill))
270270
.width -
271-
10.5,
271+
10.0,
272272
);
273273
},
274274
);

packages/flutter/test/cupertino/text_field_test.dart

+34-34
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ void main() {
380380

381381
expect(
382382
tester.getSize(find.byType(CupertinoTextField)),
383-
const Size(200, 31), // 31 is the height of the default font + padding etc.
383+
const Size(200, 29), // 29 is the height of the default font + padding etc.
384384
);
385385
},
386386
);
@@ -401,7 +401,7 @@ void main() {
401401

402402
expect(
403403
tester.getSize(find.byType(CupertinoTextField)),
404-
const Size(200, 31), // 31 is the height of the default font (17) + decoration (12).
404+
const Size(200, 29), // 29 is the height of the default font (17) + decoration (12).
405405
);
406406
},
407407
);
@@ -508,7 +508,7 @@ void main() {
508508

509509
expect(
510510
tester.getSize(find.byType(CupertinoTextField)),
511-
const Size(200, 65), // 65 is the height of the default font (17) * maxlines (3) + decoration height (12).
511+
const Size(200, 63), // 63 is the height of the default font (17) * maxlines (3) + decoration height (12).
512512
);
513513
},
514514
);
@@ -529,7 +529,7 @@ void main() {
529529

530530
expect(
531531
tester.getSize(find.byType(CupertinoTextField)),
532-
const Size(200, 65),
532+
const Size(200, 63),
533533
);
534534
},
535535
);
@@ -556,7 +556,7 @@ void main() {
556556

557557
expect(
558558
tester.getSize(find.byType(CupertinoTextField)),
559-
const Size(200, 38),
559+
const Size(200, 36),
560560
);
561561
},
562562
// TODO(mdebbar): Strut styles support.
@@ -586,7 +586,7 @@ void main() {
586586

587587
expect(
588588
tester.getSize(find.byType(CupertinoTextField)),
589-
const Size(200, 68),
589+
const Size(200, 66),
590590
);
591591
},
592592
// TODO(mdebbar): Strut styles support.
@@ -686,7 +686,7 @@ void main() {
686686

687687
expect(
688688
tester.getTopLeft(find.text('initial')) - tester.getTopLeft(find.byType(CupertinoTextField)),
689-
const Offset(7.0, 7.0),
689+
const Offset(6.0, 6.0),
690690
);
691691
},
692692
);
@@ -913,15 +913,15 @@ void main() {
913913
);
914914

915915
expect(
916-
tester.getTopRight(find.byIcon(CupertinoIcons.add)).dx + 7.0, // 7px standard padding around input.
916+
tester.getTopRight(find.byIcon(CupertinoIcons.add)).dx + 6.0, // 6px standard padding around input.
917917
tester.getTopLeft(find.byType(EditableText)).dx,
918918
);
919919

920920
expect(
921921
tester.getTopLeft(find.byType(EditableText)).dx,
922922
tester.getTopLeft(find.byType(CupertinoTextField)).dx
923923
+ tester.getSize(find.byIcon(CupertinoIcons.add)).width
924-
+ 7.0,
924+
+ 6.0,
925925
);
926926
},
927927
);
@@ -944,7 +944,7 @@ void main() {
944944
// The position should just be the edge of the whole text field plus padding.
945945
expect(
946946
tester.getTopLeft(find.byType(EditableText)).dx,
947-
tester.getTopLeft(find.byType(CupertinoTextField)).dx + 7.0,
947+
tester.getTopLeft(find.byType(CupertinoTextField)).dx + 6.0,
948948
);
949949

950950
await tester.enterText(find.byType(CupertinoTextField), 'text input');
@@ -958,7 +958,7 @@ void main() {
958958
tester.getTopLeft(find.byType(EditableText)).dx,
959959
tester.getTopLeft(find.byType(CupertinoTextField)).dx
960960
+ tester.getSize(find.byIcon(CupertinoIcons.add)).width
961-
+ 7.0,
961+
+ 6.0,
962962
);
963963
},
964964
);
@@ -979,15 +979,15 @@ void main() {
979979
);
980980

981981
expect(
982-
tester.getTopRight(find.byType(EditableText)).dx + 7.0,
983-
tester.getTopLeft(find.byIcon(CupertinoIcons.add)).dx, // 7px standard padding around input.
982+
tester.getTopRight(find.byType(EditableText)).dx + 6.0,
983+
tester.getTopLeft(find.byIcon(CupertinoIcons.add)).dx, // 6px standard padding around input.
984984
);
985985

986986
expect(
987987
tester.getTopRight(find.byType(EditableText)).dx,
988988
tester.getTopRight(find.byType(CupertinoTextField)).dx
989989
- tester.getSize(find.byIcon(CupertinoIcons.add)).width
990-
- 7.0,
990+
- 6.0,
991991
);
992992
},
993993
);
@@ -1170,7 +1170,7 @@ void main() {
11701170

11711171
expect(
11721172
tester.getTopRight(find.byType(EditableText)).dx,
1173-
800.0 - 30.0 /* size of button */ - 7.0 /* padding */,
1173+
800.0 - 30.0 /* size of button */ - 6.0 /* padding */,
11741174
);
11751175

11761176
await tester.pumpWidget(
@@ -1188,7 +1188,7 @@ void main() {
11881188
expect(find.byIcon(CupertinoIcons.clear_thick_circled), findsNothing);
11891189
expect(
11901190
tester.getTopRight(find.byType(EditableText)).dx,
1191-
800.0 - 7.0 /* padding */,
1191+
800.0 - 6.0 /* padding */,
11921192
);
11931193

11941194
await tester.enterText(find.byType(CupertinoTextField), 'text input');
@@ -1198,7 +1198,7 @@ void main() {
11981198
expect(find.text('text input'), findsOneWidget);
11991199
expect(
12001200
tester.getTopRight(find.byType(EditableText)).dx,
1201-
800.0 - 30.0 - 7.0,
1201+
800.0 - 30.0 - 6.0,
12021202
);
12031203

12041204
await tester.pumpWidget(
@@ -1302,7 +1302,7 @@ void main() {
13021302

13031303
expect(
13041304
tester.getTopRight(find.byType(EditableText)).dx,
1305-
800.0 - 30.0 /* size of button */ - 7.0 /* padding */,
1305+
800.0 - 30.0 /* size of button */ - 6.0 /* padding */,
13061306
);
13071307

13081308
controller.text = 'non empty text';
@@ -1314,7 +1314,7 @@ void main() {
13141314
// Still just takes the space of one widget.
13151315
expect(
13161316
tester.getTopRight(find.byType(EditableText)).dx,
1317-
800.0 - 24.0 /* size of button */ - 7.0 /* padding */,
1317+
800.0 - 24.0 /* size of button */ - 6.0 /* padding */,
13181318
);
13191319
},
13201320
);
@@ -1334,7 +1334,7 @@ void main() {
13341334

13351335
expect(
13361336
tester.getSize(find.byType(CupertinoTextField)).height,
1337-
31.0,
1337+
29.0,
13381338
);
13391339

13401340
await tester.pumpWidget(
@@ -1353,7 +1353,7 @@ void main() {
13531353

13541354
expect(
13551355
tester.getSize(find.byType(CupertinoTextField)).height,
1356-
64.0,
1356+
62.0,
13571357
);
13581358
},
13591359
);
@@ -1371,7 +1371,7 @@ void main() {
13711371

13721372
expect(
13731373
tester.getSize(find.byType(CupertinoTextField)).height,
1374-
31.0,
1374+
29.0,
13751375
);
13761376

13771377
await tester.pumpWidget(
@@ -1389,7 +1389,7 @@ void main() {
13891389

13901390
expect(
13911391
tester.getSize(find.byType(CupertinoTextField)).height,
1392-
64.0,
1392+
62.0,
13931393
);
13941394
},
13951395
);
@@ -1440,15 +1440,15 @@ void main() {
14401440

14411441
expect(
14421442
tester.getSize(find.byType(CupertinoTextField)).height,
1443-
31.0, // Initially one line high.
1443+
29.0, // Initially one line high.
14441444
);
14451445

14461446
await tester.enterText(find.byType(CupertinoTextField), '\n');
14471447
await tester.pump();
14481448

14491449
expect(
14501450
tester.getSize(find.byType(CupertinoTextField)).height,
1451-
48.0, // Initially one line high.
1451+
46.0, // Initially one line high.
14521452
);
14531453
},
14541454
);
@@ -1468,15 +1468,15 @@ void main() {
14681468

14691469
expect(
14701470
tester.getSize(find.byType(CupertinoTextField)).height,
1471-
31.0, // Initially one line high.
1471+
29.0, // Initially one line high.
14721472
);
14731473

14741474
await tester.enterText(find.byType(CupertinoTextField), '\n');
14751475
await tester.pump();
14761476

14771477
expect(
14781478
tester.getSize(find.byType(CupertinoTextField)).height,
1479-
48.0, // Initially one line high.
1479+
46.0, // Initially one line high.
14801480
);
14811481
},
14821482
);
@@ -3009,14 +3009,14 @@ void main() {
30093009

30103010
expect(lastCharEndpoint.length, 1);
30113011
// The last character is now on screen.
3012-
expect(lastCharEndpoint[0].point.dx, moreOrLessEquals(784.73, epsilon: 0.25));
3012+
expect(lastCharEndpoint[0].point.dx, moreOrLessEquals(786.73, epsilon: 0.25));
30133013

30143014
final List<TextSelectionPoint> firstCharEndpoint = renderEditable.getEndpointsForSelection(
30153015
const TextSelection.collapsed(offset: 0), // First character's position.
30163016
);
30173017
expect(firstCharEndpoint.length, 1);
30183018
// The first character is now offscreen to the left.
3019-
expect(firstCharEndpoint[0].point.dx, moreOrLessEquals(-310.20, epsilon: 0.25));
3019+
expect(firstCharEndpoint[0].point.dx, moreOrLessEquals(-308.20, epsilon: 0.25));
30203020
}, variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS, TargetPlatform.macOS }));
30213021

30223022
testWidgets(
@@ -4096,7 +4096,7 @@ void main() {
40964096
child: ListView(
40974097
controller: scrollController,
40984098
children: <Widget>[
4099-
Container(height: 583), // Push field almost off screen.
4099+
Container(height: 585), // Push field almost off screen.
41004100
CupertinoTextField(controller: controller),
41014101
Container(height: 1000),
41024102
],
@@ -4111,7 +4111,7 @@ void main() {
41114111

41124112
// The ListView has scrolled to keep the TextField and cursor handle
41134113
// visible.
4114-
expect(scrollController.offset, 25.0);
4114+
expect(scrollController.offset, 26.0);
41154115
});
41164116

41174117
testWidgets('disabled state golden', (WidgetTester tester) async {
@@ -4614,7 +4614,7 @@ void main() {
46144614

46154615
// The EditableText is at the top.
46164616
expect(tester.getTopLeft(find.byType(CupertinoTextField)).dy, moreOrLessEquals(size.height, epsilon: .0001));
4617-
expect(tester.getTopLeft(find.byType(EditableText)).dy, moreOrLessEquals(207.0, epsilon: .0001));
4617+
expect(tester.getTopLeft(find.byType(EditableText)).dy, moreOrLessEquals(206.0, epsilon: .0001));
46184618
});
46194619

46204620
testWidgets('align center', (WidgetTester tester) async {
@@ -4708,7 +4708,7 @@ void main() {
47084708

47094709
// The EditableText is at the bottom.
47104710
expect(tester.getTopLeft(find.byType(CupertinoTextField)).dy, moreOrLessEquals(size.height, epsilon: .0001));
4711-
expect(tester.getTopLeft(find.byType(EditableText)).dy, moreOrLessEquals(376.0, epsilon: .0001));
4711+
expect(tester.getTopLeft(find.byType(EditableText)).dy, moreOrLessEquals(377.0, epsilon: .0001));
47124712
});
47134713

47144714
testWidgets('align as a double', (WidgetTester tester) async {
@@ -4755,7 +4755,7 @@ void main() {
47554755

47564756
// The EditableText is near the bottom.
47574757
expect(tester.getTopLeft(find.byType(CupertinoTextField)).dy, moreOrLessEquals(size.height, epsilon: .0001));
4758-
expect(tester.getTopLeft(find.byType(EditableText)).dy, moreOrLessEquals(354.875, epsilon: .0001));
4758+
expect(tester.getTopLeft(find.byType(EditableText)).dy, moreOrLessEquals(355.625, epsilon: .0001));
47594759
});
47604760
});
47614761

0 commit comments

Comments
 (0)