From 0f70826a71caf9829d35a67ffd6aa93abc220880 Mon Sep 17 00:00:00 2001 From: Miguel Beltran Date: Mon, 6 Feb 2023 04:57:43 +0100 Subject: [PATCH] Migrate `platform_channels` to Material 3 (#1623) * Migrate platform_channels to Material 3 * fix tests --------- Co-authored-by: Brett Morgan --- platform_channels/lib/main.dart | 1 + platform_channels/lib/src/method_channel_demo.dart | 10 +++++----- platform_channels/lib/src/platform_image_demo.dart | 2 +- .../test/src/platform_image_demo_test.dart | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/platform_channels/lib/main.dart b/platform_channels/lib/main.dart index d80d7cc1a..03620b029 100644 --- a/platform_channels/lib/main.dart +++ b/platform_channels/lib/main.dart @@ -25,6 +25,7 @@ class PlatformChannelSample extends StatelessWidget { snackBarTheme: SnackBarThemeData( backgroundColor: Colors.blue[500], ), + useMaterial3: true, ), routerConfig: router(), ); diff --git a/platform_channels/lib/src/method_channel_demo.dart b/platform_channels/lib/src/method_channel_demo.dart index 72708461f..0758ca9ef 100644 --- a/platform_channels/lib/src/method_channel_demo.dart +++ b/platform_channels/lib/src/method_channel_demo.dart @@ -7,7 +7,7 @@ import 'package:flutter/services.dart'; import 'package:platform_channels/src/counter_method_channel.dart'; /// The widget demonstrates how to use [MethodChannel] to invoke platform methods. -/// It has two [ElevatedButton]s to increment and decrement the value of +/// It has two [FilledButton]s to increment and decrement the value of /// [count], and a [Text] widget to display its value. class MethodChannelDemo extends StatefulWidget { const MethodChannelDemo({super.key}); @@ -38,9 +38,9 @@ class _MethodChannelDemoState extends State { Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ - // Whenever users press the ElevatedButton, it invokes + // Whenever users press the FilledButton, it invokes // Counter.increment method to increment the value of count. - ElevatedButton.icon( + FilledButton.icon( onPressed: () async { try { final value = await Counter.increment(counterValue: count); @@ -56,9 +56,9 @@ class _MethodChannelDemoState extends State { label: const Text('Increment'), ), - // Whenever users press the ElevatedButton, it invokes + // Whenever users press the FilledButton, it invokes // Counter.decrement method to decrement the value of count. - ElevatedButton.icon( + FilledButton.icon( onPressed: () async { try { final value = await Counter.decrement(counterValue: count); diff --git a/platform_channels/lib/src/platform_image_demo.dart b/platform_channels/lib/src/platform_image_demo.dart index 6d88b548f..950d3c48b 100644 --- a/platform_channels/lib/src/platform_image_demo.dart +++ b/platform_channels/lib/src/platform_image_demo.dart @@ -60,7 +60,7 @@ class _PlatformImageDemoState extends State { const SizedBox( height: 16, ), - ElevatedButton( + FilledButton( onPressed: imageData != null ? null : () { diff --git a/platform_channels/test/src/platform_image_demo_test.dart b/platform_channels/test/src/platform_image_demo_test.dart index aa7e8dab1..75502938c 100644 --- a/platform_channels/test/src/platform_image_demo_test.dart +++ b/platform_channels/test/src/platform_image_demo_test.dart @@ -29,7 +29,7 @@ void main() { expect(find.byType(Image), findsNothing); // Tap on ElevatedButton to get Image. - await tester.tap(find.byType(ElevatedButton)); + await tester.tap(find.byType(FilledButton)); await tester.pumpAndSettle(); expect(find.byType(Placeholder), findsNothing);