Add surfaceTint, outlineVariant, scrim and re-arrange (#2070)

Re-arrange colors according to [Baseline color scheme tokens]

[Baseline color scheme tokens]:
https://m3.material.io/styles/color/the-color-system/tokens#e26e130c-fa67-48e1-81ca-d28f6e4ed398

## Pre-launch Checklist

- [x] I read the [Flutter Style Guide] _recently_, and have followed its
advice.
- [x] I signed the [CLA].
- [x] I read the [Contributors Guide].
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-devrel
channel on [Discord].

<!-- Links -->
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[CLA]: https://cla.developers.google.com/
[Discord]: https://github.com/flutter/flutter/wiki/Chat
[Contributors Guide]:
https://github.com/flutter/samples/blob/main/CONTRIBUTING.md
pull/2075/head
Hrishikesh Kadam 1 year ago committed by GitHub
parent 49eebf8c20
commit 49bc4d9d02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -137,144 +137,191 @@ class ColorSchemeView extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Column( return Column(
children: [ children: [
ColorGroup(children: [ ColorGroup(
ColorChip( children: [
label: 'primary', ColorChip(
color: colorScheme.primary, label: 'primary',
onColor: colorScheme.onPrimary, color: colorScheme.primary,
), onColor: colorScheme.onPrimary,
ColorChip( ),
ColorChip(
label: 'onPrimary', label: 'onPrimary',
color: colorScheme.onPrimary, color: colorScheme.onPrimary,
onColor: colorScheme.primary), onColor: colorScheme.primary,
ColorChip( ),
label: 'primaryContainer', ColorChip(
color: colorScheme.primaryContainer, label: 'primaryContainer',
onColor: colorScheme.onPrimaryContainer, color: colorScheme.primaryContainer,
), onColor: colorScheme.onPrimaryContainer,
ColorChip( ),
label: 'onPrimaryContainer', ColorChip(
color: colorScheme.onPrimaryContainer, label: 'onPrimaryContainer',
onColor: colorScheme.primaryContainer, color: colorScheme.onPrimaryContainer,
), onColor: colorScheme.primaryContainer,
]), ),
],
),
divider, divider,
ColorGroup(children: [ ColorGroup(
ColorChip( children: [
label: 'secondary', ColorChip(
color: colorScheme.secondary, label: 'secondary',
onColor: colorScheme.onSecondary, color: colorScheme.secondary,
), onColor: colorScheme.onSecondary,
ColorChip( ),
label: 'onSecondary', ColorChip(
color: colorScheme.onSecondary, label: 'onSecondary',
onColor: colorScheme.secondary, color: colorScheme.onSecondary,
), onColor: colorScheme.secondary,
ColorChip( ),
label: 'secondaryContainer', ColorChip(
color: colorScheme.secondaryContainer, label: 'secondaryContainer',
onColor: colorScheme.onSecondaryContainer, color: colorScheme.secondaryContainer,
), onColor: colorScheme.onSecondaryContainer,
ColorChip( ),
ColorChip(
label: 'onSecondaryContainer', label: 'onSecondaryContainer',
color: colorScheme.onSecondaryContainer, color: colorScheme.onSecondaryContainer,
onColor: colorScheme.secondaryContainer), onColor: colorScheme.secondaryContainer,
]), ),
],
),
divider, divider,
ColorGroup( ColorGroup(
children: [ children: [
ColorChip( ColorChip(
label: 'tertiary', label: 'tertiary',
color: colorScheme.tertiary, color: colorScheme.tertiary,
onColor: colorScheme.onTertiary), onColor: colorScheme.onTertiary,
),
ColorChip( ColorChip(
label: 'onTertiary', label: 'onTertiary',
color: colorScheme.onTertiary, color: colorScheme.onTertiary,
onColor: colorScheme.tertiary), onColor: colorScheme.tertiary,
),
ColorChip( ColorChip(
label: 'tertiaryContainer', label: 'tertiaryContainer',
color: colorScheme.tertiaryContainer, color: colorScheme.tertiaryContainer,
onColor: colorScheme.onTertiaryContainer), onColor: colorScheme.onTertiaryContainer,
),
ColorChip( ColorChip(
label: 'onTertiaryContainer', label: 'onTertiaryContainer',
color: colorScheme.onTertiaryContainer, color: colorScheme.onTertiaryContainer,
onColor: colorScheme.tertiaryContainer), onColor: colorScheme.tertiaryContainer,
),
], ],
), ),
divider, divider,
ColorGroup( ColorGroup(
children: [ children: [
ColorChip( ColorChip(
label: 'error', label: 'error',
color: colorScheme.error, color: colorScheme.error,
onColor: colorScheme.onError), onColor: colorScheme.onError,
),
ColorChip( ColorChip(
label: 'onError', label: 'onError',
color: colorScheme.onError, color: colorScheme.onError,
onColor: colorScheme.error), onColor: colorScheme.error,
),
ColorChip( ColorChip(
label: 'errorContainer', label: 'errorContainer',
color: colorScheme.errorContainer, color: colorScheme.errorContainer,
onColor: colorScheme.onErrorContainer), onColor: colorScheme.onErrorContainer,
),
ColorChip( ColorChip(
label: 'onErrorContainer', label: 'onErrorContainer',
color: colorScheme.onErrorContainer, color: colorScheme.onErrorContainer,
onColor: colorScheme.errorContainer), onColor: colorScheme.errorContainer,
),
], ],
), ),
divider, divider,
ColorGroup( ColorGroup(
children: [ children: [
ColorChip( ColorChip(
label: 'background', label: 'surface',
color: colorScheme.background, color: colorScheme.surface,
onColor: colorScheme.onBackground), onColor: colorScheme.onSurface,
),
ColorChip(
label: 'onSurface',
color: colorScheme.onSurface,
onColor: colorScheme.surface,
),
ColorChip(
label: 'surfaceVariant',
color: colorScheme.surfaceVariant,
onColor: colorScheme.onSurfaceVariant,
),
ColorChip(
label: 'onSurfaceVariant',
color: colorScheme.onSurfaceVariant,
onColor: colorScheme.surfaceVariant,
),
ColorChip( ColorChip(
label: 'onBackground', label: 'surfaceTint',
color: colorScheme.onBackground, color: colorScheme.surfaceTint,
onColor: colorScheme.background), ),
], ],
), ),
divider, divider,
ColorGroup( ColorGroup(
children: [ children: [
ColorChip( ColorChip(
label: 'surface', label: 'outline',
color: colorScheme.surface, color: colorScheme.outline,
onColor: colorScheme.onSurface), ),
ColorChip( ColorChip(
label: 'onSurface', label: 'outlineVariant',
color: colorScheme.onSurface, color: colorScheme.outlineVariant,
onColor: colorScheme.surface), ),
],
),
divider,
ColorGroup(
children: [
ColorChip(
label: 'inverseSurface',
color: colorScheme.inverseSurface,
onColor: colorScheme.onInverseSurface,
),
ColorChip( ColorChip(
label: 'surfaceVariant', label: 'onInverseSurface',
color: colorScheme.surfaceVariant, color: colorScheme.onInverseSurface,
onColor: colorScheme.onSurfaceVariant), onColor: colorScheme.inverseSurface,
),
ColorChip( ColorChip(
label: 'onSurfaceVariant', label: 'inversePrimary',
color: colorScheme.onSurfaceVariant, color: colorScheme.inversePrimary,
onColor: colorScheme.surfaceVariant), onColor: colorScheme.primary,
),
], ],
), ),
divider, divider,
ColorGroup( ColorGroup(
children: [ children: [
ColorChip(label: 'outline', color: colorScheme.outline),
ColorChip(label: 'shadow', color: colorScheme.shadow),
ColorChip( ColorChip(
label: 'inverseSurface', label: 'background',
color: colorScheme.inverseSurface, color: colorScheme.background,
onColor: colorScheme.onInverseSurface), onColor: colorScheme.onBackground,
),
ColorChip( ColorChip(
label: 'onInverseSurface', label: 'onBackground',
color: colorScheme.onInverseSurface, color: colorScheme.onBackground,
onColor: colorScheme.inverseSurface), onColor: colorScheme.background,
),
ColorChip( ColorChip(
label: 'inversePrimary', label: 'scrim',
color: colorScheme.inversePrimary, color: colorScheme.scrim,
onColor: colorScheme.primary), ),
ColorChip(
label: 'shadow',
color: colorScheme.shadow,
),
], ],
), ),
divider,
], ],
); );
} }

