Unverified Commit 73ce3f21 authored by Hans Muller's avatar Hans Muller Committed by GitHub

Updated old button references in packages/flutter_test (#63230)

parent 61349ca6
...@@ -583,9 +583,11 @@ void main() { ...@@ -583,9 +583,11 @@ void main() {
theme: ThemeData.light(), theme: ThemeData.light(),
home: Scaffold( home: Scaffold(
backgroundColor: Colors.white, backgroundColor: Colors.white,
body: RaisedButton( body: ElevatedButton(
color: const Color(0xFFFBBC04), style: ElevatedButton.styleFrom(
elevation: 0, primary: const Color(0xFFFBBC04),
elevation: 0,
),
onPressed: () {}, onPressed: () {},
child: const Text('Button', style: TextStyle(color: Colors.black)), child: const Text('Button', style: TextStyle(color: Colors.black)),
), ),
......
...@@ -10,11 +10,13 @@ void main() { ...@@ -10,11 +10,13 @@ void main() {
tester.binding.window.devicePixelRatioTestValue = 1.2; tester.binding.window.devicePixelRatioTestValue = 1.2;
tester.binding.window.physicalSizeTestValue = const Size(250, 300); tester.binding.window.physicalSizeTestValue = const Size(250, 300);
final RaisedButton invalidButton = RaisedButton( final Widget invalidButton = ElevatedButton(
onPressed: () {}, onPressed: () {},
style: ElevatedButton.styleFrom(
primary: Colors.orangeAccent, // background fill color
onPrimary: Colors.orange, // text foreground color
),
child: const Text('Button'), child: const Text('Button'),
textColor: Colors.orange,
color: Colors.orangeAccent,
); );
await tester.pumpWidget(MaterialApp(home: Scaffold(body: invalidButton))); await tester.pumpWidget(MaterialApp(home: Scaffold(body: invalidButton)));
...@@ -26,15 +28,17 @@ void main() { ...@@ -26,15 +28,17 @@ void main() {
tester.binding.window.devicePixelRatioTestValue = 4.2; tester.binding.window.devicePixelRatioTestValue = 4.2;
tester.binding.window.physicalSizeTestValue = const Size(2500, 3000); tester.binding.window.physicalSizeTestValue = const Size(2500, 3000);
final RaisedButton invalidButton = RaisedButton( final Widget invalidButton = ElevatedButton(
onPressed: () {}, onPressed: () {},
style: ElevatedButton.styleFrom(
primary: Colors.orangeAccent, // background fill color
onPrimary: Colors.orange, // text foreground color
),
child: const Text('Button'), child: const Text('Button'),
textColor: Colors.orange,
color: Colors.orangeAccent,
); );
await tester.pumpWidget(MaterialApp(home: Scaffold(body: invalidButton))); await tester.pumpWidget(MaterialApp(home: Scaffold(body: invalidButton)));
final Evaluation result = await textContrastGuideline.evaluate(tester); final Evaluation result = await textContrastGuideline.evaluate(tester);
expect(result.passed, false); expect(result.passed, false);
}); });
} }
\ No newline at end of file
...@@ -63,7 +63,7 @@ void main() { ...@@ -63,7 +63,7 @@ void main() {
MaterialApp( MaterialApp(
home: Scaffold( home: Scaffold(
body: Container( body: Container(
child: OutlineButton( child: OutlinedButton(
onPressed: () { }, onPressed: () { },
child: const Text('hello'), child: const Text('hello'),
), ),
...@@ -85,7 +85,7 @@ void main() { ...@@ -85,7 +85,7 @@ void main() {
MaterialApp( MaterialApp(
home: Scaffold( home: Scaffold(
body: Container( body: Container(
child: OutlineButton( child: OutlinedButton(
onPressed: () { }, onPressed: () { },
child: const Text('hello'), child: const Text('hello'),
), ),
......
...@@ -41,7 +41,7 @@ void main() { ...@@ -41,7 +41,7 @@ void main() {
Semantics( Semantics(
label: 'Add', label: 'Add',
button: true, button: true,
child: const FlatButton( child: const TextButton(
child: Text('+'), child: Text('+'),
onPressed: null, onPressed: null,
), ),
......
...@@ -18,7 +18,7 @@ class _CountButtonState extends State<CountButton> { ...@@ -18,7 +18,7 @@ class _CountButtonState extends State<CountButton> {
int counter = 0; int counter = 0;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return RaisedButton( return ElevatedButton(
child: Text('Counter $counter'), child: Text('Counter $counter'),
onPressed: () { onPressed: () {
setState(() { setState(() {
......
...@@ -375,7 +375,7 @@ void main() { ...@@ -375,7 +375,7 @@ void main() {
home: Center( home: Center(
child: Builder( child: Builder(
builder: (BuildContext context) { builder: (BuildContext context) {
return RaisedButton( return ElevatedButton(
child: const Text('Next'), child: const Text('Next'),
onPressed: () { onPressed: () {
Navigator.push<void>(context, MaterialPageRoute<void>( Navigator.push<void>(context, MaterialPageRoute<void>(
......
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