From 7df37d9f65055765359d5cf6a9275d5d3b8ae5f1 Mon Sep 17 00:00:00 2001 From: Xiao Yu Date: Tue, 9 Aug 2022 00:00:02 -0700 Subject: [PATCH] migrate material 3 demo code to avoid warning --- material_3_demo/lib/component_screen.dart | 24 ++++++++--------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/material_3_demo/lib/component_screen.dart b/material_3_demo/lib/component_screen.dart index 3dd190f92..f8e9cd432 100644 --- a/material_3_demo/lib/component_screen.dart +++ b/material_3_demo/lib/component_screen.dart @@ -113,10 +113,8 @@ class ButtonsWithoutIcon extends StatelessWidget { _colDivider, ElevatedButton( style: ElevatedButton.styleFrom( - // Foreground color - onPrimary: Theme.of(context).colorScheme.onPrimary, - // Background color - primary: Theme.of(context).colorScheme.primary, + foregroundColor: Theme.of(context).colorScheme.onPrimary, + backgroundColor: Theme.of(context).colorScheme.primary, ).copyWith(elevation: ButtonStyleButton.allOrNull(0.0)), onPressed: handlePressed(context, isDisabled, "FilledButton"), child: const Text('Filled'), @@ -124,10 +122,8 @@ class ButtonsWithoutIcon extends StatelessWidget { _colDivider, ElevatedButton( style: ElevatedButton.styleFrom( - // Foreground color - onPrimary: Theme.of(context).colorScheme.onSecondaryContainer, - // Background color - primary: Theme.of(context).colorScheme.secondaryContainer, + foregroundColor: Theme.of(context).colorScheme.onSecondaryContainer, + backgroundColor: Theme.of(context).colorScheme.secondaryContainer, ).copyWith(elevation: ButtonStyleButton.allOrNull(0.0)), onPressed: handlePressed(context, isDisabled, "FilledTonalButton"), child: const Text('Filled Tonal'), @@ -165,10 +161,8 @@ class ButtonsWithIcon extends StatelessWidget { _colDivider, ElevatedButton.icon( style: ElevatedButton.styleFrom( - // Foreground color - onPrimary: Theme.of(context).colorScheme.onPrimary, - // Background color - primary: Theme.of(context).colorScheme.primary, + foregroundColor: Theme.of(context).colorScheme.onPrimary, + backgroundColor: Theme.of(context).colorScheme.primary, ).copyWith(elevation: ButtonStyleButton.allOrNull(0.0)), onPressed: handlePressed(context, false, "FilledButton with Icon"), label: const Text('Icon'), @@ -177,10 +171,8 @@ class ButtonsWithIcon extends StatelessWidget { _colDivider, ElevatedButton.icon( style: ElevatedButton.styleFrom( - // Foreground color - onPrimary: Theme.of(context).colorScheme.onSecondaryContainer, - // Background color - primary: Theme.of(context).colorScheme.secondaryContainer, + foregroundColor: Theme.of(context).colorScheme.onSecondaryContainer, + backgroundColor: Theme.of(context).colorScheme.secondaryContainer, ).copyWith(elevation: ButtonStyleButton.allOrNull(0.0)), onPressed: handlePressed(context, false, "FilledTonalButton with Icon"),