mirror of
https://github.com/flutter/samples.git
synced 2025-11-09 06:18:49 +00:00
Update filled button and filled tonal button (#1390)
* Update FilledButton and FilledTonalButton * Ran flutter format Co-authored-by: Qun Cheng <quncheng@google.com> Co-authored-by: Brett Morgan <brett.morgan@gmail.com>
This commit is contained in:
@@ -118,21 +118,12 @@ class ButtonsWithoutIcon extends StatelessWidget {
|
|||||||
child: const Text('Elevated'),
|
child: const Text('Elevated'),
|
||||||
),
|
),
|
||||||
colDivider,
|
colDivider,
|
||||||
ElevatedButton(
|
FilledButton(
|
||||||
style: ElevatedButton.styleFrom(
|
|
||||||
foregroundColor: Theme.of(context).colorScheme.onPrimary,
|
|
||||||
backgroundColor: Theme.of(context).colorScheme.primary,
|
|
||||||
).copyWith(elevation: ButtonStyleButton.allOrNull(0.0)),
|
|
||||||
onPressed: handlePressed(context, isDisabled, 'FilledButton'),
|
onPressed: handlePressed(context, isDisabled, 'FilledButton'),
|
||||||
child: const Text('Filled'),
|
child: const Text('Filled'),
|
||||||
),
|
),
|
||||||
colDivider,
|
colDivider,
|
||||||
ElevatedButton(
|
FilledButton.tonal(
|
||||||
style: ElevatedButton.styleFrom(
|
|
||||||
foregroundColor:
|
|
||||||
Theme.of(context).colorScheme.onSecondaryContainer,
|
|
||||||
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
|
||||||
).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'),
|
||||||
),
|
),
|
||||||
@@ -167,22 +158,13 @@ class ButtonsWithIcon extends StatelessWidget {
|
|||||||
label: const Text('Icon'),
|
label: const Text('Icon'),
|
||||||
),
|
),
|
||||||
colDivider,
|
colDivider,
|
||||||
ElevatedButton.icon(
|
FilledButton.icon(
|
||||||
style: ElevatedButton.styleFrom(
|
|
||||||
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'),
|
onPressed: handlePressed(context, false, 'FilledButton with Icon'),
|
||||||
label: const Text('Icon'),
|
label: const Text('Icon'),
|
||||||
icon: const Icon(Icons.add),
|
icon: const Icon(Icons.add),
|
||||||
),
|
),
|
||||||
colDivider,
|
colDivider,
|
||||||
ElevatedButton.icon(
|
FilledButton.tonalIcon(
|
||||||
style: ElevatedButton.styleFrom(
|
|
||||||
foregroundColor:
|
|
||||||
Theme.of(context).colorScheme.onSecondaryContainer,
|
|
||||||
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
|
||||||
).copyWith(elevation: ButtonStyleButton.allOrNull(0.0)),
|
|
||||||
onPressed:
|
onPressed:
|
||||||
handlePressed(context, false, 'FilledTonalButton with Icon'),
|
handlePressed(context, false, 'FilledTonalButton with Icon'),
|
||||||
label: const Text('Icon'),
|
label: const Text('Icon'),
|
||||||
|
|||||||
@@ -23,9 +23,8 @@ void main() {
|
|||||||
// Elements on the component screen
|
// Elements on the component screen
|
||||||
// Buttons
|
// Buttons
|
||||||
expect(find.widgetWithText(ElevatedButton, 'Elevated'), findsNWidgets(2));
|
expect(find.widgetWithText(ElevatedButton, 'Elevated'), findsNWidgets(2));
|
||||||
expect(find.widgetWithText(ElevatedButton, 'Filled'), findsNWidgets(2));
|
expect(find.widgetWithText(FilledButton, 'Filled'), findsNWidgets(2));
|
||||||
expect(
|
expect(find.widgetWithText(FilledButton, 'Filled Tonal'), findsNWidgets(2));
|
||||||
find.widgetWithText(ElevatedButton, 'Filled Tonal'), findsNWidgets(2));
|
|
||||||
expect(find.widgetWithText(OutlinedButton, 'Outlined'), findsNWidgets(2));
|
expect(find.widgetWithText(OutlinedButton, 'Outlined'), findsNWidgets(2));
|
||||||
expect(find.widgetWithText(TextButton, 'Text'), findsNWidgets(2));
|
expect(find.widgetWithText(TextButton, 'Text'), findsNWidgets(2));
|
||||||
expect(find.text('Icon'), findsNWidgets(5));
|
expect(find.text('Icon'), findsNWidgets(5));
|
||||||
|
|||||||
Reference in New Issue
Block a user