From c523d05b7e77b14d488ed942d2c16ccb5a8cd625 Mon Sep 17 00:00:00 2001 From: Qun Cheng <36861262+QuncCccccc@users.noreply.github.com> Date: Mon, 29 Aug 2022 23:41:19 -0700 Subject: [PATCH] Update filled button and filled tonal button (#1390) * Update FilledButton and FilledTonalButton * Ran flutter format Co-authored-by: Qun Cheng Co-authored-by: Brett Morgan --- .../material_3_demo/lib/component_screen.dart | 26 +++---------------- .../test/component_screen_test.dart | 5 ++-- 2 files changed, 6 insertions(+), 25 deletions(-) diff --git a/experimental/material_3_demo/lib/component_screen.dart b/experimental/material_3_demo/lib/component_screen.dart index 38c6f87ea..5f5f6351a 100644 --- a/experimental/material_3_demo/lib/component_screen.dart +++ b/experimental/material_3_demo/lib/component_screen.dart @@ -118,21 +118,12 @@ class ButtonsWithoutIcon extends StatelessWidget { child: const Text('Elevated'), ), colDivider, - ElevatedButton( - style: ElevatedButton.styleFrom( - foregroundColor: Theme.of(context).colorScheme.onPrimary, - backgroundColor: Theme.of(context).colorScheme.primary, - ).copyWith(elevation: ButtonStyleButton.allOrNull(0.0)), + FilledButton( onPressed: handlePressed(context, isDisabled, 'FilledButton'), child: const Text('Filled'), ), colDivider, - ElevatedButton( - style: ElevatedButton.styleFrom( - foregroundColor: - Theme.of(context).colorScheme.onSecondaryContainer, - backgroundColor: Theme.of(context).colorScheme.secondaryContainer, - ).copyWith(elevation: ButtonStyleButton.allOrNull(0.0)), + FilledButton.tonal( onPressed: handlePressed(context, isDisabled, 'FilledTonalButton'), child: const Text('Filled Tonal'), ), @@ -167,22 +158,13 @@ class ButtonsWithIcon extends StatelessWidget { label: const Text('Icon'), ), colDivider, - ElevatedButton.icon( - style: ElevatedButton.styleFrom( - foregroundColor: Theme.of(context).colorScheme.onPrimary, - backgroundColor: Theme.of(context).colorScheme.primary, - ).copyWith(elevation: ButtonStyleButton.allOrNull(0.0)), + FilledButton.icon( onPressed: handlePressed(context, false, 'FilledButton with Icon'), label: const Text('Icon'), icon: const Icon(Icons.add), ), colDivider, - ElevatedButton.icon( - style: ElevatedButton.styleFrom( - foregroundColor: - Theme.of(context).colorScheme.onSecondaryContainer, - backgroundColor: Theme.of(context).colorScheme.secondaryContainer, - ).copyWith(elevation: ButtonStyleButton.allOrNull(0.0)), + FilledButton.tonalIcon( onPressed: handlePressed(context, false, 'FilledTonalButton with Icon'), label: const Text('Icon'), diff --git a/experimental/material_3_demo/test/component_screen_test.dart b/experimental/material_3_demo/test/component_screen_test.dart index d1f36ad90..783b3e489 100644 --- a/experimental/material_3_demo/test/component_screen_test.dart +++ b/experimental/material_3_demo/test/component_screen_test.dart @@ -23,9 +23,8 @@ void main() { // Elements on the component screen // Buttons expect(find.widgetWithText(ElevatedButton, 'Elevated'), findsNWidgets(2)); - expect(find.widgetWithText(ElevatedButton, 'Filled'), findsNWidgets(2)); - expect( - find.widgetWithText(ElevatedButton, 'Filled Tonal'), findsNWidgets(2)); + expect(find.widgetWithText(FilledButton, 'Filled'), findsNWidgets(2)); + expect(find.widgetWithText(FilledButton, 'Filled Tonal'), findsNWidgets(2)); expect(find.widgetWithText(OutlinedButton, 'Outlined'), findsNWidgets(2)); expect(find.widgetWithText(TextButton, 'Text'), findsNWidgets(2)); expect(find.text('Icon'), findsNWidgets(5));