mirror of
https://github.com/flutter/samples.git
synced 2025-11-08 13:58:47 +00:00
Migrate to the New Material Buttons (#668)
This commit is contained in:
@@ -138,7 +138,7 @@ class Contents extends StatelessWidget {
|
||||
SizedBox(height: 16),
|
||||
Consumer<CounterModel>(
|
||||
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'),
|
||||
),
|
||||
|
||||
@@ -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.
|
||||
@@ -159,7 +159,7 @@ class Contents extends StatelessWidget {
|
||||
),
|
||||
if (showExit) ...[
|
||||
SizedBox(height: 16),
|
||||
RaisedButton(
|
||||
ElevatedButton(
|
||||
onPressed: () => SystemNavigator.pop(),
|
||||
child: Text('Exit this screen'),
|
||||
),
|
||||
|
||||
@@ -69,7 +69,7 @@ class _AnimatedContainerDemoState extends State<AnimatedContainerDemo> {
|
||||
),
|
||||
),
|
||||
),
|
||||
RaisedButton(
|
||||
ElevatedButton(
|
||||
child: Text(
|
||||
'change',
|
||||
),
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -68,7 +68,7 @@ class _AnimationControllerDemoState extends State<AnimationControllerDemo>
|
||||
textScaleFactor: 1 + controller.value,
|
||||
),
|
||||
),
|
||||
RaisedButton(
|
||||
ElevatedButton(
|
||||
child: Text('animate'),
|
||||
onPressed: () {
|
||||
if (controller.status == AnimationStatus.completed) {
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -61,7 +61,7 @@ class _FadeTransitionDemoState extends State<FadeTransitionDemo>
|
||||
size: 300,
|
||||
),
|
||||
),
|
||||
RaisedButton(
|
||||
ElevatedButton(
|
||||
child: Text('animate'),
|
||||
onPressed: () => setState(() {
|
||||
_controller.animateTo(1.0).then<TickerFuture>(
|
||||
|
||||
@@ -59,7 +59,7 @@ class _CardSwipeDemoState extends State<CardSwipeDemo> {
|
||||
),
|
||||
),
|
||||
),
|
||||
RaisedButton(
|
||||
ElevatedButton(
|
||||
child: const Text('Refill'),
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
|
||||
@@ -146,7 +146,7 @@ class _CurvedAnimationDemoState extends State<CurvedAnimationDemo>
|
||||
),
|
||||
),
|
||||
SizedBox(height: 25.0),
|
||||
RaisedButton(
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
controller.forward();
|
||||
},
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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>(
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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'),
|
||||
),
|
||||
@@ -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);
|
||||
|
||||
@@ -86,7 +86,7 @@ class _SignInButtonState extends State<SignInButton> {
|
||||
_showError();
|
||||
}
|
||||
|
||||
return RaisedButton(
|
||||
return ElevatedButton(
|
||||
child: Text('Sign In with Google'),
|
||||
onPressed: () => _signIn(),
|
||||
);
|
||||
|
||||
@@ -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);
|
||||
@@ -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()) {
|
||||
|
||||
@@ -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(
|
||||
@@ -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);
|
||||
@@ -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()) {
|
||||
|
||||
@@ -190,7 +190,7 @@ class _FormDatePickerState extends State<_FormDatePicker> {
|
||||
),
|
||||
],
|
||||
),
|
||||
FlatButton(
|
||||
TextButton(
|
||||
child: Text('Edit'),
|
||||
onPressed: () async {
|
||||
var newDate = await showDatePicker(
|
||||
|
||||
@@ -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
|
||||
@@ -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(),
|
||||
),
|
||||
|
||||
@@ -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
|
||||
@@ -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();
|
||||
|
||||
@@ -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,
|
||||
),
|
||||
],
|
||||
|
||||
@@ -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(),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -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)
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -27,7 +27,7 @@ class NestedRouterDemo extends StatefulWidget {
|
||||
class _NestedRouterDemoState extends State<NestedRouterDemo> {
|
||||
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();
|
||||
},
|
||||
|
||||
@@ -102,7 +102,7 @@ class _CategoryButton extends StatelessWidget {
|
||||
),
|
||||
child: ButtonTheme(
|
||||
height: 50.0,
|
||||
child: FlatButton(
|
||||
child: TextButton(
|
||||
child: Text(
|
||||
_buttonText,
|
||||
style: TextStyle(
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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<MethodChannelDemo> {
|
||||
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<MethodChannelDemo> {
|
||||
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 =
|
||||
|
||||
@@ -58,7 +58,7 @@ class _PlatformImageDemoState extends State<PlatformImageDemo> {
|
||||
SizedBox(
|
||||
height: 16,
|
||||
),
|
||||
RaisedButton(
|
||||
ElevatedButton(
|
||||
onPressed: imageData != null
|
||||
? null
|
||||
: () {
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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),
|
||||
),
|
||||
|
||||
@@ -309,11 +309,11 @@ void showChoices(BuildContext context, List<String> choices) {
|
||||
},
|
||||
),
|
||||
actions: [
|
||||
FlatButton(
|
||||
TextButton(
|
||||
child: Text('OK'),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
FlatButton(
|
||||
TextButton(
|
||||
child: Text('CANCEL'),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
|
||||
@@ -64,7 +64,7 @@ class _HomePageState extends State<HomePage> {
|
||||
style: Theme.of(context).textTheme.subtitle2,
|
||||
),
|
||||
SizedBox(height: 18),
|
||||
RaisedButton(
|
||||
ElevatedButton(
|
||||
child: const Text('Continue in iOS view'),
|
||||
onPressed: _launchPlatformCount,
|
||||
),
|
||||
|
||||
@@ -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'),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -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<CartModel>();
|
||||
cart.add(item);
|
||||
},
|
||||
splashColor: Theme.of(context).primaryColor,
|
||||
style: ButtonStyle(
|
||||
overlayColor: MaterialStateProperty.resolveWith<Color>((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'),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -16,8 +16,8 @@ class HomePage extends StatelessWidget {
|
||||
appBar: AppBar(
|
||||
title: Text('Testing Sample'),
|
||||
actions: <Widget>[
|
||||
FlatButton.icon(
|
||||
textColor: Colors.white,
|
||||
TextButton.icon(
|
||||
style: TextButton.styleFrom(primary: Colors.white),
|
||||
onPressed: () {
|
||||
Navigator.pushNamed(context, FavoritesPage.routeName);
|
||||
},
|
||||
|
||||
@@ -119,7 +119,7 @@ class TM extends State<App> {
|
||||
child: Container(
|
||||
child: CustomPaint(
|
||||
painter: P(),
|
||||
child: FlatButton(
|
||||
child: TextButton(
|
||||
onPressed: press,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
|
||||
@@ -512,11 +512,11 @@ class _NumberPickerDialogControllerState extends State<NumberPickerDialog> {
|
||||
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),
|
||||
|
||||
Reference in New Issue
Block a user