Skip to content

Migrate to the New Material Buttons #668

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions add_to_app/flutter_module/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -138,15 +138,15 @@ class Contents extends StatelessWidget {
SizedBox(height: 16),
Consumer<CounterModel>(
builder: (context, model, child) {
return RaisedButton(
return ElevatedButton(
onPressed: () => model.increment(),
child: Text('Tap me!'),
);
},
),
if (showExit) ...[
SizedBox(height: 16),
RaisedButton(
ElevatedButton(
onPressed: () => SystemNavigator.pop(animated: true),
child: Text('Exit this screen'),
),
Expand Down
6 changes: 3 additions & 3 deletions add_to_app/flutter_module_using_plugin/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,13 @@ class Contents extends StatelessWidget {
SizedBox(height: 16),
Consumer<CounterModel>(
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.
Expand All @@ -159,7 +159,7 @@ class Contents extends StatelessWidget {
),
if (showExit) ...[
SizedBox(height: 16),
RaisedButton(
ElevatedButton(
onPressed: () => SystemNavigator.pop(),
child: Text('Exit this screen'),
),
Expand Down
2 changes: 1 addition & 1 deletion animations/lib/src/basics/01_animated_container.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class _AnimatedContainerDemoState extends State<AnimatedContainerDemo> {
),
),
),
RaisedButton(
ElevatedButton(
child: Text(
'change',
),
Expand Down
2 changes: 1 addition & 1 deletion animations/lib/src/basics/02_page_route_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<void>(_createRoute());
Expand Down
2 changes: 1 addition & 1 deletion animations/lib/src/basics/03_animation_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class _AnimationControllerDemoState extends State<AnimationControllerDemo>
textScaleFactor: 1 + controller.value,
),
),
RaisedButton(
ElevatedButton(
child: Text('animate'),
onPressed: () {
if (controller.status == AnimationStatus.completed) {
Expand Down
2 changes: 1 addition & 1 deletion animations/lib/src/basics/04_tweens.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class _TweenDemoState extends State<TweenDemo>
child: Text('\$${animation.value.toStringAsFixed(2)}',
style: TextStyle(fontSize: 24)),
),
RaisedButton(
ElevatedButton(
child: Text(
controller.status == AnimationStatus.completed
? 'Buy a Mansion'
Expand Down
2 changes: 1 addition & 1 deletion animations/lib/src/basics/08_fade_transition.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class _FadeTransitionDemoState extends State<FadeTransitionDemo>
size: 300,
),
),
RaisedButton(
ElevatedButton(
child: Text('animate'),
onPressed: () => setState(() {
_controller.animateTo(1.0).then<TickerFuture>(
Expand Down
2 changes: 1 addition & 1 deletion animations/lib/src/misc/card_swipe.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class _CardSwipeDemoState extends State<CardSwipeDemo> {
),
),
),
RaisedButton(
ElevatedButton(
child: const Text('Refill'),
onPressed: () {
setState(() {
Expand Down
2 changes: 1 addition & 1 deletion animations/lib/src/misc/curved_animation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ class _CurvedAnimationDemoState extends State<CurvedAnimationDemo>
),
),
SizedBox(height: 25.0),
RaisedButton(
ElevatedButton(
onPressed: () {
controller.forward();
},
Expand Down
2 changes: 1 addition & 1 deletion animations/test/misc/card_swipe_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ class _PhotoSearchDialogState extends State<PhotoSearchDialog> {
},
),
actions: <Widget>[
FlatButton(
TextButton(
onPressed: () {
Navigator.of(context).pop();
},
child: Text('Cancel'.toUpperCase()),
),
FlatButton(
TextButton(
onPressed: _searchEnabled
? () {
widget.callback(_controller.text);
Expand Down
2 changes: 1 addition & 1 deletion experimental/desktop_photo_search/test/widget_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<PhotoSearchModel>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class _HomePageState extends State<HomePage> {
style: Theme.of(context).textTheme.headline5,
),
SizedBox(height: 16),
RaisedButton(
ElevatedButton(
child: Text('Get Battery Level'),
onPressed: () async {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions experimental/web_dashboard/lib/src/pages/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ class _HomePageState extends State<HomePage> {
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'),
),
Expand Down Expand Up @@ -90,13 +90,13 @@ class _HomePageState extends State<HomePage> {
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);
Expand Down
2 changes: 1 addition & 1 deletion experimental/web_dashboard/lib/src/pages/sign_in.dart
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class _SignInButtonState extends State<SignInButton> {
_showError();
}

return RaisedButton(
return ElevatedButton(
child: Text('Sign In with Google'),
onPressed: () => _signIn(),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class _EditCategoryFormState extends State<EditCategoryForm> {
children: [
Padding(
padding: const EdgeInsets.only(left: 8.0, right: 8.0),
child: RaisedButton(
child: ElevatedButton(
child: Text('Cancel'),
onPressed: () {
widget.onDone(false);
Expand All @@ -85,7 +85,7 @@ class _EditCategoryFormState extends State<EditCategoryForm> {
),
Padding(
padding: const EdgeInsets.only(left: 8.0, right: 8.0),
child: RaisedButton(
child: ElevatedButton(
child: Text('OK'),
onPressed: () {
if (_formKey.currentState.validate()) {
Expand Down
6 changes: 3 additions & 3 deletions experimental/web_dashboard/lib/src/widgets/edit_entry.dart
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class _EditEntryFormState extends State<EditEntryForm> {
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(
Expand All @@ -127,7 +127,7 @@ class _EditEntryFormState extends State<EditEntryForm> {
children: [
Padding(
padding: const EdgeInsets.only(left: 8.0, right: 8.0),
child: RaisedButton(
child: ElevatedButton(
child: Text('Cancel'),
onPressed: () {
widget.onDone(false);
Expand All @@ -136,7 +136,7 @@ class _EditEntryFormState extends State<EditEntryForm> {
),
Padding(
padding: const EdgeInsets.only(left: 8.0, right: 8.0),
child: RaisedButton(
child: ElevatedButton(
child: Text('OK'),
onPressed: () {
if (_formKey.currentState.validate()) {
Expand Down
2 changes: 1 addition & 1 deletion form_app/lib/src/form_widgets.dart
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ class _FormDatePickerState extends State<_FormDatePicker> {
),
],
),
FlatButton(
TextButton(
child: Text('Edit'),
onPressed: () async {
var newDate = await showDatePicker(
Expand Down
4 changes: 2 additions & 2 deletions form_app/lib/src/sign_in_http.dart
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class _SignInHttpDemoState extends State<SignInHttpDemo> {
formData.password = value;
},
),
FlatButton(
TextButton(
child: Text('Sign in'),
onPressed: () async {
// Use a JSON encoded string to send
Expand Down Expand Up @@ -113,7 +113,7 @@ class _SignInHttpDemoState extends State<SignInHttpDemo> {
builder: (context) => AlertDialog(
title: Text(message),
actions: [
FlatButton(
TextButton(
child: Text('OK'),
onPressed: () => Navigator.of(context).pop(),
),
Expand Down
6 changes: 3 additions & 3 deletions form_app/lib/src/validation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ class _FormValidationDemoState extends State<FormValidationDemo> {
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
Expand All @@ -41,7 +41,7 @@ class _FormValidationDemoState extends State<FormValidationDemo> {
title: Text('Your story'),
content: Text('The $adjective developer saw a $noun'),
actions: [
FlatButton(
TextButton(
child: Text('Done'),
onPressed: () {
Navigator.of(context).pop();
Expand Down
27 changes: 15 additions & 12 deletions isolate_example/lib/data_transfer_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
),
],
Expand Down
8 changes: 4 additions & 4 deletions isolate_example/lib/infinite_process_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
),
],
Expand Down
8 changes: 4 additions & 4 deletions isolate_example/lib/performance_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ class _PerformancePageState extends State<PerformancePage> {
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)
Expand All @@ -65,9 +65,9 @@ class _PerformancePageState extends State<PerformancePage> {
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)
Expand Down
4 changes: 2 additions & 2 deletions navigation_and_routing/lib/nav_1/anonymous_routes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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);
Expand Down
Loading