Skip to content

Commit 26d4e92

Browse files
authored
removes Material (#96899)
1 parent a6504ea commit 26d4e92

File tree

8 files changed

+410
-528
lines changed

8 files changed

+410
-528
lines changed

packages/flutter/test/material/elevated_button_test.dart

Lines changed: 78 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -419,20 +419,18 @@ void main() {
419419
final GlobalKey childKey = GlobalKey();
420420
bool hovering = false;
421421
await tester.pumpWidget(
422-
Material(
423-
child: Directionality(
424-
textDirection: TextDirection.ltr,
425-
child: SizedBox(
426-
width: 100,
427-
height: 100,
428-
child: ElevatedButton(
429-
autofocus: true,
430-
onPressed: () {},
431-
onLongPress: () {},
432-
onHover: (bool value) { hovering = value; },
433-
focusNode: focusNode,
434-
child: SizedBox(key: childKey),
435-
),
422+
Directionality(
423+
textDirection: TextDirection.ltr,
424+
child: SizedBox(
425+
width: 100,
426+
height: 100,
427+
child: ElevatedButton(
428+
autofocus: true,
429+
onPressed: () {},
430+
onLongPress: () {},
431+
onHover: (bool value) { hovering = value; },
432+
focusNode: focusNode,
433+
child: SizedBox(key: childKey),
436434
),
437435
),
438436
),
@@ -447,18 +445,16 @@ void main() {
447445
expect(hovering, isTrue);
448446

449447
await tester.pumpWidget(
450-
Material(
451-
child: Directionality(
452-
textDirection: TextDirection.ltr,
453-
child: SizedBox(
454-
width: 100,
455-
height: 100,
456-
child: ElevatedButton(
457-
focusNode: focusNode,
458-
onHover: (bool value) { hovering = value; },
459-
onPressed: null,
460-
child: SizedBox(key: childKey),
461-
),
448+
Directionality(
449+
textDirection: TextDirection.ltr,
450+
child: SizedBox(
451+
width: 100,
452+
height: 100,
453+
child: ElevatedButton(
454+
focusNode: focusNode,
455+
onHover: (bool value) { hovering = value; },
456+
onPressed: null,
457+
child: SizedBox(key: childKey),
462458
),
463459
),
464460
),
@@ -473,21 +469,19 @@ void main() {
473469
late bool hover;
474470

475471
Widget buildFrame({ required bool enabled }) {
476-
return Material(
477-
child: Directionality(
478-
textDirection: TextDirection.ltr,
479-
child: Center(
480-
child: SizedBox(
481-
width: 100,
482-
height: 100,
483-
child: ElevatedButton(
484-
onPressed: enabled ? () { } : null,
485-
onHover: (bool value) {
486-
onHoverCount += 1;
487-
hover = value;
488-
},
489-
child: const Text('ElevatedButton'),
490-
),
472+
return Directionality(
473+
textDirection: TextDirection.ltr,
474+
child: Center(
475+
child: SizedBox(
476+
width: 100,
477+
height: 100,
478+
child: ElevatedButton(
479+
onPressed: enabled ? () { } : null,
480+
onHover: (bool value) {
481+
onHoverCount += 1;
482+
hover = value;
483+
},
484+
child: const Text('ElevatedButton'),
491485
),
492486
),
493487
),
@@ -537,15 +531,13 @@ void main() {
537531
final FocusNode node = FocusNode(debugLabel: 'ElevatedButton Focus');
538532
bool gotFocus = false;
539533
await tester.pumpWidget(
540-
Material(
541-
child: Directionality(
542-
textDirection: TextDirection.ltr,
543-
child: ElevatedButton(
544-
focusNode: node,
545-
onFocusChange: (bool focused) => gotFocus = focused,
546-
onPressed: () { },
547-
child: const SizedBox(),
548-
),
534+
Directionality(
535+
textDirection: TextDirection.ltr,
536+
child: ElevatedButton(
537+
focusNode: node,
538+
onFocusChange: (bool focused) => gotFocus = focused,
539+
onPressed: () { },
540+
child: const SizedBox(),
549541
),
550542
),
551543
);
@@ -568,15 +560,13 @@ void main() {
568560
final FocusNode node = FocusNode(debugLabel: 'ElevatedButton Focus');
569561
bool gotFocus = false;
570562
await tester.pumpWidget(
571-
Material(
572-
child: Directionality(
573-
textDirection: TextDirection.ltr,
574-
child: ElevatedButton(
575-
focusNode: node,
576-
onFocusChange: (bool focused) => gotFocus = focused,
577-
onPressed: null,
578-
child: const SizedBox(),
579-
),
563+
Directionality(
564+
textDirection: TextDirection.ltr,
565+
child: ElevatedButton(
566+
focusNode: node,
567+
onFocusChange: (bool focused) => gotFocus = focused,
568+
onPressed: null,
569+
child: const SizedBox(),
580570
),
581571
),
582572
);
@@ -681,18 +671,16 @@ void main() {
681671
await tester.pumpWidget(
682672
Directionality(
683673
textDirection: TextDirection.ltr,
684-
child: Material(
685-
child: Center(
686-
child: ElevatedButton(
687-
style: ButtonStyle(
688-
// Specifying minimumSize to mimic the original minimumSize for
689-
// RaisedButton so that the semantics tree's rect and transform
690-
// match the original version of this test.
691-
minimumSize: MaterialStateProperty.all<Size>(const Size(88, 36)),
692-
),
693-
onPressed: () { },
694-
child: const Text('ABC'),
674+
child: Center(
675+
child: ElevatedButton(
676+
style: ButtonStyle(
677+
// Specifying minimumSize to mimic the original minimumSize for
678+
// RaisedButton so that the semantics tree's rect and transform
679+
// match the original version of this test.
680+
minimumSize: MaterialStateProperty.all<Size>(const Size(88, 36)),
695681
),
682+
onPressed: () { },
683+
child: const Text('ABC'),
696684
),
697685
),
698686
),
@@ -736,14 +724,12 @@ void main() {
736724
data: ThemeData(materialTapTargetSize: tapTargetSize),
737725
child: Directionality(
738726
textDirection: TextDirection.ltr,
739-
child: Material(
740-
child: Center(
741-
child: ElevatedButton(
742-
key: key,
743-
style: style,
744-
child: const SizedBox(width: 50.0, height: 8.0),
745-
onPressed: () { },
746-
),
727+
child: Center(
728+
child: ElevatedButton(
729+
key: key,
730+
style: style,
731+
child: const SizedBox(width: 50.0, height: 8.0),
732+
onPressed: () { },
747733
),
748734
),
749735
),
@@ -763,11 +749,9 @@ void main() {
763749
await tester.pumpWidget(
764750
Directionality(
765751
textDirection: TextDirection.ltr,
766-
child: Material(
767-
child: ElevatedButton(
768-
onPressed: () { /* to make sure the button is enabled */ },
769-
child: const Text('button'),
770-
),
752+
child: ElevatedButton(
753+
onPressed: () { /* to make sure the button is enabled */ },
754+
child: const Text('button'),
771755
),
772756
),
773757
);
@@ -855,19 +839,17 @@ void main() {
855839
// horizontal padding is applied correctly later on
856840
Directionality(
857841
textDirection: TextDirection.ltr,
858-
child: Material(
859-
child: Center(
860-
child: ElevatedButton.icon(
861-
key: buttonKey,
862-
style: ButtonStyle(
863-
padding: MaterialStateProperty.all<EdgeInsets>(const EdgeInsets.fromLTRB(16, 5, 10, 12)),
864-
),
865-
onPressed: () {},
866-
icon: const Icon(Icons.add),
867-
label: const Text(
868-
'Hello',
869-
key: labelKey,
870-
),
842+
child: Center(
843+
child: ElevatedButton.icon(
844+
key: buttonKey,
845+
style: ButtonStyle(
846+
padding: MaterialStateProperty.all<EdgeInsets>(const EdgeInsets.fromLTRB(16, 5, 10, 12)),
847+
),
848+
onPressed: () {},
849+
icon: const Icon(Icons.add),
850+
label: const Text(
851+
'Hello',
852+
key: labelKey,
871853
),
872854
),
873855
),

packages/flutter/test/material/flat_button_test.dart

Lines changed: 35 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -395,11 +395,9 @@ void main() {
395395
await tester.pumpWidget(
396396
Directionality(
397397
textDirection: TextDirection.ltr,
398-
child: Material(
399-
child: FlatButton(
400-
child: Container(),
401-
onPressed: () { /* to make sure the button is enabled */ },
402-
),
398+
child: FlatButton(
399+
child: Container(),
400+
onPressed: () { /* to make sure the button is enabled */ },
403401
),
404402
),
405403
);
@@ -536,12 +534,10 @@ void main() {
536534
await tester.pumpWidget(
537535
Directionality(
538536
textDirection: TextDirection.ltr,
539-
child: Material(
540-
child: Center(
541-
child: FlatButton(
542-
onPressed: () { },
543-
child: const Text('ABC'),
544-
),
537+
child: Center(
538+
child: FlatButton(
539+
onPressed: () { },
540+
child: const Text('ABC'),
545541
),
546542
),
547543
),
@@ -576,14 +572,12 @@ void main() {
576572
await tester.pumpWidget(
577573
Directionality(
578574
textDirection: TextDirection.ltr,
579-
child: Material(
580-
child: MediaQuery(
581-
data: const MediaQueryData(),
582-
child: Center(
583-
child: FlatButton(
584-
onPressed: () { },
585-
child: const Text('ABC'),
586-
),
575+
child: MediaQuery(
576+
data: const MediaQueryData(),
577+
child: Center(
578+
child: FlatButton(
579+
onPressed: () { },
580+
child: const Text('ABC'),
587581
),
588582
),
589583
),
@@ -597,14 +591,12 @@ void main() {
597591
await tester.pumpWidget(
598592
Directionality(
599593
textDirection: TextDirection.ltr,
600-
child: Material(
601-
child: MediaQuery(
602-
data: const MediaQueryData(textScaleFactor: 1.3),
603-
child: Center(
604-
child: FlatButton(
605-
onPressed: () { },
606-
child: const Text('ABC'),
607-
),
594+
child: MediaQuery(
595+
data: const MediaQueryData(textScaleFactor: 1.3),
596+
child: Center(
597+
child: FlatButton(
598+
onPressed: () { },
599+
child: const Text('ABC'),
608600
),
609601
),
610602
),
@@ -621,14 +613,12 @@ void main() {
621613
await tester.pumpWidget(
622614
Directionality(
623615
textDirection: TextDirection.ltr,
624-
child: Material(
625-
child: MediaQuery(
626-
data: const MediaQueryData(textScaleFactor: 3.0),
627-
child: Center(
628-
child: FlatButton(
629-
onPressed: () { },
630-
child: const Text('ABC'),
631-
),
616+
child: MediaQuery(
617+
data: const MediaQueryData(textScaleFactor: 3.0),
618+
child: Center(
619+
child: FlatButton(
620+
onPressed: () { },
621+
child: const Text('ABC'),
632622
),
633623
),
634624
),
@@ -650,13 +640,11 @@ void main() {
650640
data: ThemeData(materialTapTargetSize: MaterialTapTargetSize.padded),
651641
child: Directionality(
652642
textDirection: TextDirection.ltr,
653-
child: Material(
654-
child: Center(
655-
child: FlatButton(
656-
key: key1,
657-
child: const SizedBox(width: 50.0, height: 8.0),
658-
onPressed: () { },
659-
),
643+
child: Center(
644+
child: FlatButton(
645+
key: key1,
646+
child: const SizedBox(width: 50.0, height: 8.0),
647+
onPressed: () { },
660648
),
661649
),
662650
),
@@ -671,13 +659,11 @@ void main() {
671659
data: ThemeData(materialTapTargetSize: MaterialTapTargetSize.shrinkWrap),
672660
child: Directionality(
673661
textDirection: TextDirection.ltr,
674-
child: Material(
675-
child: Center(
676-
child: FlatButton(
677-
key: key2,
678-
child: const SizedBox(width: 50.0, height: 8.0),
679-
onPressed: () { },
680-
),
662+
child: Center(
663+
child: FlatButton(
664+
key: key2,
665+
child: const SizedBox(width: 50.0, height: 8.0),
666+
onPressed: () { },
681667
),
682668
),
683669
),

packages/flutter/test/material/floating_action_button_test.dart

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -897,11 +897,9 @@ void main() {
897897
await tester.pumpWidget(
898898
Directionality(
899899
textDirection: TextDirection.ltr,
900-
child: Material(
901-
child: FloatingActionButton(
902-
focusNode: focusNode,
903-
onPressed: () { /* to make sure the button is enabled */ },
904-
),
900+
child: FloatingActionButton(
901+
focusNode: focusNode,
902+
onPressed: () { /* to make sure the button is enabled */ },
905903
),
906904
),
907905
);

0 commit comments

Comments
 (0)