mirror of
https://github.com/flutter/samples.git
synced 2025-11-08 13:58:47 +00:00
migrate material 3 demo code to avoid warning
This commit is contained in:
@@ -113,10 +113,8 @@ class ButtonsWithoutIcon extends StatelessWidget {
|
|||||||
_colDivider,
|
_colDivider,
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
// Foreground color
|
foregroundColor: Theme.of(context).colorScheme.onPrimary,
|
||||||
onPrimary: Theme.of(context).colorScheme.onPrimary,
|
backgroundColor: Theme.of(context).colorScheme.primary,
|
||||||
// Background color
|
|
||||||
primary: Theme.of(context).colorScheme.primary,
|
|
||||||
).copyWith(elevation: ButtonStyleButton.allOrNull(0.0)),
|
).copyWith(elevation: ButtonStyleButton.allOrNull(0.0)),
|
||||||
onPressed: handlePressed(context, isDisabled, "FilledButton"),
|
onPressed: handlePressed(context, isDisabled, "FilledButton"),
|
||||||
child: const Text('Filled'),
|
child: const Text('Filled'),
|
||||||
@@ -124,10 +122,8 @@ class ButtonsWithoutIcon extends StatelessWidget {
|
|||||||
_colDivider,
|
_colDivider,
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
// Foreground color
|
foregroundColor: Theme.of(context).colorScheme.onSecondaryContainer,
|
||||||
onPrimary: Theme.of(context).colorScheme.onSecondaryContainer,
|
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||||
// Background color
|
|
||||||
primary: Theme.of(context).colorScheme.secondaryContainer,
|
|
||||||
).copyWith(elevation: ButtonStyleButton.allOrNull(0.0)),
|
).copyWith(elevation: ButtonStyleButton.allOrNull(0.0)),
|
||||||
onPressed: handlePressed(context, isDisabled, "FilledTonalButton"),
|
onPressed: handlePressed(context, isDisabled, "FilledTonalButton"),
|
||||||
child: const Text('Filled Tonal'),
|
child: const Text('Filled Tonal'),
|
||||||
@@ -165,10 +161,8 @@ class ButtonsWithIcon extends StatelessWidget {
|
|||||||
_colDivider,
|
_colDivider,
|
||||||
ElevatedButton.icon(
|
ElevatedButton.icon(
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
// Foreground color
|
foregroundColor: Theme.of(context).colorScheme.onPrimary,
|
||||||
onPrimary: Theme.of(context).colorScheme.onPrimary,
|
backgroundColor: Theme.of(context).colorScheme.primary,
|
||||||
// Background color
|
|
||||||
primary: Theme.of(context).colorScheme.primary,
|
|
||||||
).copyWith(elevation: ButtonStyleButton.allOrNull(0.0)),
|
).copyWith(elevation: ButtonStyleButton.allOrNull(0.0)),
|
||||||
onPressed: handlePressed(context, false, "FilledButton with Icon"),
|
onPressed: handlePressed(context, false, "FilledButton with Icon"),
|
||||||
label: const Text('Icon'),
|
label: const Text('Icon'),
|
||||||
@@ -177,10 +171,8 @@ class ButtonsWithIcon extends StatelessWidget {
|
|||||||
_colDivider,
|
_colDivider,
|
||||||
ElevatedButton.icon(
|
ElevatedButton.icon(
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
// Foreground color
|
foregroundColor: Theme.of(context).colorScheme.onSecondaryContainer,
|
||||||
onPrimary: Theme.of(context).colorScheme.onSecondaryContainer,
|
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||||
// Background color
|
|
||||||
primary: Theme.of(context).colorScheme.secondaryContainer,
|
|
||||||
).copyWith(elevation: ButtonStyleButton.allOrNull(0.0)),
|
).copyWith(elevation: ButtonStyleButton.allOrNull(0.0)),
|
||||||
onPressed:
|
onPressed:
|
||||||
handlePressed(context, false, "FilledTonalButton with Icon"),
|
handlePressed(context, false, "FilledTonalButton with Icon"),
|
||||||
|
|||||||
Reference in New Issue
Block a user