Add contrastLevel parameter to ColorScheme.fromSeed (#149705)

This PR is to add a parameter `contrastLevel` to `ColorScheme.fromSeed` so that we can construct high contrast `ColorScheme`.

https://github.com/flutter/flutter/assets/36861262/c609c996-5dfe-4c6c-800c-349a99de4256

Related to https://github.com/flutter/flutter/issues/149683
This commit is contained in:
Qun Cheng
2024-06-05 22:16:08 +00:00
committed by GitHub
parent d46463056c
commit 3ed3f31ba6
4 changed files with 267 additions and 90 deletions

View File

@@ -9,7 +9,8 @@ import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('ColorScheme Smoke Test', (WidgetTester tester) async {
await tester.pumpWidget(
const example.ColorSchemeExample(),
const MaterialApp(home: example.ColorSchemeExample()
),
);
expect(find.text('tonalSpot (Default)'), findsOneWidget);
@@ -18,7 +19,7 @@ void main() {
testWidgets('Change color seed', (WidgetTester tester) async {
await tester.pumpWidget(
const example.ColorSchemeExample(),
const MaterialApp(home: example.ColorSchemeExample()),
);
ColoredBox coloredBox() {
@@ -30,9 +31,9 @@ void main() {
);
}
expect(coloredBox().color, const Color(0xff65558f));
await tester.tap(find.byType(MenuAnchor));
await tester.tap(find.byIcon(Icons.settings));
await tester.pumpAndSettle();
await tester.tap(find.widgetWithText(MenuItemButton, 'Yellow'));
await tester.tap(find.byType(IconButton).at(6));
await tester.pumpAndSettle();
expect(coloredBox().color, const Color(0xFF685F12));