Replace MaterialButton from test classes (#128466)

fixes https://github.com/flutter/flutter/issues/128465
This commit is contained in:
Taha Tesser
2023-06-09 11:04:07 +03:00
committed by GitHub
parent 8600eb129c
commit 192b06405b
6 changed files with 32 additions and 28 deletions

View File

@@ -1402,9 +1402,9 @@ void main() {
reverseDuration: const Duration(seconds: 2),
),
builder: (BuildContext context) {
return MaterialButton(
onPressed: () => Navigator.pop(context),
return ElevatedButton(
key: tapTargetToClose,
onPressed: () => Navigator.pop(context),
child: const Text('BottomSheet'),
);
},
@@ -1551,9 +1551,9 @@ void main() {
context: context,
transitionAnimationController: controller,
builder: (BuildContext context) {
return MaterialButton(
onPressed: () => Navigator.pop(context),
return ElevatedButton(
key: tapTargetToClose,
onPressed: () => Navigator.pop(context),
child: const Text('BottomSheet'),
);
},

View File

@@ -22,9 +22,9 @@ void main() {
children: <Widget>[
const Text('I am text!'),
const Text('Moar text!!1'),
MaterialButton(
child: const Text('Button'),
ElevatedButton(
onPressed: () { },
child: const Text('Button'),
),
],
),

View File

@@ -1029,7 +1029,7 @@ class _TestSearchDelegate extends SearchDelegate<String> {
@override
Widget buildSuggestions(BuildContext context) {
queriesForSuggestions.add(query);
return MaterialButton(
return ElevatedButton(
onPressed: () {
showResults(context);
},
@@ -1066,7 +1066,7 @@ class _TestEmptySearchDelegate extends SearchDelegate<String> {
@override
Widget buildSuggestions(BuildContext context) {
return MaterialButton(
return ElevatedButton(
onPressed: () {
showResults(context);
},

View File

@@ -1345,9 +1345,13 @@ void main() {
Text('Second child', style: TextStyle(fontFamily: 'FlutterTest', fontSize: 8.0)),
],
),
const MaterialButton(
ElevatedButton(
onPressed: null,
child: Text('Material Button', style: TextStyle(fontFamily: 'FlutterTest', fontSize: 20.0)),
style: ElevatedButton.styleFrom(textStyle: const TextStyle(
fontFamily: 'FlutterTest',
fontSize: 20.0,
)),
child: const Text('Elevated Button'),
),
const Text('Text', style: TextStyle(fontFamily: 'FlutterTest', fontSize: 28.0)),
],
@@ -1366,11 +1370,11 @@ void main() {
final double firstToggleButtonDy = tester.getBottomLeft(find.text('First child')).dy;
final double secondToggleButtonDy = tester.getBottomLeft(find.text('Second child')).dy;
final double materialButtonDy = tester.getBottomLeft(find.text('Material Button')).dy;
final double elevatedButtonDy = tester.getBottomLeft(find.text('Elevated Button')).dy;
final double textDy = tester.getBottomLeft(find.text('Text')).dy;
expect(firstToggleButtonDy, secondToggleButtonDy);
expect(firstToggleButtonDy, materialButtonDy - 3.0);
expect(firstToggleButtonDy, elevatedButtonDy - 3.0);
expect(firstToggleButtonDy, textDy - 5.0);
});

View File

@@ -863,10 +863,10 @@ void main() {
await tester.pumpWidget(
MaterialApp(
home: FocusableActionDetector(
child: MaterialButton(
child: ElevatedButton(
onPressed: () {},
focusNode: buttonNode,
child: const Text('Test'),
onPressed: () {},
),
),
),
@@ -882,10 +882,10 @@ void main() {
MaterialApp(
home: FocusableActionDetector(
descendantsAreFocusable: false,
child: MaterialButton(
child: ElevatedButton(
onPressed: () {},
focusNode: buttonNode,
child: const Text('Test'),
onPressed: () {},
),
),
),
@@ -910,15 +910,15 @@ void main() {
home: FocusableActionDetector(
child: Column(
children: <Widget>[
MaterialButton(
ElevatedButton(
onPressed: () {},
focusNode: buttonNode1,
child: const Text('Node 1'),
onPressed: () {},
),
MaterialButton(
ElevatedButton(
onPressed: () {},
focusNode: buttonNode2,
child: const Text('Node 2'),
onPressed: () {},
),
],
),
@@ -941,15 +941,15 @@ void main() {
descendantsAreTraversable: false,
child: Column(
children: <Widget>[
MaterialButton(
ElevatedButton(
onPressed: () {},
focusNode: buttonNode1,
child: const Text('Node 1'),
onPressed: () {},
),
MaterialButton(
ElevatedButton(
onPressed: () {},
focusNode: buttonNode2,
child: const Text('Node 2'),
onPressed: () {},
),
],
),

View File

@@ -331,7 +331,7 @@ void main() {
policy: WidgetOrderTraversalPolicy(),
child: Center(
child: Builder(builder: (BuildContext context) {
return MaterialButton(
return ElevatedButton(
key: key1,
focusNode: testNode1,
autofocus: true,
@@ -340,7 +340,7 @@ void main() {
MaterialPageRoute<void>(
builder: (BuildContext context) {
return Center(
child: MaterialButton(
child: ElevatedButton(
key: key2,
focusNode: testNode2,
autofocus: true,
@@ -1218,7 +1218,7 @@ void main() {
child: Builder(builder: (BuildContext context) {
return FocusTraversalOrder(
order: const NumericFocusOrder(0),
child: MaterialButton(
child: ElevatedButton(
key: key1,
focusNode: testNode1,
autofocus: true,
@@ -1229,7 +1229,7 @@ void main() {
return Center(
child: FocusTraversalOrder(
order: const NumericFocusOrder(0),
child: MaterialButton(
child: ElevatedButton(
key: key2,
focusNode: testNode2,
autofocus: true,