diff --git a/add_to_app/flutter_module/lib/main.dart b/add_to_app/flutter_module/lib/main.dart index 006de383c..d422c6762 100644 --- a/add_to_app/flutter_module/lib/main.dart +++ b/add_to_app/flutter_module/lib/main.dart @@ -138,7 +138,7 @@ class Contents extends StatelessWidget { SizedBox(height: 16), Consumer( builder: (context, model, child) { - return RaisedButton( + return ElevatedButton( onPressed: () => model.increment(), child: Text('Tap me!'), ); @@ -146,7 +146,7 @@ class Contents extends StatelessWidget { ), if (showExit) ...[ SizedBox(height: 16), - RaisedButton( + ElevatedButton( onPressed: () => SystemNavigator.pop(animated: true), child: Text('Exit this screen'), ), diff --git a/add_to_app/flutter_module_using_plugin/lib/main.dart b/add_to_app/flutter_module_using_plugin/lib/main.dart index 764a53f06..3ecd94ea0 100644 --- a/add_to_app/flutter_module_using_plugin/lib/main.dart +++ b/add_to_app/flutter_module_using_plugin/lib/main.dart @@ -140,13 +140,13 @@ class Contents extends StatelessWidget { SizedBox(height: 16), Consumer( builder: (context, model, child) { - return RaisedButton( + return ElevatedButton( onPressed: () => model.increment(), child: Text('Tap me!'), ); }, ), - RaisedButton( + ElevatedButton( onPressed: () async { // Use the url_launcher plugin to open the Flutter docs in // a browser. @@ -159,7 +159,7 @@ class Contents extends StatelessWidget { ), if (showExit) ...[ SizedBox(height: 16), - RaisedButton( + ElevatedButton( onPressed: () => SystemNavigator.pop(), child: Text('Exit this screen'), ), diff --git a/animations/lib/src/basics/01_animated_container.dart b/animations/lib/src/basics/01_animated_container.dart index c726f05c2..9b84fd4e6 100644 --- a/animations/lib/src/basics/01_animated_container.dart +++ b/animations/lib/src/basics/01_animated_container.dart @@ -69,7 +69,7 @@ class _AnimatedContainerDemoState extends State { ), ), ), - RaisedButton( + ElevatedButton( child: Text( 'change', ), diff --git a/animations/lib/src/basics/02_page_route_builder.dart b/animations/lib/src/basics/02_page_route_builder.dart index b237fc0f7..3b06d2c18 100644 --- a/animations/lib/src/basics/02_page_route_builder.dart +++ b/animations/lib/src/basics/02_page_route_builder.dart @@ -14,7 +14,7 @@ class PageRouteBuilderDemo extends StatelessWidget { title: Text('Page 1'), ), body: Center( - child: RaisedButton( + child: ElevatedButton( child: Text('Go!'), onPressed: () { Navigator.of(context).push(_createRoute()); diff --git a/animations/lib/src/basics/03_animation_controller.dart b/animations/lib/src/basics/03_animation_controller.dart index e6f5ae752..a9d46f35b 100644 --- a/animations/lib/src/basics/03_animation_controller.dart +++ b/animations/lib/src/basics/03_animation_controller.dart @@ -68,7 +68,7 @@ class _AnimationControllerDemoState extends State textScaleFactor: 1 + controller.value, ), ), - RaisedButton( + ElevatedButton( child: Text('animate'), onPressed: () { if (controller.status == AnimationStatus.completed) { diff --git a/animations/lib/src/basics/04_tweens.dart b/animations/lib/src/basics/04_tweens.dart index 492d7efd9..9ed9822aa 100644 --- a/animations/lib/src/basics/04_tweens.dart +++ b/animations/lib/src/basics/04_tweens.dart @@ -51,7 +51,7 @@ class _TweenDemoState extends State child: Text('\$${animation.value.toStringAsFixed(2)}', style: TextStyle(fontSize: 24)), ), - RaisedButton( + ElevatedButton( child: Text( controller.status == AnimationStatus.completed ? 'Buy a Mansion' diff --git a/animations/lib/src/basics/08_fade_transition.dart b/animations/lib/src/basics/08_fade_transition.dart index 28776f661..4d04dad19 100644 --- a/animations/lib/src/basics/08_fade_transition.dart +++ b/animations/lib/src/basics/08_fade_transition.dart @@ -61,7 +61,7 @@ class _FadeTransitionDemoState extends State size: 300, ), ), - RaisedButton( + ElevatedButton( child: Text('animate'), onPressed: () => setState(() { _controller.animateTo(1.0).then( diff --git a/animations/lib/src/misc/card_swipe.dart b/animations/lib/src/misc/card_swipe.dart index 336eee528..d024816fb 100644 --- a/animations/lib/src/misc/card_swipe.dart +++ b/animations/lib/src/misc/card_swipe.dart @@ -59,7 +59,7 @@ class _CardSwipeDemoState extends State { ), ), ), - RaisedButton( + ElevatedButton( child: const Text('Refill'), onPressed: () { setState(() { diff --git a/animations/lib/src/misc/curved_animation.dart b/animations/lib/src/misc/curved_animation.dart index 13568a38f..06558ebde 100644 --- a/animations/lib/src/misc/curved_animation.dart +++ b/animations/lib/src/misc/curved_animation.dart @@ -146,7 +146,7 @@ class _CurvedAnimationDemoState extends State ), ), SizedBox(height: 25.0), - RaisedButton( + ElevatedButton( onPressed: () { controller.forward(); }, diff --git a/animations/test/misc/card_swipe_test.dart b/animations/test/misc/card_swipe_test.dart index 7a74b669d..95c039903 100644 --- a/animations/test/misc/card_swipe_test.dart +++ b/animations/test/misc/card_swipe_test.dart @@ -56,7 +56,7 @@ void main() { await tester.pumpAndSettle(); // Tap the Refill button. - await tester.tap(find.byType(RaisedButton)); + await tester.tap(find.byType(ElevatedButton)); await tester.pumpAndSettle(); // Check if the entire stack is refilled. diff --git a/experimental/desktop_photo_search/lib/src/widgets/photo_search_dialog.dart b/experimental/desktop_photo_search/lib/src/widgets/photo_search_dialog.dart index e0742ad0f..5d48d5e9e 100644 --- a/experimental/desktop_photo_search/lib/src/widgets/photo_search_dialog.dart +++ b/experimental/desktop_photo_search/lib/src/widgets/photo_search_dialog.dart @@ -50,13 +50,13 @@ class _PhotoSearchDialogState extends State { }, ), actions: [ - FlatButton( + TextButton( onPressed: () { Navigator.of(context).pop(); }, child: Text('Cancel'.toUpperCase()), ), - FlatButton( + TextButton( onPressed: _searchEnabled ? () { widget.callback(_controller.text); diff --git a/experimental/desktop_photo_search/test/widget_test.dart b/experimental/desktop_photo_search/test/widget_test.dart index d812f7a58..e72419bfe 100644 --- a/experimental/desktop_photo_search/test/widget_test.dart +++ b/experimental/desktop_photo_search/test/widget_test.dart @@ -90,7 +90,7 @@ class PhotoSearchModelTester extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( - home: FlatButton( + home: TextButton( key: fabKey, onPressed: () async { await Provider.of( diff --git a/experimental/federated_plugin/federated_plugin/example/lib/main.dart b/experimental/federated_plugin/federated_plugin/example/lib/main.dart index 2eda3a851..6f15a1f6f 100644 --- a/experimental/federated_plugin/federated_plugin/example/lib/main.dart +++ b/experimental/federated_plugin/federated_plugin/example/lib/main.dart @@ -47,7 +47,7 @@ class _HomePageState extends State { style: Theme.of(context).textTheme.headline5, ), SizedBox(height: 16), - RaisedButton( + ElevatedButton( child: Text('Get Battery Level'), onPressed: () async { try { diff --git a/experimental/federated_plugin/federated_plugin/example/test/widget_test.dart b/experimental/federated_plugin/federated_plugin/example/test/widget_test.dart index f40232040..8998d87ff 100644 --- a/experimental/federated_plugin/federated_plugin/example/test/widget_test.dart +++ b/experimental/federated_plugin/federated_plugin/example/test/widget_test.dart @@ -22,7 +22,7 @@ void main() { await tester.pumpWidget(MyApp()); // Tap button to retrieve current battery level from platform. - await tester.tap(find.byType(RaisedButton)); + await tester.tap(find.byType(ElevatedButton)); await tester.pumpAndSettle(); expect(find.text('Battery Level: $batteryLevel'), findsOneWidget); diff --git a/experimental/web_dashboard/lib/src/pages/home.dart b/experimental/web_dashboard/lib/src/pages/home.dart index 0c22935b0..e788e6c79 100644 --- a/experimental/web_dashboard/lib/src/pages/home.dart +++ b/experimental/web_dashboard/lib/src/pages/home.dart @@ -30,8 +30,8 @@ class _HomePageState extends State { actions: [ Padding( padding: const EdgeInsets.all(8.0), - child: FlatButton( - textColor: Colors.white, + child: TextButton( + style: TextButton.styleFrom(primary: Colors.white), onPressed: () => _handleSignOut(), child: Text('Sign Out'), ), @@ -90,13 +90,13 @@ class _HomePageState extends State { builder: (context) => AlertDialog( title: Text('Are you sure you want to sign out?'), actions: [ - FlatButton( + TextButton( child: Text('No'), onPressed: () { Navigator.of(context).pop(false); }, ), - FlatButton( + TextButton( child: Text('Yes'), onPressed: () { Navigator.of(context).pop(true); diff --git a/experimental/web_dashboard/lib/src/pages/sign_in.dart b/experimental/web_dashboard/lib/src/pages/sign_in.dart index f5f8f5ae6..947db02d1 100644 --- a/experimental/web_dashboard/lib/src/pages/sign_in.dart +++ b/experimental/web_dashboard/lib/src/pages/sign_in.dart @@ -86,7 +86,7 @@ class _SignInButtonState extends State { _showError(); } - return RaisedButton( + return ElevatedButton( child: Text('Sign In with Google'), onPressed: () => _signIn(), ); diff --git a/experimental/web_dashboard/lib/src/widgets/category_forms.dart b/experimental/web_dashboard/lib/src/widgets/category_forms.dart index 98f0f23d6..8bc85a421 100644 --- a/experimental/web_dashboard/lib/src/widgets/category_forms.dart +++ b/experimental/web_dashboard/lib/src/widgets/category_forms.dart @@ -76,7 +76,7 @@ class _EditCategoryFormState extends State { children: [ Padding( padding: const EdgeInsets.only(left: 8.0, right: 8.0), - child: RaisedButton( + child: ElevatedButton( child: Text('Cancel'), onPressed: () { widget.onDone(false); @@ -85,7 +85,7 @@ class _EditCategoryFormState extends State { ), Padding( padding: const EdgeInsets.only(left: 8.0, right: 8.0), - child: RaisedButton( + child: ElevatedButton( child: Text('OK'), onPressed: () { if (_formKey.currentState.validate()) { diff --git a/experimental/web_dashboard/lib/src/widgets/edit_entry.dart b/experimental/web_dashboard/lib/src/widgets/edit_entry.dart index aba2c7b29..ddb25bd1a 100644 --- a/experimental/web_dashboard/lib/src/widgets/edit_entry.dart +++ b/experimental/web_dashboard/lib/src/widgets/edit_entry.dart @@ -103,7 +103,7 @@ class _EditEntryFormState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text(intl.DateFormat('MM/dd/yyyy').format(widget.entry.time)), - RaisedButton( + ElevatedButton( child: Text('Edit'), onPressed: () async { var result = await showDatePicker( @@ -127,7 +127,7 @@ class _EditEntryFormState extends State { children: [ Padding( padding: const EdgeInsets.only(left: 8.0, right: 8.0), - child: RaisedButton( + child: ElevatedButton( child: Text('Cancel'), onPressed: () { widget.onDone(false); @@ -136,7 +136,7 @@ class _EditEntryFormState extends State { ), Padding( padding: const EdgeInsets.only(left: 8.0, right: 8.0), - child: RaisedButton( + child: ElevatedButton( child: Text('OK'), onPressed: () { if (_formKey.currentState.validate()) { diff --git a/form_app/lib/src/form_widgets.dart b/form_app/lib/src/form_widgets.dart index 4b0530fca..29f7fc563 100644 --- a/form_app/lib/src/form_widgets.dart +++ b/form_app/lib/src/form_widgets.dart @@ -190,7 +190,7 @@ class _FormDatePickerState extends State<_FormDatePicker> { ), ], ), - FlatButton( + TextButton( child: Text('Edit'), onPressed: () async { var newDate = await showDatePicker( diff --git a/form_app/lib/src/sign_in_http.dart b/form_app/lib/src/sign_in_http.dart index 1cd66bcee..fb1574646 100644 --- a/form_app/lib/src/sign_in_http.dart +++ b/form_app/lib/src/sign_in_http.dart @@ -73,7 +73,7 @@ class _SignInHttpDemoState extends State { formData.password = value; }, ), - FlatButton( + TextButton( child: Text('Sign in'), onPressed: () async { // Use a JSON encoded string to send @@ -113,7 +113,7 @@ class _SignInHttpDemoState extends State { builder: (context) => AlertDialog( title: Text(message), actions: [ - FlatButton( + TextButton( child: Text('OK'), onPressed: () => Navigator.of(context).pop(), ), diff --git a/form_app/lib/src/validation.dart b/form_app/lib/src/validation.dart index 0c471ca1c..122b74185 100644 --- a/form_app/lib/src/validation.dart +++ b/form_app/lib/src/validation.dart @@ -24,8 +24,8 @@ class _FormValidationDemoState extends State { actions: [ Padding( padding: EdgeInsets.all(8), - child: FlatButton( - textColor: Colors.white, + child: TextButton( + style: TextButton.styleFrom(primary: Colors.white), child: Text('Submit'), onPressed: () { // Validate the form by getting the FormState from the GlobalKey @@ -41,7 +41,7 @@ class _FormValidationDemoState extends State { title: Text('Your story'), content: Text('The $adjective developer saw a $noun'), actions: [ - FlatButton( + TextButton( child: Text('Done'), onPressed: () { Navigator.of(context).pop(); diff --git a/isolate_example/lib/data_transfer_page.dart b/isolate_example/lib/data_transfer_page.dart index 0c91dd675..54b08b5e7 100644 --- a/isolate_example/lib/data_transfer_page.dart +++ b/isolate_example/lib/data_transfer_page.dart @@ -54,25 +54,28 @@ class DataTransferPage extends StatelessWidget { ), Column( children: [ - RaisedButton( + ElevatedButton( child: const Text('Transfer Data to 2nd Isolate'), - color: (controller.runningTest == 1) - ? Colors.blueAccent - : Colors.grey[300], + style: ElevatedButton.styleFrom( + primary: (controller.runningTest == 1) + ? Colors.blueAccent + : Colors.grey[300]), onPressed: () => controller.generateRandomNumbers(false), ), - RaisedButton( + ElevatedButton( child: const Text('Transfer Data with TransferableTypedData'), - color: (controller.runningTest == 2) - ? Colors.blueAccent - : Colors.grey[300], + style: ElevatedButton.styleFrom( + primary: (controller.runningTest == 2) + ? Colors.blueAccent + : Colors.grey[300]), onPressed: () => controller.generateRandomNumbers(true), ), - RaisedButton( + ElevatedButton( child: const Text('Generate on 2nd Isolate'), - color: (controller.runningTest == 3) - ? Colors.blueAccent - : Colors.grey[300], + style: ElevatedButton.styleFrom( + primary: (controller.runningTest == 3) + ? Colors.blueAccent + : Colors.grey[300]), onPressed: controller.generateOnSecondaryIsolate, ), ], diff --git a/isolate_example/lib/infinite_process_page.dart b/isolate_example/lib/infinite_process_page.dart index b0584dc1e..c0e146fc6 100644 --- a/isolate_example/lib/infinite_process_page.dart +++ b/isolate_example/lib/infinite_process_page.dart @@ -53,14 +53,14 @@ class InfiniteProcessPage extends StatelessWidget { ButtonBar( alignment: MainAxisAlignment.center, children: [ - RaisedButton( + ElevatedButton( child: const Text('Start'), - elevation: 8.0, + style: ElevatedButton.styleFrom(elevation: 8.0), onPressed: () => controller.start(), ), - RaisedButton( + ElevatedButton( child: const Text('Terminate'), - elevation: 8.0, + style: ElevatedButton.styleFrom(elevation: 8.0), onPressed: () => controller.terminate(), ), ], diff --git a/isolate_example/lib/performance_page.dart b/isolate_example/lib/performance_page.dart index 459770db8..cfa5f852d 100644 --- a/isolate_example/lib/performance_page.dart +++ b/isolate_example/lib/performance_page.dart @@ -52,9 +52,9 @@ class _PerformancePageState extends State { FutureBuilder( future: computeFuture, builder: (context, snapshot) { - return RaisedButton( + return ElevatedButton( child: const Text('Compute on Main'), - elevation: 8.0, + style: ElevatedButton.styleFrom(elevation: 8.0), onPressed: snapshot.connectionState == ConnectionState.done ? () => handleComputeOnMain(context) @@ -65,9 +65,9 @@ class _PerformancePageState extends State { FutureBuilder( future: computeFuture, builder: (context, snapshot) { - return RaisedButton( + return ElevatedButton( child: const Text('Compute on Secondary'), - elevation: 8.0, + style: ElevatedButton.styleFrom(elevation: 8.0), onPressed: snapshot.connectionState == ConnectionState.done ? () => handleComputeOnSecondary(context) diff --git a/navigation_and_routing/lib/nav_1/anonymous_routes.dart b/navigation_and_routing/lib/nav_1/anonymous_routes.dart index 6a3b5b831..139d7b06a 100644 --- a/navigation_and_routing/lib/nav_1/anonymous_routes.dart +++ b/navigation_and_routing/lib/nav_1/anonymous_routes.dart @@ -27,7 +27,7 @@ class HomeScreen extends StatelessWidget { return Scaffold( appBar: AppBar(), body: Center( - child: FlatButton( + child: TextButton( child: Text('View Details'), onPressed: () { Navigator.push( @@ -49,7 +49,7 @@ class DetailScreen extends StatelessWidget { return Scaffold( appBar: AppBar(), body: Center( - child: FlatButton( + child: TextButton( child: Text('Pop!'), onPressed: () { Navigator.pop(context); diff --git a/navigation_and_routing/lib/nav_1/named_routes.dart b/navigation_and_routing/lib/nav_1/named_routes.dart index adccc64c4..3271b3a6a 100644 --- a/navigation_and_routing/lib/nav_1/named_routes.dart +++ b/navigation_and_routing/lib/nav_1/named_routes.dart @@ -30,7 +30,7 @@ class HomeScreen extends StatelessWidget { return Scaffold( appBar: AppBar(), body: Center( - child: FlatButton( + child: TextButton( child: Text('View Details'), onPressed: () { Navigator.pushNamed( @@ -50,7 +50,7 @@ class DetailScreen extends StatelessWidget { return Scaffold( appBar: AppBar(), body: Center( - child: FlatButton( + child: TextButton( child: Text('Pop!'), onPressed: () { Navigator.pop(context); diff --git a/navigation_and_routing/lib/nav_1/on_generate_route.dart b/navigation_and_routing/lib/nav_1/on_generate_route.dart index f488775c2..e9fa918b9 100644 --- a/navigation_and_routing/lib/nav_1/on_generate_route.dart +++ b/navigation_and_routing/lib/nav_1/on_generate_route.dart @@ -42,7 +42,7 @@ class HomeScreen extends StatelessWidget { return Scaffold( appBar: AppBar(), body: Center( - child: FlatButton( + child: TextButton( child: Text('View Details'), onPressed: () { Navigator.pushNamed( @@ -72,7 +72,7 @@ class DetailScreen extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.center, children: [ Text('Viewing details for item $id'), - FlatButton( + TextButton( child: Text('Pop!'), onPressed: () { Navigator.pop(context); diff --git a/navigation_and_routing/lib/nav_2_advanced/nested_router.dart b/navigation_and_routing/lib/nav_2_advanced/nested_router.dart index f4419fa10..7bc323496 100644 --- a/navigation_and_routing/lib/nav_2_advanced/nested_router.dart +++ b/navigation_and_routing/lib/nav_2_advanced/nested_router.dart @@ -27,7 +27,7 @@ class NestedRouterDemo extends StatefulWidget { class _NestedRouterDemoState extends State { BookRouterDelegate _routerDelegate = BookRouterDelegate(); BookRouteInformationParser _routeInformationParser = - BookRouteInformationParser(); + BookRouteInformationParser(); @override Widget build(BuildContext context) { @@ -377,7 +377,7 @@ class BookDetailsScreen extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - FlatButton( + TextButton( onPressed: () { Navigator.of(context).pop(); }, diff --git a/place_tracker/lib/place_list.dart b/place_tracker/lib/place_list.dart index 88d5a7656..8d8feaf99 100644 --- a/place_tracker/lib/place_list.dart +++ b/place_tracker/lib/place_list.dart @@ -102,7 +102,7 @@ class _CategoryButton extends StatelessWidget { ), child: ButtonTheme( height: 50.0, - child: FlatButton( + child: TextButton( child: Text( _buttonText, style: TextStyle( diff --git a/place_tracker/lib/place_map.dart b/place_tracker/lib/place_map.dart index b2d81453e..c96072fee 100644 --- a/place_tracker/lib/place_map.dart +++ b/place_tracker/lib/place_map.dart @@ -479,16 +479,16 @@ class _AddPlaceButtonBar extends StatelessWidget { child: ButtonBar( alignment: MainAxisAlignment.center, children: [ - RaisedButton( - color: Colors.blue, + ElevatedButton( + style: ElevatedButton.styleFrom(primary: Colors.blue), child: const Text( 'Save', style: TextStyle(color: Colors.white, fontSize: 16.0), ), onPressed: onSavePressed, ), - RaisedButton( - color: Colors.red, + ElevatedButton( + style: ElevatedButton.styleFrom(primary: Colors.red), child: const Text( 'Cancel', style: TextStyle(color: Colors.white, fontSize: 16.0), @@ -527,30 +527,33 @@ class _CategoryButtonBar extends StatelessWidget { child: ButtonBar( alignment: MainAxisAlignment.center, children: [ - RaisedButton( - color: selectedPlaceCategory == PlaceCategory.favorite - ? Colors.green[700] - : Colors.lightGreen, + ElevatedButton( + style: ElevatedButton.styleFrom( + primary: selectedPlaceCategory == PlaceCategory.favorite + ? Colors.green[700] + : Colors.lightGreen), child: const Text( 'Favorites', style: TextStyle(color: Colors.white, fontSize: 14.0), ), onPressed: () => onChanged(PlaceCategory.favorite), ), - RaisedButton( - color: selectedPlaceCategory == PlaceCategory.visited - ? Colors.green[700] - : Colors.lightGreen, + ElevatedButton( + style: ElevatedButton.styleFrom( + primary: selectedPlaceCategory == PlaceCategory.visited + ? Colors.green[700] + : Colors.lightGreen), child: const Text( 'Visited', style: TextStyle(color: Colors.white, fontSize: 14.0), ), onPressed: () => onChanged(PlaceCategory.visited), ), - RaisedButton( - color: selectedPlaceCategory == PlaceCategory.wantToGo - ? Colors.green[700] - : Colors.lightGreen, + ElevatedButton( + style: ElevatedButton.styleFrom( + primary: selectedPlaceCategory == PlaceCategory.wantToGo + ? Colors.green[700] + : Colors.lightGreen), child: const Text( 'Want To Go', style: TextStyle(color: Colors.white, fontSize: 14.0), diff --git a/platform_channels/lib/src/method_channel_demo.dart b/platform_channels/lib/src/method_channel_demo.dart index 2c590a997..91e1f4a07 100644 --- a/platform_channels/lib/src/method_channel_demo.dart +++ b/platform_channels/lib/src/method_channel_demo.dart @@ -6,7 +6,7 @@ import 'package:flutter/material.dart'; import 'package:platform_channels/src/counter_method_channel.dart'; /// The widget demonstrates how to use [MethodChannel] to invoke platform methods. -/// It has two [RaisedButton]s to increment and decrement the value of +/// It has two [ElevatedButton]s to increment and decrement the value of /// [count], and a [Text] widget to display its value. class MethodChannelDemo extends StatefulWidget { @override @@ -37,9 +37,9 @@ class _MethodChannelDemoState extends State { Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ - // Whenever users press the RaisedButton, it invokes + // Whenever users press the ElevatedButton, it invokes // Counter.increment method to increment the value of count. - RaisedButton.icon( + ElevatedButton.icon( onPressed: () async { try { final value = @@ -56,9 +56,9 @@ class _MethodChannelDemoState extends State { label: Text('Increment'), ), - // Whenever users press the RaisedButton, it invokes + // Whenever users press the ElevatedButton, it invokes // Counter.decrement method to decrement the value of count. - RaisedButton.icon( + ElevatedButton.icon( onPressed: () async { try { final value = diff --git a/platform_channels/lib/src/platform_image_demo.dart b/platform_channels/lib/src/platform_image_demo.dart index c80d6672d..05af6967a 100644 --- a/platform_channels/lib/src/platform_image_demo.dart +++ b/platform_channels/lib/src/platform_image_demo.dart @@ -58,7 +58,7 @@ class _PlatformImageDemoState extends State { SizedBox( height: 16, ), - RaisedButton( + ElevatedButton( onPressed: imageData != null ? null : () { diff --git a/platform_channels/test/src/method_channel_demo_test.dart b/platform_channels/test/src/method_channel_demo_test.dart index b3c53a574..61c0b4585 100644 --- a/platform_channels/test/src/method_channel_demo_test.dart +++ b/platform_channels/test/src/method_channel_demo_test.dart @@ -33,13 +33,13 @@ void main() { // Initially the value of count should be 0. expect(find.text('Value of count is 0'), findsOneWidget); - // Tap the RaisedButton with Icons.add to increment the value of count. + // Tap the ElevatedButton with Icons.add to increment the value of count. await tester.tap(find.byIcon(Icons.add)); await tester.pump(); expect(find.text('Value of count is 1'), findsOneWidget); - // Tap the RaisedButton with Icons.remove to decrement the value of count. + // Tap the ElevatedButton with Icons.remove to decrement the value of count. await tester.tap(find.byIcon(Icons.remove)); await tester.pump(); diff --git a/platform_channels/test/src/platform_image_demo_test.dart b/platform_channels/test/src/platform_image_demo_test.dart index d2d8dbd46..eb9459521 100644 --- a/platform_channels/test/src/platform_image_demo_test.dart +++ b/platform_channels/test/src/platform_image_demo_test.dart @@ -27,8 +27,8 @@ void main() { expect(find.byType(Placeholder), findsOneWidget); expect(find.byType(Image), findsNothing); - // Tap on RaisedButton to get Image. - await tester.tap(find.byType(RaisedButton)); + // Tap on ElevatedButton to get Image. + await tester.tap(find.byType(ElevatedButton)); await tester.pumpAndSettle(); expect(find.byType(Placeholder), findsNothing); diff --git a/platform_design/lib/profile_tab.dart b/platform_design/lib/profile_tab.dart index 53d8f0850..1ebdec851 100644 --- a/platform_design/lib/profile_tab.dart +++ b/platform_design/lib/profile_tab.dart @@ -177,7 +177,7 @@ class LogOutButton extends StatelessWidget { // =========================================================================== Widget _buildAndroid(BuildContext context) { - return RaisedButton( + return ElevatedButton( child: Text('LOG OUT', style: TextStyle(color: Colors.red)), onPressed: () { // You should do something with the result of the dialog prompt in a @@ -189,11 +189,11 @@ class LogOutButton extends StatelessWidget { title: Text('Log out?'), content: _logoutMessage, actions: [ - FlatButton( + TextButton( child: const Text('Got it'), onPressed: () => Navigator.pop(context), ), - FlatButton( + TextButton( child: const Text('Cancel'), onPressed: () => Navigator.pop(context), ), diff --git a/platform_design/lib/widgets.dart b/platform_design/lib/widgets.dart index e22f9f1f2..7eea2dcb1 100644 --- a/platform_design/lib/widgets.dart +++ b/platform_design/lib/widgets.dart @@ -309,11 +309,11 @@ void showChoices(BuildContext context, List choices) { }, ), actions: [ - FlatButton( + TextButton( child: Text('OK'), onPressed: () => Navigator.of(context).pop(), ), - FlatButton( + TextButton( child: Text('CANCEL'), onPressed: () => Navigator.of(context).pop(), ), diff --git a/platform_view_swift/lib/main.dart b/platform_view_swift/lib/main.dart index ba37ee8fc..1f78da2cc 100644 --- a/platform_view_swift/lib/main.dart +++ b/platform_view_swift/lib/main.dart @@ -64,7 +64,7 @@ class _HomePageState extends State { style: Theme.of(context).textTheme.subtitle2, ), SizedBox(height: 18), - RaisedButton( + ElevatedButton( child: const Text('Continue in iOS view'), onPressed: _launchPlatformCount, ), diff --git a/provider_shopper/lib/screens/cart.dart b/provider_shopper/lib/screens/cart.dart index ec0984a50..989f2f0d4 100644 --- a/provider_shopper/lib/screens/cart.dart +++ b/provider_shopper/lib/screens/cart.dart @@ -83,12 +83,12 @@ class _CartTotal extends StatelessWidget { builder: (context, cart, child) => Text('\$${cart.totalPrice}', style: hugeStyle)), SizedBox(width: 24), - FlatButton( + TextButton( onPressed: () { Scaffold.of(context).showSnackBar( SnackBar(content: Text('Buying not supported yet.'))); }, - color: Colors.white, + style: TextButton.styleFrom(primary: Colors.white), child: Text('BUY'), ), ], diff --git a/provider_shopper/lib/screens/catalog.dart b/provider_shopper/lib/screens/catalog.dart index ac021cdfb..5d32a7473 100644 --- a/provider_shopper/lib/screens/catalog.dart +++ b/provider_shopper/lib/screens/catalog.dart @@ -43,7 +43,7 @@ class _AddButton extends StatelessWidget { (cart) => cart.items.contains(item), ); - return FlatButton( + return TextButton( onPressed: isInCart ? null : () { @@ -54,7 +54,14 @@ class _AddButton extends StatelessWidget { var cart = context.read(); cart.add(item); }, - splashColor: Theme.of(context).primaryColor, + style: ButtonStyle( + overlayColor: MaterialStateProperty.resolveWith((states) { + if (states.contains(MaterialState.pressed)) { + return Theme.of(context).primaryColor; + } + return null; // Defer to the widget's default. + }), + ), child: isInCart ? Icon(Icons.check, semanticLabel: 'ADDED') : Text('ADD'), ); } diff --git a/provider_shopper/lib/screens/login.dart b/provider_shopper/lib/screens/login.dart index a4519c470..220ce7e39 100644 --- a/provider_shopper/lib/screens/login.dart +++ b/provider_shopper/lib/screens/login.dart @@ -32,12 +32,14 @@ class MyLogin extends StatelessWidget { SizedBox( height: 24, ), - RaisedButton( - color: Colors.yellow, + ElevatedButton( child: Text('ENTER'), onPressed: () { Navigator.pushReplacementNamed(context, '/catalog'); }, + style: ElevatedButton.styleFrom( + primary: Colors.yellow, + ), ) ], ), diff --git a/provider_shopper/test/catalog_widget_test.dart b/provider_shopper/test/catalog_widget_test.dart index 00df72869..ecd2db677 100644 --- a/provider_shopper/test/catalog_widget_test.dart +++ b/provider_shopper/test/catalog_widget_test.dart @@ -48,7 +48,7 @@ void main() { expect(find.text('ADD'), findsWidgets); // Performing the click on the ADD button of the first item in the list. - await tester.tap(find.widgetWithText(FlatButton, 'ADD').first); + await tester.tap(find.widgetWithText(TextButton, 'ADD').first); await tester.pumpAndSettle(); // Verifying if the tapped ADD button has changed to the check icon. diff --git a/testing_app/lib/screens/home.dart b/testing_app/lib/screens/home.dart index a39aea341..e1fee8720 100644 --- a/testing_app/lib/screens/home.dart +++ b/testing_app/lib/screens/home.dart @@ -16,8 +16,8 @@ class HomePage extends StatelessWidget { appBar: AppBar( title: Text('Testing Sample'), actions: [ - FlatButton.icon( - textColor: Colors.white, + TextButton.icon( + style: TextButton.styleFrom(primary: Colors.white), onPressed: () { Navigator.pushNamed(context, FavoritesPage.routeName); }, diff --git a/web/timeflow/lib/main.dart b/web/timeflow/lib/main.dart index 1c3443a37..eb257f274 100644 --- a/web/timeflow/lib/main.dart +++ b/web/timeflow/lib/main.dart @@ -119,7 +119,7 @@ class TM extends State { child: Container( child: CustomPaint( painter: P(), - child: FlatButton( + child: TextButton( onPressed: press, child: Row( mainAxisAlignment: MainAxisAlignment.end, diff --git a/web/timeflow/lib/numberpicker.dart b/web/timeflow/lib/numberpicker.dart index 58a9f56cd..121c65750 100644 --- a/web/timeflow/lib/numberpicker.dart +++ b/web/timeflow/lib/numberpicker.dart @@ -512,11 +512,11 @@ class _NumberPickerDialogControllerState extends State { titlePadding: widget.titlePadding, content: _buildNumberPicker(), actions: [ - new FlatButton( + new TextButton( onPressed: () => Navigator.of(context).pop(), child: widget.cancelWidget, ), - new FlatButton( + new TextButton( onPressed: () => Navigator.of(context).pop(widget.decimalPlaces > 0 ? selectedDoubleValue : selectedIntValue),