1
0
mirror of https://github.com/flutter/samples.git synced 2026-03-28 07:11:50 +00:00

Migrate to the New Material Buttons (#668)

This commit is contained in:
Brett Morgan
2021-01-27 13:20:50 +11:00
committed by GitHub
parent 6502209a78
commit 622e8d55d3
44 changed files with 122 additions and 107 deletions

View File

@@ -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 =

View File

@@ -58,7 +58,7 @@ class _PlatformImageDemoState extends State<PlatformImageDemo> {
SizedBox(
height: 16,
),
RaisedButton(
ElevatedButton(
onPressed: imageData != null
? null
: () {

View File

@@ -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();

View File

@@ -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);