Skip to content

Commit 622e8d5

Browse files
Migrate to the New Material Buttons (#668)
1 parent 6502209 commit 622e8d5

File tree

44 files changed

+122
-107
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+122
-107
lines changed

add_to_app/flutter_module/lib/main.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,15 +138,15 @@ class Contents extends StatelessWidget {
138138
SizedBox(height: 16),
139139
Consumer<CounterModel>(
140140
builder: (context, model, child) {
141-
return RaisedButton(
141+
return ElevatedButton(
142142
onPressed: () => model.increment(),
143143
child: Text('Tap me!'),
144144
);
145145
},
146146
),
147147
if (showExit) ...[
148148
SizedBox(height: 16),
149-
RaisedButton(
149+
ElevatedButton(
150150
onPressed: () => SystemNavigator.pop(animated: true),
151151
child: Text('Exit this screen'),
152152
),

add_to_app/flutter_module_using_plugin/lib/main.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,13 +140,13 @@ class Contents extends StatelessWidget {
140140
SizedBox(height: 16),
141141
Consumer<CounterModel>(
142142
builder: (context, model, child) {
143-
return RaisedButton(
143+
return ElevatedButton(
144144
onPressed: () => model.increment(),
145145
child: Text('Tap me!'),
146146
);
147147
},
148148
),
149-
RaisedButton(
149+
ElevatedButton(
150150
onPressed: () async {
151151
// Use the url_launcher plugin to open the Flutter docs in
152152
// a browser.
@@ -159,7 +159,7 @@ class Contents extends StatelessWidget {
159159
),
160160
if (showExit) ...[
161161
SizedBox(height: 16),
162-
RaisedButton(
162+
ElevatedButton(
163163
onPressed: () => SystemNavigator.pop(),
164164
child: Text('Exit this screen'),
165165
),

animations/lib/src/basics/01_animated_container.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class _AnimatedContainerDemoState extends State<AnimatedContainerDemo> {
6969
),
7070
),
7171
),
72-
RaisedButton(
72+
ElevatedButton(
7373
child: Text(
7474
'change',
7575
),

animations/lib/src/basics/02_page_route_builder.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class PageRouteBuilderDemo extends StatelessWidget {
1414
title: Text('Page 1'),
1515
),
1616
body: Center(
17-
child: RaisedButton(
17+
child: ElevatedButton(
1818
child: Text('Go!'),
1919
onPressed: () {
2020
Navigator.of(context).push<void>(_createRoute());

animations/lib/src/basics/03_animation_controller.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class _AnimationControllerDemoState extends State<AnimationControllerDemo>
6868
textScaleFactor: 1 + controller.value,
6969
),
7070
),
71-
RaisedButton(
71+
ElevatedButton(
7272
child: Text('animate'),
7373
onPressed: () {
7474
if (controller.status == AnimationStatus.completed) {

animations/lib/src/basics/04_tweens.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class _TweenDemoState extends State<TweenDemo>
5151
child: Text('\$${animation.value.toStringAsFixed(2)}',
5252
style: TextStyle(fontSize: 24)),
5353
),
54-
RaisedButton(
54+
ElevatedButton(
5555
child: Text(
5656
controller.status == AnimationStatus.completed
5757
? 'Buy a Mansion'

animations/lib/src/basics/08_fade_transition.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class _FadeTransitionDemoState extends State<FadeTransitionDemo>
6161
size: 300,
6262
),
6363
),
64-
RaisedButton(
64+
ElevatedButton(
6565
child: Text('animate'),
6666
onPressed: () => setState(() {
6767
_controller.animateTo(1.0).then<TickerFuture>(

animations/lib/src/misc/card_swipe.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class _CardSwipeDemoState extends State<CardSwipeDemo> {
5959
),
6060
),
6161
),
62-
RaisedButton(
62+
ElevatedButton(
6363
child: const Text('Refill'),
6464
onPressed: () {
6565
setState(() {

animations/lib/src/misc/curved_animation.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ class _CurvedAnimationDemoState extends State<CurvedAnimationDemo>
146146
),
147147
),
148148
SizedBox(height: 25.0),
149-
RaisedButton(
149+
ElevatedButton(
150150
onPressed: () {
151151
controller.forward();
152152
},

animations/test/misc/card_swipe_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ void main() {
5656
await tester.pumpAndSettle();
5757

5858
// Tap the Refill button.
59-
await tester.tap(find.byType(RaisedButton));
59+
await tester.tap(find.byType(ElevatedButton));
6060
await tester.pumpAndSettle();
6161

6262
// Check if the entire stack is refilled.

experimental/desktop_photo_search/lib/src/widgets/photo_search_dialog.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@ class _PhotoSearchDialogState extends State<PhotoSearchDialog> {
5050
},
5151
),
5252
actions: <Widget>[
53-
FlatButton(
53+
TextButton(
5454
onPressed: () {
5555
Navigator.of(context).pop();
5656
},
5757
child: Text('Cancel'.toUpperCase()),
5858
),
59-
FlatButton(
59+
TextButton(
6060
onPressed: _searchEnabled
6161
? () {
6262
widget.callback(_controller.text);

experimental/desktop_photo_search/test/widget_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ class PhotoSearchModelTester extends StatelessWidget {
9090
@override
9191
Widget build(BuildContext context) {
9292
return MaterialApp(
93-
home: FlatButton(
93+
home: TextButton(
9494
key: fabKey,
9595
onPressed: () async {
9696
await Provider.of<PhotoSearchModel>(

experimental/federated_plugin/federated_plugin/example/lib/main.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class _HomePageState extends State<HomePage> {
4747
style: Theme.of(context).textTheme.headline5,
4848
),
4949
SizedBox(height: 16),
50-
RaisedButton(
50+
ElevatedButton(
5151
child: Text('Get Battery Level'),
5252
onPressed: () async {
5353
try {

experimental/federated_plugin/federated_plugin/example/test/widget_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ void main() {
2222
await tester.pumpWidget(MyApp());
2323

2424
// Tap button to retrieve current battery level from platform.
25-
await tester.tap(find.byType(RaisedButton));
25+
await tester.tap(find.byType(ElevatedButton));
2626
await tester.pumpAndSettle();
2727

2828
expect(find.text('Battery Level: $batteryLevel'), findsOneWidget);

experimental/web_dashboard/lib/src/pages/home.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ class _HomePageState extends State<HomePage> {
3030
actions: [
3131
Padding(
3232
padding: const EdgeInsets.all(8.0),
33-
child: FlatButton(
34-
textColor: Colors.white,
33+
child: TextButton(
34+
style: TextButton.styleFrom(primary: Colors.white),
3535
onPressed: () => _handleSignOut(),
3636
child: Text('Sign Out'),
3737
),
@@ -90,13 +90,13 @@ class _HomePageState extends State<HomePage> {
9090
builder: (context) => AlertDialog(
9191
title: Text('Are you sure you want to sign out?'),
9292
actions: [
93-
FlatButton(
93+
TextButton(
9494
child: Text('No'),
9595
onPressed: () {
9696
Navigator.of(context).pop(false);
9797
},
9898
),
99-
FlatButton(
99+
TextButton(
100100
child: Text('Yes'),
101101
onPressed: () {
102102
Navigator.of(context).pop(true);

experimental/web_dashboard/lib/src/pages/sign_in.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class _SignInButtonState extends State<SignInButton> {
8686
_showError();
8787
}
8888

89-
return RaisedButton(
89+
return ElevatedButton(
9090
child: Text('Sign In with Google'),
9191
onPressed: () => _signIn(),
9292
);

experimental/web_dashboard/lib/src/widgets/category_forms.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class _EditCategoryFormState extends State<EditCategoryForm> {
7676
children: [
7777
Padding(
7878
padding: const EdgeInsets.only(left: 8.0, right: 8.0),
79-
child: RaisedButton(
79+
child: ElevatedButton(
8080
child: Text('Cancel'),
8181
onPressed: () {
8282
widget.onDone(false);
@@ -85,7 +85,7 @@ class _EditCategoryFormState extends State<EditCategoryForm> {
8585
),
8686
Padding(
8787
padding: const EdgeInsets.only(left: 8.0, right: 8.0),
88-
child: RaisedButton(
88+
child: ElevatedButton(
8989
child: Text('OK'),
9090
onPressed: () {
9191
if (_formKey.currentState.validate()) {

experimental/web_dashboard/lib/src/widgets/edit_entry.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ class _EditEntryFormState extends State<EditEntryForm> {
103103
mainAxisAlignment: MainAxisAlignment.spaceBetween,
104104
children: [
105105
Text(intl.DateFormat('MM/dd/yyyy').format(widget.entry.time)),
106-
RaisedButton(
106+
ElevatedButton(
107107
child: Text('Edit'),
108108
onPressed: () async {
109109
var result = await showDatePicker(
@@ -127,7 +127,7 @@ class _EditEntryFormState extends State<EditEntryForm> {
127127
children: [
128128
Padding(
129129
padding: const EdgeInsets.only(left: 8.0, right: 8.0),
130-
child: RaisedButton(
130+
child: ElevatedButton(
131131
child: Text('Cancel'),
132132
onPressed: () {
133133
widget.onDone(false);
@@ -136,7 +136,7 @@ class _EditEntryFormState extends State<EditEntryForm> {
136136
),
137137
Padding(
138138
padding: const EdgeInsets.only(left: 8.0, right: 8.0),
139-
child: RaisedButton(
139+
child: ElevatedButton(
140140
child: Text('OK'),
141141
onPressed: () {
142142
if (_formKey.currentState.validate()) {

form_app/lib/src/form_widgets.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ class _FormDatePickerState extends State<_FormDatePicker> {
190190
),
191191
],
192192
),
193-
FlatButton(
193+
TextButton(
194194
child: Text('Edit'),
195195
onPressed: () async {
196196
var newDate = await showDatePicker(

form_app/lib/src/sign_in_http.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class _SignInHttpDemoState extends State<SignInHttpDemo> {
7373
formData.password = value;
7474
},
7575
),
76-
FlatButton(
76+
TextButton(
7777
child: Text('Sign in'),
7878
onPressed: () async {
7979
// Use a JSON encoded string to send
@@ -113,7 +113,7 @@ class _SignInHttpDemoState extends State<SignInHttpDemo> {
113113
builder: (context) => AlertDialog(
114114
title: Text(message),
115115
actions: [
116-
FlatButton(
116+
TextButton(
117117
child: Text('OK'),
118118
onPressed: () => Navigator.of(context).pop(),
119119
),

form_app/lib/src/validation.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ class _FormValidationDemoState extends State<FormValidationDemo> {
2424
actions: [
2525
Padding(
2626
padding: EdgeInsets.all(8),
27-
child: FlatButton(
28-
textColor: Colors.white,
27+
child: TextButton(
28+
style: TextButton.styleFrom(primary: Colors.white),
2929
child: Text('Submit'),
3030
onPressed: () {
3131
// Validate the form by getting the FormState from the GlobalKey
@@ -41,7 +41,7 @@ class _FormValidationDemoState extends State<FormValidationDemo> {
4141
title: Text('Your story'),
4242
content: Text('The $adjective developer saw a $noun'),
4343
actions: [
44-
FlatButton(
44+
TextButton(
4545
child: Text('Done'),
4646
onPressed: () {
4747
Navigator.of(context).pop();

isolate_example/lib/data_transfer_page.dart

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -54,25 +54,28 @@ class DataTransferPage extends StatelessWidget {
5454
),
5555
Column(
5656
children: [
57-
RaisedButton(
57+
ElevatedButton(
5858
child: const Text('Transfer Data to 2nd Isolate'),
59-
color: (controller.runningTest == 1)
60-
? Colors.blueAccent
61-
: Colors.grey[300],
59+
style: ElevatedButton.styleFrom(
60+
primary: (controller.runningTest == 1)
61+
? Colors.blueAccent
62+
: Colors.grey[300]),
6263
onPressed: () => controller.generateRandomNumbers(false),
6364
),
64-
RaisedButton(
65+
ElevatedButton(
6566
child: const Text('Transfer Data with TransferableTypedData'),
66-
color: (controller.runningTest == 2)
67-
? Colors.blueAccent
68-
: Colors.grey[300],
67+
style: ElevatedButton.styleFrom(
68+
primary: (controller.runningTest == 2)
69+
? Colors.blueAccent
70+
: Colors.grey[300]),
6971
onPressed: () => controller.generateRandomNumbers(true),
7072
),
71-
RaisedButton(
73+
ElevatedButton(
7274
child: const Text('Generate on 2nd Isolate'),
73-
color: (controller.runningTest == 3)
74-
? Colors.blueAccent
75-
: Colors.grey[300],
75+
style: ElevatedButton.styleFrom(
76+
primary: (controller.runningTest == 3)
77+
? Colors.blueAccent
78+
: Colors.grey[300]),
7679
onPressed: controller.generateOnSecondaryIsolate,
7780
),
7881
],

isolate_example/lib/infinite_process_page.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,14 @@ class InfiniteProcessPage extends StatelessWidget {
5353
ButtonBar(
5454
alignment: MainAxisAlignment.center,
5555
children: [
56-
RaisedButton(
56+
ElevatedButton(
5757
child: const Text('Start'),
58-
elevation: 8.0,
58+
style: ElevatedButton.styleFrom(elevation: 8.0),
5959
onPressed: () => controller.start(),
6060
),
61-
RaisedButton(
61+
ElevatedButton(
6262
child: const Text('Terminate'),
63-
elevation: 8.0,
63+
style: ElevatedButton.styleFrom(elevation: 8.0),
6464
onPressed: () => controller.terminate(),
6565
),
6666
],

isolate_example/lib/performance_page.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ class _PerformancePageState extends State<PerformancePage> {
5252
FutureBuilder(
5353
future: computeFuture,
5454
builder: (context, snapshot) {
55-
return RaisedButton(
55+
return ElevatedButton(
5656
child: const Text('Compute on Main'),
57-
elevation: 8.0,
57+
style: ElevatedButton.styleFrom(elevation: 8.0),
5858
onPressed:
5959
snapshot.connectionState == ConnectionState.done
6060
? () => handleComputeOnMain(context)
@@ -65,9 +65,9 @@ class _PerformancePageState extends State<PerformancePage> {
6565
FutureBuilder(
6666
future: computeFuture,
6767
builder: (context, snapshot) {
68-
return RaisedButton(
68+
return ElevatedButton(
6969
child: const Text('Compute on Secondary'),
70-
elevation: 8.0,
70+
style: ElevatedButton.styleFrom(elevation: 8.0),
7171
onPressed:
7272
snapshot.connectionState == ConnectionState.done
7373
? () => handleComputeOnSecondary(context)

navigation_and_routing/lib/nav_1/anonymous_routes.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class HomeScreen extends StatelessWidget {
2727
return Scaffold(
2828
appBar: AppBar(),
2929
body: Center(
30-
child: FlatButton(
30+
child: TextButton(
3131
child: Text('View Details'),
3232
onPressed: () {
3333
Navigator.push(
@@ -49,7 +49,7 @@ class DetailScreen extends StatelessWidget {
4949
return Scaffold(
5050
appBar: AppBar(),
5151
body: Center(
52-
child: FlatButton(
52+
child: TextButton(
5353
child: Text('Pop!'),
5454
onPressed: () {
5555
Navigator.pop(context);

0 commit comments

Comments
 (0)