@ -70,6 +70,6 @@ void main() {
)); ));
expect(find.text('Light ColorScheme'), findsOneWidget); expect(find.text('Light ColorScheme'), findsOneWidget);
expect(find.text('Dark ColorScheme'), findsOneWidget); expect(find.text('Dark ColorScheme'), findsOneWidget);
expect(find.byType(ColorGroup, skipOffstage: false), findsNWidgets(14)); expect(find.byType(ColorGroup, skipOffstage: false), findsNWidgets(16));
}); });
} }

@ -137,144 +137,191 @@ class ColorSchemeView extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Column( return Column(
children: [ children: [
ColorGroup(children: [ ColorGroup(
ColorChip( children: [
label: 'primary', ColorChip(
color: colorScheme.primary, label: 'primary',
onColor: colorScheme.onPrimary, color: colorScheme.primary,
), onColor: colorScheme.onPrimary,
ColorChip( ),
ColorChip(
label: 'onPrimary', label: 'onPrimary',
color: colorScheme.onPrimary, color: colorScheme.onPrimary,
onColor: colorScheme.primary), onColor: colorScheme.primary,
ColorChip( ),
label: 'primaryContainer', ColorChip(
color: colorScheme.primaryContainer, label: 'primaryContainer',
onColor: colorScheme.onPrimaryContainer, color: colorScheme.primaryContainer,
), onColor: colorScheme.onPrimaryContainer,
ColorChip( ),
label: 'onPrimaryContainer', ColorChip(
color: colorScheme.onPrimaryContainer, label: 'onPrimaryContainer',
onColor: colorScheme.primaryContainer, color: colorScheme.onPrimaryContainer,
), onColor: colorScheme.primaryContainer,
]), ),
],
),
divider, divider,
ColorGroup(children: [ ColorGroup(
ColorChip( children: [
label: 'secondary', ColorChip(
color: colorScheme.secondary, label: 'secondary',
onColor: colorScheme.onSecondary, color: colorScheme.secondary,
), onColor: colorScheme.onSecondary,
ColorChip( ),
label: 'onSecondary', ColorChip(
color: colorScheme.onSecondary, label: 'onSecondary',
onColor: colorScheme.secondary, color: colorScheme.onSecondary,
), onColor: colorScheme.secondary,
ColorChip( ),
label: 'secondaryContainer', ColorChip(
color: colorScheme.secondaryContainer, label: 'secondaryContainer',
onColor: colorScheme.onSecondaryContainer, color: colorScheme.secondaryContainer,
), onColor: colorScheme.onSecondaryContainer,
ColorChip( ),
ColorChip(
label: 'onSecondaryContainer', label: 'onSecondaryContainer',
color: colorScheme.onSecondaryContainer, color: colorScheme.onSecondaryContainer,
onColor: colorScheme.secondaryContainer), onColor: colorScheme.secondaryContainer,
]), ),
],
),
divider, divider,
ColorGroup( ColorGroup(
children: [ children: [
ColorChip( ColorChip(
label: 'tertiary', label: 'tertiary',
color: colorScheme.tertiary, color: colorScheme.tertiary,
onColor: colorScheme.onTertiary), onColor: colorScheme.onTertiary,
),
ColorChip( ColorChip(
label: 'onTertiary', label: 'onTertiary',
color: colorScheme.onTertiary, color: colorScheme.onTertiary,
onColor: colorScheme.tertiary), onColor: colorScheme.tertiary,
),
ColorChip( ColorChip(
label: 'tertiaryContainer', label: 'tertiaryContainer',
color: colorScheme.tertiaryContainer, color: colorScheme.tertiaryContainer,
onColor: colorScheme.onTertiaryContainer), onColor: colorScheme.onTertiaryContainer,
),
ColorChip( ColorChip(
label: 'onTertiaryContainer', label: 'onTertiaryContainer',
color: colorScheme.onTertiaryContainer, color: colorScheme.onTertiaryContainer,
onColor: colorScheme.tertiaryContainer), onColor: colorScheme.tertiaryContainer,
),
], ],
), ),
divider, divider,
ColorGroup( ColorGroup(
children: [ children: [
ColorChip( ColorChip(
label: 'error', label: 'error',
color: colorScheme.error, color: colorScheme.error,
onColor: colorScheme.onError), onColor: colorScheme.onError,
),
ColorChip( ColorChip(
label: 'onError', label: 'onError',
color: colorScheme.onError, color: colorScheme.onError,
onColor: colorScheme.error), onColor: colorScheme.error,
),
ColorChip( ColorChip(
label: 'errorContainer', label: 'errorContainer',
color: colorScheme.errorContainer, color: colorScheme.errorContainer,
onColor: colorScheme.onErrorContainer), onColor: colorScheme.onErrorContainer,
),
ColorChip( ColorChip(
label: 'onErrorContainer', label: 'onErrorContainer',
color: colorScheme.onErrorContainer, color: colorScheme.onErrorContainer,
onColor: colorScheme.errorContainer), onColor: colorScheme.errorContainer,
),
], ],
), ),
divider, divider,
ColorGroup( ColorGroup(
children: [ children: [
ColorChip( ColorChip(
label: 'background', label: 'surface',
color: colorScheme.background, color: colorScheme.surface,
onColor: colorScheme.onBackground), onColor: colorScheme.onSurface,
),
ColorChip(
label: 'onSurface',
color: colorScheme.onSurface,
onColor: colorScheme.surface,
),
ColorChip(
label: 'surfaceVariant',
color: colorScheme.surfaceVariant,
onColor: colorScheme.onSurfaceVariant,
),
ColorChip(
label: 'onSurfaceVariant',
color: colorScheme.onSurfaceVariant,
onColor: colorScheme.surfaceVariant,
),
ColorChip( ColorChip(
label: 'onBackground', label: 'surfaceTint',
color: colorScheme.onBackground, color: colorScheme.surfaceTint,
onColor: colorScheme.background), ),
], ],
), ),
divider, divider,
ColorGroup( ColorGroup(
children: [ children: [
ColorChip( ColorChip(
label: 'surface', label: 'outline',
color: colorScheme.surface, color: colorScheme.outline,
onColor: colorScheme.onSurface), ),
ColorChip( ColorChip(
label: 'onSurface', label: 'outlineVariant',
color: colorScheme.onSurface, color: colorScheme.outlineVariant,
onColor: colorScheme.surface), ),
],
),
divider,
ColorGroup(
children: [
ColorChip(
label: 'inverseSurface',
color: colorScheme.inverseSurface,
onColor: colorScheme.onInverseSurface,
),
ColorChip( ColorChip(
label: 'surfaceVariant', label: 'onInverseSurface',
color: colorScheme.surfaceVariant, color: colorScheme.onInverseSurface,
onColor: colorScheme.onSurfaceVariant), onColor: colorScheme.inverseSurface,
),
ColorChip( ColorChip(
label: 'onSurfaceVariant', label: 'inversePrimary',
color: colorScheme.onSurfaceVariant, color: colorScheme.inversePrimary,
onColor: colorScheme.surfaceVariant), onColor: colorScheme.primary,
),
], ],
), ),
divider, divider,
ColorGroup( ColorGroup(
children: [ children: [
ColorChip(label: 'outline', color: colorScheme.outline),
ColorChip(label: 'shadow', color: colorScheme.shadow),
ColorChip( ColorChip(
label: 'inverseSurface', label: 'background',
color: colorScheme.inverseSurface, color: colorScheme.background,
onColor: colorScheme.onInverseSurface), onColor: colorScheme.onBackground,
),
ColorChip( ColorChip(
label: 'onInverseSurface', label: 'onBackground',
color: colorScheme.onInverseSurface, color: colorScheme.onBackground,
onColor: colorScheme.inverseSurface), onColor: colorScheme.background,
),
ColorChip( ColorChip(
label: 'inversePrimary', label: 'scrim',
color: colorScheme.inversePrimary, color: colorScheme.scrim,
onColor: colorScheme.primary), ),
ColorChip(
label: 'shadow',
color: colorScheme.shadow,
),
], ],
), ),
divider,
], ],
); );
} }

@ -70,6 +70,6 @@ void main() {
)); ));
expect(find.text('Light ColorScheme'), findsOneWidget); expect(find.text('Light ColorScheme'), findsOneWidget);
expect(find.text('Dark ColorScheme'), findsOneWidget); expect(find.text('Dark ColorScheme'), findsOneWidget);
expect(find.byType(ColorGroup, skipOffstage: false), findsNWidgets(14)); expect(find.byType(ColorGroup, skipOffstage: false), findsNWidgets(16));
}); });
} }

Loading…
Cancel
Save