Enhance ColorScheme.fromSeed with a new variant parameter (#144805)
Fixes #144649 This PR is to add an enhancement for `ColorScheme.fromSeed()`. When we input a brighter color with a high chroma and we want the resulting `ColorScheme` respects the source color, we can achieve this by setting ```dart ColorScheme.fromSeed( seedColor: sourceColor, variant: Variant.fidelity, ... ) ``` Here is a demo for `ColorScheme` constructed by all 9 variants:  
This commit is contained in:
@@ -11,10 +11,9 @@ void main() {
|
||||
await tester.pumpWidget(
|
||||
const example.ColorSchemeExample(),
|
||||
);
|
||||
expect(find.text('Light ColorScheme'), findsOneWidget);
|
||||
expect(find.text('Dark ColorScheme'), findsOneWidget);
|
||||
expect(find.text('tonalSpot (Default)'), findsOneWidget);
|
||||
|
||||
expect(find.byType(example.ColorChip), findsNWidgets(86));
|
||||
expect(find.byType(example.ColorChip), findsNWidgets(43 * 9));
|
||||
});
|
||||
|
||||
testWidgets('Change color seed', (WidgetTester tester) async {
|
||||
@@ -30,7 +29,7 @@ void main() {
|
||||
)
|
||||
);
|
||||
}
|
||||
expect(coloredBox().color, const Color(0xFF6750A4));
|
||||
expect(coloredBox().color, const Color(0xff65558f));
|
||||
await tester.tap(find.byType(MenuAnchor));
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.widgetWithText(MenuItemButton, 'Yellow'));
|
||||
|
||||
Reference in New Issue
Block a user