Unverified Commit 98b9f314 authored by LongCatIsLooong's avatar LongCatIsLooong Committed by GitHub

make CupertinoDynamicColor const constructible (#39430)

* make CupertinoDynamicColor const constructible

* review
parent f6d3f9ad
......@@ -11,6 +11,17 @@ import 'package:flutter_test/flutter_test.dart';
import '../rendering/mock_canvas.dart';
import '../widgets/semantics_tester.dart';
const CupertinoDynamicColor _kSystemFill = CupertinoDynamicColor(
color: Color.fromARGB(51, 120, 120, 128),
darkColor: Color.fromARGB(91, 120, 120, 128),
highContrastColor: Color.fromARGB(71, 120, 120, 128),
darkHighContrastColor: Color.fromARGB(112, 120, 120, 128),
elevatedColor: Color.fromARGB(51, 120, 120, 128),
darkElevatedColor: Color.fromARGB(91, 120, 120, 128),
highContrastElevatedColor: Color.fromARGB(71, 120, 120, 128),
darkHighContrastElevatedColor: Color.fromARGB(112, 120, 120, 128),
);
void main() {
Future<void> _dragSlider(WidgetTester tester, Key sliderKey) {
......@@ -441,15 +452,15 @@ void main() {
});
testWidgets('Themes can be overridden by dynamic colors', (WidgetTester tester) async {
final CupertinoDynamicColor activeColor = CupertinoDynamicColor(
color: const Color(0x00000001),
darkColor: const Color(0x00000002),
elevatedColor: const Color(0x00000003),
highContrastColor: const Color(0x00000004),
darkElevatedColor: const Color(0x00000005),
darkHighContrastColor: const Color(0x00000006),
highContrastElevatedColor: const Color(0x00000007),
darkHighContrastElevatedColor: const Color(0x00000008),
const CupertinoDynamicColor activeColor = CupertinoDynamicColor(
color: Color(0x00000001),
darkColor: Color(0x00000002),
elevatedColor: Color(0x00000003),
highContrastColor: Color(0x00000004),
darkElevatedColor: Color(0x00000005),
darkHighContrastColor: Color(0x00000006),
highContrastElevatedColor: Color(0x00000007),
darkHighContrastElevatedColor: Color(0x00000008),
);
Widget withTraits(Brightness brightness, CupertinoUserInterfaceLevelData level, bool highContrast) {
......@@ -512,12 +523,12 @@ void main() {
expect(
find.byType(CupertinoSlider),
paints..rrect(color: CupertinoSystemColors.fallbackValues.systemFill.color),
paints..rrect(color: _kSystemFill.color),
);
expect(
find.byType(CupertinoSlider),
isNot(paints..rrect(color: CupertinoSystemColors.fallbackValues.systemFill.darkColor)),
isNot(paints..rrect(color: _kSystemFill.darkColor)),
);
await tester.pumpWidget(
......@@ -535,12 +546,12 @@ void main() {
expect(
find.byType(CupertinoSlider),
paints..rrect(color: CupertinoSystemColors.fallbackValues.systemFill.darkColor),
paints..rrect(color: _kSystemFill.darkColor),
);
expect(
find.byType(CupertinoSlider),
isNot(paints..rrect(color: CupertinoSystemColors.fallbackValues.systemFill.color)),
isNot(paints..rrect(color: _kSystemFill.color)),
);
});
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment