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

make CupertinoDynamicColor const constructible (#39430)

* make CupertinoDynamicColor const constructible

* review
parent f6d3f9ad
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' show Color; import 'dart:ui' show Color;
import 'package:collection/collection.dart' show DeepCollectionEquality;
import '../../foundation.dart'; import '../../foundation.dart';
import '../widgets/basic.dart'; import '../widgets/basic.dart';
...@@ -144,7 +143,7 @@ class CupertinoDynamicColor extends Color { ...@@ -144,7 +143,7 @@ class CupertinoDynamicColor extends Color {
/// [BuildContext] given. The default effective color is [color]. /// [BuildContext] given. The default effective color is [color].
/// ///
/// All the colors must not be null. /// All the colors must not be null.
CupertinoDynamicColor({ const CupertinoDynamicColor({
@required Color color, @required Color color,
@required Color darkColor, @required Color darkColor,
@required Color highContrastColor, @required Color highContrastColor,
...@@ -155,16 +154,14 @@ class CupertinoDynamicColor extends Color { ...@@ -155,16 +154,14 @@ class CupertinoDynamicColor extends Color {
@required Color darkHighContrastElevatedColor, @required Color darkHighContrastElevatedColor,
}) : this._( }) : this._(
color, color,
<List<List<Color>>>[ color,
<List<Color>>[ darkColor,
<Color>[darkColor, darkElevatedColor], highContrastColor,
<Color>[darkHighContrastColor, darkHighContrastElevatedColor], darkHighContrastColor,
], elevatedColor,
<List<Color>>[ darkElevatedColor,
<Color>[color, elevatedColor], highContrastElevatedColor,
<Color>[highContrastColor, highContrastElevatedColor], darkHighContrastElevatedColor,
],
],
); );
/// Creates an adaptive [Color] that changes its effective color based on the /// Creates an adaptive [Color] that changes its effective color based on the
...@@ -173,7 +170,7 @@ class CupertinoDynamicColor extends Color { ...@@ -173,7 +170,7 @@ class CupertinoDynamicColor extends Color {
/// ([MediaQueryData.highContrast]). The default effective color is [color]. /// ([MediaQueryData.highContrast]). The default effective color is [color].
/// ///
/// All the colors must not be null. /// All the colors must not be null.
CupertinoDynamicColor.withBrightnessAndContrast({ const CupertinoDynamicColor.withBrightnessAndContrast({
@required Color color, @required Color color,
@required Color darkColor, @required Color darkColor,
@required Color highContrastColor, @required Color highContrastColor,
...@@ -188,12 +185,13 @@ class CupertinoDynamicColor extends Color { ...@@ -188,12 +185,13 @@ class CupertinoDynamicColor extends Color {
highContrastElevatedColor: highContrastColor, highContrastElevatedColor: highContrastColor,
darkHighContrastElevatedColor: darkHighContrastColor, darkHighContrastElevatedColor: darkHighContrastColor,
); );
/// Creates an adaptive [Color] that changes its effective color based on the given /// Creates an adaptive [Color] that changes its effective color based on the given
/// [BuildContext]'s brightness (from [MediaQueryData.platformBrightness] or /// [BuildContext]'s brightness (from [MediaQueryData.platformBrightness] or
/// [CupertinoThemeData.brightness]). The default effective color is [color]. /// [CupertinoThemeData.brightness]). The default effective color is [color].
/// ///
/// All the colors must not be null. /// All the colors must not be null.
CupertinoDynamicColor.withBrightness({ const CupertinoDynamicColor.withBrightness({
@required Color color, @required Color color,
@required Color darkColor, @required Color darkColor,
}) : this( }) : this(
...@@ -207,19 +205,34 @@ class CupertinoDynamicColor extends Color { ...@@ -207,19 +205,34 @@ class CupertinoDynamicColor extends Color {
darkHighContrastElevatedColor: darkColor, darkHighContrastElevatedColor: darkColor,
); );
CupertinoDynamicColor._( const CupertinoDynamicColor._(
Color value, this._effectiveColor,
this._colorMap, this.color,
) : assert(() { this.darkColor,
Iterable<Object> expand(Object a) { this.highContrastColor,
return (a is Iterable<Object>) ? a.expand<Object>(expand) : <Object>[a]; this.darkHighContrastColor,
} this.elevatedColor,
this.darkElevatedColor,
this.highContrastElevatedColor,
this.darkHighContrastElevatedColor,
) : assert(color != null),
assert(darkColor != null),
assert(highContrastColor != null),
assert(darkHighContrastColor != null),
assert(elevatedColor != null),
assert(darkElevatedColor != null),
assert(highContrastElevatedColor != null),
assert(darkHighContrastElevatedColor != null),
assert(_effectiveColor != null),
// The super constructor has to be called with a dummy value in order to mark
// this constructor const.
// The field `value` is overriden in the class implementation.
super(0);
final Color _effectiveColor;
final Iterable<Object> expanded = expand(_colorMap); @override
assert(expanded.contains(value), '$value is not one of $_colorMap'); int get value => _effectiveColor.value;
return !expanded.contains(null) && expanded.length == 8;
}(), 'The colorMap provided is invalid: $_colorMap'),
super(value.value);
/// The color to use when the [BuildContext] implies a combination of light mode, /// The color to use when the [BuildContext] implies a combination of light mode,
/// normal contrast, and base interface elevation. /// normal contrast, and base interface elevation.
...@@ -230,9 +243,7 @@ class CupertinoDynamicColor extends Color { ...@@ -230,9 +243,7 @@ class CupertinoDynamicColor extends Color {
/// or a [MediaQuery] whose [MediaQueryData.platformBrightness] is [PlatformBrightness.light]. /// or a [MediaQuery] whose [MediaQueryData.platformBrightness] is [PlatformBrightness.light].
/// - has a [MediaQuery] whose [MediaQueryData.highContrast] is `false`. /// - has a [MediaQuery] whose [MediaQueryData.highContrast] is `false`.
/// - has a [CupertinoUserInterfaceLevel] that indicates [CupertinoUserInterfaceLevelData.base]. /// - has a [CupertinoUserInterfaceLevel] that indicates [CupertinoUserInterfaceLevelData.base].
Color get color => _colorMap[Brightness.light.index] final Color color;
[0] // 0 for normal contrast.
[CupertinoUserInterfaceLevelData.base.index];
/// The color to use when the [BuildContext] implies a combination of dark mode, /// The color to use when the [BuildContext] implies a combination of dark mode,
/// normal contrast, and base interface elevation. /// normal contrast, and base interface elevation.
...@@ -243,9 +254,7 @@ class CupertinoDynamicColor extends Color { ...@@ -243,9 +254,7 @@ class CupertinoDynamicColor extends Color {
/// or a [MediaQuery] whose [MediaQueryData.platformBrightness] is [PlatformBrightness.dark]. /// or a [MediaQuery] whose [MediaQueryData.platformBrightness] is [PlatformBrightness.dark].
/// - has a [MediaQuery] whose [MediaQueryData.highContrast] is `false`. /// - has a [MediaQuery] whose [MediaQueryData.highContrast] is `false`.
/// - has a [CupertinoUserInterfaceLevel] that indicates [CupertinoUserInterfaceLevelData.base]. /// - has a [CupertinoUserInterfaceLevel] that indicates [CupertinoUserInterfaceLevelData.base].
Color get darkColor => _colorMap[Brightness.dark.index] final Color darkColor;
[0] // 0 for normal contrast.
[CupertinoUserInterfaceLevelData.base.index];
/// The color to use when the [BuildContext] implies a combination of light mode, /// The color to use when the [BuildContext] implies a combination of light mode,
/// high contrast, and base interface elevation. /// high contrast, and base interface elevation.
...@@ -256,9 +265,7 @@ class CupertinoDynamicColor extends Color { ...@@ -256,9 +265,7 @@ class CupertinoDynamicColor extends Color {
/// or a [MediaQuery] whose [MediaQueryData.platformBrightness] is [PlatformBrightness.light]. /// or a [MediaQuery] whose [MediaQueryData.platformBrightness] is [PlatformBrightness.light].
/// - has a [MediaQuery] whose [MediaQueryData.highContrast] is `true`. /// - has a [MediaQuery] whose [MediaQueryData.highContrast] is `true`.
/// - has a [CupertinoUserInterfaceLevel] that indicates [CupertinoUserInterfaceLevelData.base]. /// - has a [CupertinoUserInterfaceLevel] that indicates [CupertinoUserInterfaceLevelData.base].
Color get highContrastColor => _colorMap[Brightness.light.index] final Color highContrastColor;
[1] // 1 for high contrast.
[CupertinoUserInterfaceLevelData.base.index];
/// The color to use when the [BuildContext] implies a combination of dark mode, /// The color to use when the [BuildContext] implies a combination of dark mode,
/// high contrast, and base interface elevation. /// high contrast, and base interface elevation.
...@@ -269,9 +276,7 @@ class CupertinoDynamicColor extends Color { ...@@ -269,9 +276,7 @@ class CupertinoDynamicColor extends Color {
/// or a [MediaQuery] whose [MediaQueryData.platformBrightness] is [PlatformBrightness.dark]. /// or a [MediaQuery] whose [MediaQueryData.platformBrightness] is [PlatformBrightness.dark].
/// - has a [MediaQuery] whose [MediaQueryData.highContrast] is `true`. /// - has a [MediaQuery] whose [MediaQueryData.highContrast] is `true`.
/// - has a [CupertinoUserInterfaceLevel] that indicates [CupertinoUserInterfaceLevelData.base]. /// - has a [CupertinoUserInterfaceLevel] that indicates [CupertinoUserInterfaceLevelData.base].
Color get darkHighContrastColor => _colorMap[Brightness.dark.index] final Color darkHighContrastColor;
[1] // 1 for high contrast.
[CupertinoUserInterfaceLevelData.base.index];
/// The color to use when the [BuildContext] implies a combination of light mode, /// The color to use when the [BuildContext] implies a combination of light mode,
/// normal contrast, and elevated interface elevation. /// normal contrast, and elevated interface elevation.
...@@ -282,9 +287,7 @@ class CupertinoDynamicColor extends Color { ...@@ -282,9 +287,7 @@ class CupertinoDynamicColor extends Color {
/// or a [MediaQuery] whose [MediaQueryData.platformBrightness] is [PlatformBrightness.light]. /// or a [MediaQuery] whose [MediaQueryData.platformBrightness] is [PlatformBrightness.light].
/// - has a [MediaQuery] whose [MediaQueryData.highContrast] is `false`. /// - has a [MediaQuery] whose [MediaQueryData.highContrast] is `false`.
/// - has a [CupertinoUserInterfaceLevel] that indicates [CupertinoUserInterfaceLevelData.elevated]. /// - has a [CupertinoUserInterfaceLevel] that indicates [CupertinoUserInterfaceLevelData.elevated].
Color get elevatedColor => _colorMap [Brightness.light.index] final Color elevatedColor;
[0] // 0 for normal contrast.
[CupertinoUserInterfaceLevelData.elevated.index];
/// The color to use when the [BuildContext] implies a combination of dark mode, /// The color to use when the [BuildContext] implies a combination of dark mode,
/// normal contrast, and elevated interface elevation. /// normal contrast, and elevated interface elevation.
...@@ -295,9 +298,7 @@ class CupertinoDynamicColor extends Color { ...@@ -295,9 +298,7 @@ class CupertinoDynamicColor extends Color {
/// or a [MediaQuery] whose [MediaQueryData.platformBrightness] is [PlatformBrightness.dark]. /// or a [MediaQuery] whose [MediaQueryData.platformBrightness] is [PlatformBrightness.dark].
/// - has a [MediaQuery] whose [MediaQueryData.highContrast] is `false`. /// - has a [MediaQuery] whose [MediaQueryData.highContrast] is `false`.
/// - has a [CupertinoUserInterfaceLevel] that indicates [CupertinoUserInterfaceLevelData.elevated]. /// - has a [CupertinoUserInterfaceLevel] that indicates [CupertinoUserInterfaceLevelData.elevated].
Color get darkElevatedColor => _colorMap[Brightness.dark.index] final Color darkElevatedColor;
[0] // 0 for normal contrast.
[CupertinoUserInterfaceLevelData.elevated.index];
/// The color to use when the [BuildContext] implies a combination of light mode, /// The color to use when the [BuildContext] implies a combination of light mode,
/// high contrast, and elevated interface elevation. /// high contrast, and elevated interface elevation.
...@@ -308,9 +309,7 @@ class CupertinoDynamicColor extends Color { ...@@ -308,9 +309,7 @@ class CupertinoDynamicColor extends Color {
/// or a [MediaQuery] whose [MediaQueryData.platformBrightness] is [PlatformBrightness.light]. /// or a [MediaQuery] whose [MediaQueryData.platformBrightness] is [PlatformBrightness.light].
/// - has a [MediaQuery] whose [MediaQueryData.highContrast] is `true`. /// - has a [MediaQuery] whose [MediaQueryData.highContrast] is `true`.
/// - has a [CupertinoUserInterfaceLevel] that indicates [CupertinoUserInterfaceLevelData.elevated]. /// - has a [CupertinoUserInterfaceLevel] that indicates [CupertinoUserInterfaceLevelData.elevated].
Color get highContrastElevatedColor => _colorMap[Brightness.light.index] final Color highContrastElevatedColor;
[1] // 1 for high contrast.
[CupertinoUserInterfaceLevelData.elevated.index];
/// The color to use when the [BuildContext] implies a combination of dark mode, /// The color to use when the [BuildContext] implies a combination of dark mode,
/// high contrast, and elevated interface elevation. /// high contrast, and elevated interface elevation.
...@@ -321,11 +320,7 @@ class CupertinoDynamicColor extends Color { ...@@ -321,11 +320,7 @@ class CupertinoDynamicColor extends Color {
/// or a [MediaQuery] whose [MediaQueryData.platformBrightness] is [PlatformBrightness.dark]. /// or a [MediaQuery] whose [MediaQueryData.platformBrightness] is [PlatformBrightness.dark].
/// - has a [MediaQuery] whose [MediaQueryData.highContrast] is `true`. /// - has a [MediaQuery] whose [MediaQueryData.highContrast] is `true`.
/// - has a [CupertinoUserInterfaceLevel] that indicates [CupertinoUserInterfaceLevelData.elevated]. /// - has a [CupertinoUserInterfaceLevel] that indicates [CupertinoUserInterfaceLevelData.elevated].
Color get darkHighContrastElevatedColor => _colorMap[Brightness.dark.index] final Color darkHighContrastElevatedColor;
[1] // 1 for high contrast.
[CupertinoUserInterfaceLevelData.elevated.index];
final List<List<List<Color>>> _colorMap;
/// Resolves the given [Color] by calling [resolveFrom]. /// Resolves the given [Color] by calling [resolveFrom].
/// ///
...@@ -388,34 +383,53 @@ class CupertinoDynamicColor extends Color { ...@@ -388,34 +383,53 @@ class CupertinoDynamicColor extends Color {
/// If any of the required dependecies are missing from the given context, an exception /// If any of the required dependecies are missing from the given context, an exception
/// will be thrown unless [nullOk] is set to `true`. /// will be thrown unless [nullOk] is set to `true`.
CupertinoDynamicColor resolveFrom(BuildContext context, { bool nullOk = false }) { CupertinoDynamicColor resolveFrom(BuildContext context, { bool nullOk = false }) {
int brightnessNumber = 0; final Brightness brightness = _isPlatformBrightnessDependent
int highContrastNumber = 0; ? CupertinoTheme.brightnessOf(context, nullOk: nullOk) ?? Brightness.light
int interfaceElevationNumber = 0; : Brightness.light;
// If this CupertinoDynamicColor cares about brightness. final bool isHighContrastEnabled = _isHighContrastDependent
if (_isPlatformBrightnessDependent) { && (MediaQuery.of(context, nullOk: nullOk)?.highContrast ?? false);
final Brightness brightness = CupertinoTheme.brightnessOf(context, nullOk: nullOk) ?? Brightness.light;
brightnessNumber = brightness.index;
final CupertinoUserInterfaceLevelData level = _isInterfaceElevationDependent
? CupertinoUserInterfaceLevel.of(context, nullOk: nullOk) ?? CupertinoUserInterfaceLevelData.base
: CupertinoUserInterfaceLevelData.base;
Color resolved;
switch (brightness) {
case Brightness.light:
switch (level) {
case CupertinoUserInterfaceLevelData.base:
resolved = isHighContrastEnabled ? highContrastColor : color;
break;
case CupertinoUserInterfaceLevelData.elevated:
resolved = isHighContrastEnabled ? highContrastElevatedColor : elevatedColor;
break;
} }
break;
// If this CupertinoDynamicColor cares about accessibility contrast. case Brightness.dark:
if (_isHighContrastDependent) { switch (level) {
final bool isHighContrastEnabled = MediaQuery.of(context, nullOk: nullOk)?.highContrast case CupertinoUserInterfaceLevelData.base:
?? false; resolved = isHighContrastEnabled ? darkHighContrastColor : darkColor;
break;
highContrastNumber = isHighContrastEnabled ? 1 : 0; case CupertinoUserInterfaceLevelData.elevated:
resolved = isHighContrastEnabled ? darkHighContrastElevatedColor : darkElevatedColor;
break;
} }
// If this CupertinoDynamicColor cares about user interface elevation.
if (_isInterfaceElevationDependent) {
final CupertinoUserInterfaceLevelData level = CupertinoUserInterfaceLevel.of(context, nullOk: nullOk)
?? CupertinoUserInterfaceLevelData.base;
interfaceElevationNumber = level.index;
} }
final Color resolved = _colorMap[brightnessNumber][highContrastNumber][interfaceElevationNumber]; assert(resolved != null);
return resolved.value == value ? this : CupertinoDynamicColor._(resolved, _colorMap); return CupertinoDynamicColor._(
resolved,
color,
darkColor,
highContrastColor,
darkHighContrastColor,
elevatedColor,
darkElevatedColor,
highContrastElevatedColor,
darkHighContrastElevatedColor,
);
} }
@override @override
...@@ -425,7 +439,14 @@ class CupertinoDynamicColor extends Color { ...@@ -425,7 +439,14 @@ class CupertinoDynamicColor extends Color {
return other.runtimeType == runtimeType return other.runtimeType == runtimeType
&& value == other.value && value == other.value
&& (identical(_colorMap, other._colorMap) || const DeepCollectionEquality().equals(_colorMap, other._colorMap)); && color == other.color
&& darkColor == other.darkColor
&& highContrastColor == other.highContrastColor
&& darkHighContrastColor == other.darkHighContrastColor
&& elevatedColor == other.elevatedColor
&& darkElevatedColor == other.darkElevatedColor
&& highContrastElevatedColor == other.highContrastElevatedColor
&& darkHighContrastElevatedColor == other.darkHighContrastElevatedColor;
} }
@override @override
...@@ -924,285 +945,282 @@ class CupertinoSystemColors extends InheritedWidget { ...@@ -924,285 +945,282 @@ class CupertinoSystemColors extends InheritedWidget {
assert(context != null); assert(context != null);
assert(useFallbackValues != null); assert(useFallbackValues != null);
final CupertinoSystemColors widget = context.inheritFromWidgetOfExactType(CupertinoSystemColors); final CupertinoSystemColors widget = context.inheritFromWidgetOfExactType(CupertinoSystemColors);
return widget?._data ?? (useFallbackValues ? fallbackValues : null); return widget?._data ?? (useFallbackValues ? _kSystemColorsFallback : null);
} }
}
/// Fallback System Colors, extracted from: // Fallback System Colors, extracted from:
/// https://developer.apple.com/design/human-interface-guidelines/ios/visual-design/color/#dynamic-system-colors // https://developer.apple.com/design/human-interface-guidelines/ios/visual-design/color/#dynamic-system-colors
/// and iOS 13 beta. // and iOS 13 beta.
@visibleForTesting const CupertinoSystemColorsData _kSystemColorsFallback = CupertinoSystemColorsData(
static CupertinoSystemColorsData get fallbackValues {
return CupertinoSystemColorsData(
label: CupertinoDynamicColor( label: CupertinoDynamicColor(
color: const Color.fromARGB(255, 0, 0, 0), color: Color.fromARGB(255, 0, 0, 0),
darkColor: const Color.fromARGB(255, 255, 255, 255), darkColor: Color.fromARGB(255, 255, 255, 255),
highContrastColor: const Color.fromARGB(255, 0, 0, 0), highContrastColor: Color.fromARGB(255, 0, 0, 0),
darkHighContrastColor: const Color.fromARGB(255, 255, 255, 255), darkHighContrastColor: Color.fromARGB(255, 255, 255, 255),
elevatedColor: const Color.fromARGB(255, 0, 0, 0), elevatedColor: Color.fromARGB(255, 0, 0, 0),
darkElevatedColor: const Color.fromARGB(255, 255, 255, 255), darkElevatedColor: Color.fromARGB(255, 255, 255, 255),
highContrastElevatedColor: const Color.fromARGB(255, 0, 0, 0), highContrastElevatedColor: Color.fromARGB(255, 0, 0, 0),
darkHighContrastElevatedColor: const Color.fromARGB(255, 255, 255, 255), darkHighContrastElevatedColor: Color.fromARGB(255, 255, 255, 255),
), ),
secondaryLabel: CupertinoDynamicColor( secondaryLabel: CupertinoDynamicColor(
color: const Color.fromARGB(255, 0, 0, 0), color: Color.fromARGB(255, 0, 0, 0),
darkColor: const Color.fromARGB(255, 255, 255, 255), darkColor: Color.fromARGB(255, 255, 255, 255),
highContrastColor: const Color.fromARGB(255, 0, 0, 0), highContrastColor: Color.fromARGB(255, 0, 0, 0),
darkHighContrastColor: const Color.fromARGB(255, 255, 255, 255), darkHighContrastColor: Color.fromARGB(255, 255, 255, 255),
elevatedColor: const Color.fromARGB(255, 0, 0, 0), elevatedColor: Color.fromARGB(255, 0, 0, 0),
darkElevatedColor: const Color.fromARGB(255, 255, 255, 255), darkElevatedColor: Color.fromARGB(255, 255, 255, 255),
highContrastElevatedColor: const Color.fromARGB(255, 0, 0, 0), highContrastElevatedColor: Color.fromARGB(255, 0, 0, 0),
darkHighContrastElevatedColor: const Color.fromARGB(255, 255, 255, 255), darkHighContrastElevatedColor: Color.fromARGB(255, 255, 255, 255),
), ),
tertiaryLabel: CupertinoDynamicColor( tertiaryLabel: CupertinoDynamicColor(
color: const Color.fromARGB(76, 60, 60, 67), color: Color.fromARGB(76, 60, 60, 67),
darkColor: const Color.fromARGB(76, 235, 235, 245), darkColor: Color.fromARGB(76, 235, 235, 245),
highContrastColor: const Color.fromARGB(96, 60, 60, 67), highContrastColor: Color.fromARGB(96, 60, 60, 67),
darkHighContrastColor: const Color.fromARGB(96, 235, 235, 245), darkHighContrastColor: Color.fromARGB(96, 235, 235, 245),
elevatedColor: const Color.fromARGB(76, 60, 60, 67), elevatedColor: Color.fromARGB(76, 60, 60, 67),
darkElevatedColor: const Color.fromARGB(76, 235, 235, 245), darkElevatedColor: Color.fromARGB(76, 235, 235, 245),
highContrastElevatedColor: const Color.fromARGB(96, 60, 60, 67), highContrastElevatedColor: Color.fromARGB(96, 60, 60, 67),
darkHighContrastElevatedColor: const Color.fromARGB(96, 235, 235, 245), darkHighContrastElevatedColor: Color.fromARGB(96, 235, 235, 245),
), ),
quaternaryLabel: CupertinoDynamicColor( quaternaryLabel: CupertinoDynamicColor(
color: const Color.fromARGB(45, 60, 60, 67), color: Color.fromARGB(45, 60, 60, 67),
darkColor: const Color.fromARGB(40, 235, 235, 245), darkColor: Color.fromARGB(40, 235, 235, 245),
highContrastColor: const Color.fromARGB(66, 60, 60, 67), highContrastColor: Color.fromARGB(66, 60, 60, 67),
darkHighContrastColor: const Color.fromARGB(61, 235, 235, 245), darkHighContrastColor: Color.fromARGB(61, 235, 235, 245),
elevatedColor: const Color.fromARGB(45, 60, 60, 67), elevatedColor: Color.fromARGB(45, 60, 60, 67),
darkElevatedColor: const Color.fromARGB(40, 235, 235, 245), darkElevatedColor: Color.fromARGB(40, 235, 235, 245),
highContrastElevatedColor: const Color.fromARGB(66, 60, 60, 67), highContrastElevatedColor: Color.fromARGB(66, 60, 60, 67),
darkHighContrastElevatedColor: const Color.fromARGB(61, 235, 235, 245), darkHighContrastElevatedColor: Color.fromARGB(61, 235, 235, 245),
), ),
systemFill: CupertinoDynamicColor( systemFill: CupertinoDynamicColor(
color: const Color.fromARGB(51, 120, 120, 128), color: Color.fromARGB(51, 120, 120, 128),
darkColor: const Color.fromARGB(91, 120, 120, 128), darkColor: Color.fromARGB(91, 120, 120, 128),
highContrastColor: const Color.fromARGB(71, 120, 120, 128), highContrastColor: Color.fromARGB(71, 120, 120, 128),
darkHighContrastColor: const Color.fromARGB(112, 120, 120, 128), darkHighContrastColor: Color.fromARGB(112, 120, 120, 128),
elevatedColor: const Color.fromARGB(51, 120, 120, 128), elevatedColor: Color.fromARGB(51, 120, 120, 128),
darkElevatedColor: const Color.fromARGB(91, 120, 120, 128), darkElevatedColor: Color.fromARGB(91, 120, 120, 128),
highContrastElevatedColor: const Color.fromARGB(71, 120, 120, 128), highContrastElevatedColor: Color.fromARGB(71, 120, 120, 128),
darkHighContrastElevatedColor: const Color.fromARGB(112, 120, 120, 128), darkHighContrastElevatedColor: Color.fromARGB(112, 120, 120, 128),
), ),
secondarySystemFill: CupertinoDynamicColor( secondarySystemFill: CupertinoDynamicColor(
color: const Color.fromARGB(153, 60, 60, 67), color: Color.fromARGB(153, 60, 60, 67),
darkColor: const Color.fromARGB(153, 235, 235, 245), darkColor: Color.fromARGB(153, 235, 235, 245),
highContrastColor: const Color.fromARGB(173, 60, 60, 67), highContrastColor: Color.fromARGB(173, 60, 60, 67),
darkHighContrastColor: const Color.fromARGB(173, 235, 235, 245), darkHighContrastColor: Color.fromARGB(173, 235, 235, 245),
elevatedColor: const Color.fromARGB(153, 60, 60, 67), elevatedColor: Color.fromARGB(153, 60, 60, 67),
darkElevatedColor: const Color.fromARGB(153, 235, 235, 245), darkElevatedColor: Color.fromARGB(153, 235, 235, 245),
highContrastElevatedColor: const Color.fromARGB(173, 60, 60, 67), highContrastElevatedColor: Color.fromARGB(173, 60, 60, 67),
darkHighContrastElevatedColor: const Color.fromARGB(173, 235, 235, 245), darkHighContrastElevatedColor: Color.fromARGB(173, 235, 235, 245),
), ),
tertiarySystemFill: CupertinoDynamicColor( tertiarySystemFill: CupertinoDynamicColor(
color: const Color.fromARGB(30, 118, 118, 128), color: Color.fromARGB(30, 118, 118, 128),
darkColor: const Color.fromARGB(61, 118, 118, 128), darkColor: Color.fromARGB(61, 118, 118, 128),
highContrastColor: const Color.fromARGB(51, 118, 118, 128), highContrastColor: Color.fromARGB(51, 118, 118, 128),
darkHighContrastColor: const Color.fromARGB(81, 118, 118, 128), darkHighContrastColor: Color.fromARGB(81, 118, 118, 128),
elevatedColor: const Color.fromARGB(30, 118, 118, 128), elevatedColor: Color.fromARGB(30, 118, 118, 128),
darkElevatedColor: const Color.fromARGB(61, 118, 118, 128), darkElevatedColor: Color.fromARGB(61, 118, 118, 128),
highContrastElevatedColor: const Color.fromARGB(51, 118, 118, 128), highContrastElevatedColor: Color.fromARGB(51, 118, 118, 128),
darkHighContrastElevatedColor: const Color.fromARGB(81, 118, 118, 128), darkHighContrastElevatedColor: Color.fromARGB(81, 118, 118, 128),
), ),
quaternarySystemFill: CupertinoDynamicColor( quaternarySystemFill: CupertinoDynamicColor(
color: const Color.fromARGB(20, 116, 116, 128), color: Color.fromARGB(20, 116, 116, 128),
darkColor: const Color.fromARGB(45, 118, 118, 128), darkColor: Color.fromARGB(45, 118, 118, 128),
highContrastColor: const Color.fromARGB(40, 116, 116, 128), highContrastColor: Color.fromARGB(40, 116, 116, 128),
darkHighContrastColor: const Color.fromARGB(66, 118, 118, 128), darkHighContrastColor: Color.fromARGB(66, 118, 118, 128),
elevatedColor: const Color.fromARGB(20, 116, 116, 128), elevatedColor: Color.fromARGB(20, 116, 116, 128),
darkElevatedColor: const Color.fromARGB(45, 118, 118, 128), darkElevatedColor: Color.fromARGB(45, 118, 118, 128),
highContrastElevatedColor: const Color.fromARGB(40, 116, 116, 128), highContrastElevatedColor: Color.fromARGB(40, 116, 116, 128),
darkHighContrastElevatedColor: const Color.fromARGB(66, 118, 118, 128), darkHighContrastElevatedColor: Color.fromARGB(66, 118, 118, 128),
), ),
placeholderText: CupertinoDynamicColor( placeholderText: CupertinoDynamicColor(
color: const Color.fromARGB(76, 60, 60, 67), color: Color.fromARGB(76, 60, 60, 67),
darkColor: const Color.fromARGB(76, 235, 235, 245), darkColor: Color.fromARGB(76, 235, 235, 245),
highContrastColor: const Color.fromARGB(96, 60, 60, 67), highContrastColor: Color.fromARGB(96, 60, 60, 67),
darkHighContrastColor: const Color.fromARGB(96, 235, 235, 245), darkHighContrastColor: Color.fromARGB(96, 235, 235, 245),
elevatedColor: const Color.fromARGB(76, 60, 60, 67), elevatedColor: Color.fromARGB(76, 60, 60, 67),
darkElevatedColor: const Color.fromARGB(76, 235, 235, 245), darkElevatedColor: Color.fromARGB(76, 235, 235, 245),
highContrastElevatedColor: const Color.fromARGB(96, 60, 60, 67), highContrastElevatedColor: Color.fromARGB(96, 60, 60, 67),
darkHighContrastElevatedColor: const Color.fromARGB(96, 235, 235, 245), darkHighContrastElevatedColor: Color.fromARGB(96, 235, 235, 245),
), ),
systemBackground: CupertinoDynamicColor( systemBackground: CupertinoDynamicColor(
color: const Color.fromARGB(255, 255, 255, 255), color: Color.fromARGB(255, 255, 255, 255),
darkColor: const Color.fromARGB(255, 0, 0, 0), darkColor: Color.fromARGB(255, 0, 0, 0),
highContrastColor: const Color.fromARGB(255, 255, 255, 255), highContrastColor: Color.fromARGB(255, 255, 255, 255),
darkHighContrastColor: const Color.fromARGB(255, 0, 0, 0), darkHighContrastColor: Color.fromARGB(255, 0, 0, 0),
elevatedColor: const Color.fromARGB(255, 255, 255, 255), elevatedColor: Color.fromARGB(255, 255, 255, 255),
darkElevatedColor: const Color.fromARGB(255, 28, 28, 30), darkElevatedColor: Color.fromARGB(255, 28, 28, 30),
highContrastElevatedColor: const Color.fromARGB(255, 255, 255, 255), highContrastElevatedColor: Color.fromARGB(255, 255, 255, 255),
darkHighContrastElevatedColor: const Color.fromARGB(255, 36, 36, 38), darkHighContrastElevatedColor: Color.fromARGB(255, 36, 36, 38),
), ),
secondarySystemBackground: CupertinoDynamicColor( secondarySystemBackground: CupertinoDynamicColor(
color: const Color.fromARGB(255, 242, 242, 247), color: Color.fromARGB(255, 242, 242, 247),
darkColor: const Color.fromARGB(255, 28, 28, 30), darkColor: Color.fromARGB(255, 28, 28, 30),
highContrastColor: const Color.fromARGB(255, 235, 235, 240), highContrastColor: Color.fromARGB(255, 235, 235, 240),
darkHighContrastColor: const Color.fromARGB(255, 36, 36, 38), darkHighContrastColor: Color.fromARGB(255, 36, 36, 38),
elevatedColor: const Color.fromARGB(255, 242, 242, 247), elevatedColor: Color.fromARGB(255, 242, 242, 247),
darkElevatedColor: const Color.fromARGB(255, 44, 44, 46), darkElevatedColor: Color.fromARGB(255, 44, 44, 46),
highContrastElevatedColor: const Color.fromARGB(255, 235, 235, 240), highContrastElevatedColor: Color.fromARGB(255, 235, 235, 240),
darkHighContrastElevatedColor: const Color.fromARGB(255, 54, 54, 56), darkHighContrastElevatedColor: Color.fromARGB(255, 54, 54, 56),
), ),
tertiarySystemBackground: CupertinoDynamicColor( tertiarySystemBackground: CupertinoDynamicColor(
color: const Color.fromARGB(255, 255, 255, 255), color: Color.fromARGB(255, 255, 255, 255),
darkColor: const Color.fromARGB(255, 44, 44, 46), darkColor: Color.fromARGB(255, 44, 44, 46),
highContrastColor: const Color.fromARGB(255, 255, 255, 255), highContrastColor: Color.fromARGB(255, 255, 255, 255),
darkHighContrastColor: const Color.fromARGB(255, 54, 54, 56), darkHighContrastColor: Color.fromARGB(255, 54, 54, 56),
elevatedColor: const Color.fromARGB(255, 255, 255, 255), elevatedColor: Color.fromARGB(255, 255, 255, 255),
darkElevatedColor: const Color.fromARGB(255, 58, 58, 60), darkElevatedColor: Color.fromARGB(255, 58, 58, 60),
highContrastElevatedColor: const Color.fromARGB(255, 255, 255, 255), highContrastElevatedColor: Color.fromARGB(255, 255, 255, 255),
darkHighContrastElevatedColor: const Color.fromARGB(255, 68, 68, 70), darkHighContrastElevatedColor: Color.fromARGB(255, 68, 68, 70),
), ),
systemGroupedBackground: CupertinoDynamicColor( systemGroupedBackground: CupertinoDynamicColor(
color: const Color.fromARGB(255, 242, 242, 247), color: Color.fromARGB(255, 242, 242, 247),
darkColor: const Color.fromARGB(255, 0, 0, 0), darkColor: Color.fromARGB(255, 0, 0, 0),
highContrastColor: const Color.fromARGB(255, 235, 235, 240), highContrastColor: Color.fromARGB(255, 235, 235, 240),
darkHighContrastColor: const Color.fromARGB(255, 0, 0, 0), darkHighContrastColor: Color.fromARGB(255, 0, 0, 0),
elevatedColor: const Color.fromARGB(255, 242, 242, 247), elevatedColor: Color.fromARGB(255, 242, 242, 247),
darkElevatedColor: const Color.fromARGB(255, 28, 28, 30), darkElevatedColor: Color.fromARGB(255, 28, 28, 30),
highContrastElevatedColor: const Color.fromARGB(255, 235, 235, 240), highContrastElevatedColor: Color.fromARGB(255, 235, 235, 240),
darkHighContrastElevatedColor: const Color.fromARGB(255, 36, 36, 38), darkHighContrastElevatedColor: Color.fromARGB(255, 36, 36, 38),
), ),
secondarySystemGroupedBackground: CupertinoDynamicColor( secondarySystemGroupedBackground: CupertinoDynamicColor(
color: const Color.fromARGB(255, 242, 242, 247), color: Color.fromARGB(255, 242, 242, 247),
darkColor: const Color.fromARGB(255, 0, 0, 0), darkColor: Color.fromARGB(255, 0, 0, 0),
highContrastColor: const Color.fromARGB(255, 235, 235, 240), highContrastColor: Color.fromARGB(255, 235, 235, 240),
darkHighContrastColor: const Color.fromARGB(255, 0, 0, 0), darkHighContrastColor: Color.fromARGB(255, 0, 0, 0),
elevatedColor: const Color.fromARGB(255, 242, 242, 247), elevatedColor: Color.fromARGB(255, 242, 242, 247),
darkElevatedColor: const Color.fromARGB(255, 28, 28, 30), darkElevatedColor: Color.fromARGB(255, 28, 28, 30),
highContrastElevatedColor: const Color.fromARGB(255, 235, 235, 240), highContrastElevatedColor: Color.fromARGB(255, 235, 235, 240),
darkHighContrastElevatedColor: const Color.fromARGB(255, 36, 36, 38), darkHighContrastElevatedColor: Color.fromARGB(255, 36, 36, 38),
), ),
tertiarySystemGroupedBackground: CupertinoDynamicColor( tertiarySystemGroupedBackground: CupertinoDynamicColor(
color: const Color.fromARGB(255, 242, 242, 247), color: Color.fromARGB(255, 242, 242, 247),
darkColor: const Color.fromARGB(255, 44, 44, 46), darkColor: Color.fromARGB(255, 44, 44, 46),
highContrastColor: const Color.fromARGB(255, 235, 235, 240), highContrastColor: Color.fromARGB(255, 235, 235, 240),
darkHighContrastColor: const Color.fromARGB(255, 54, 54, 56), darkHighContrastColor: Color.fromARGB(255, 54, 54, 56),
elevatedColor: const Color.fromARGB(255, 242, 242, 247), elevatedColor: Color.fromARGB(255, 242, 242, 247),
darkElevatedColor: const Color.fromARGB(255, 58, 58, 60), darkElevatedColor: Color.fromARGB(255, 58, 58, 60),
highContrastElevatedColor: const Color.fromARGB(255, 235, 235, 240), highContrastElevatedColor: Color.fromARGB(255, 235, 235, 240),
darkHighContrastElevatedColor: const Color.fromARGB(255, 68, 68, 70), darkHighContrastElevatedColor: Color.fromARGB(255, 68, 68, 70),
), ),
separator: CupertinoDynamicColor( separator: CupertinoDynamicColor(
color: const Color.fromARGB(73, 60, 60, 67), color: Color.fromARGB(73, 60, 60, 67),
darkColor: const Color.fromARGB(153, 84, 84, 88), darkColor: Color.fromARGB(153, 84, 84, 88),
highContrastColor: const Color.fromARGB(94, 60, 60, 67), highContrastColor: Color.fromARGB(94, 60, 60, 67),
darkHighContrastColor: const Color.fromARGB(173, 84, 84, 88), darkHighContrastColor: Color.fromARGB(173, 84, 84, 88),
elevatedColor: const Color.fromARGB(73, 60, 60, 67), elevatedColor: Color.fromARGB(73, 60, 60, 67),
darkElevatedColor: const Color.fromARGB(153, 84, 84, 88), darkElevatedColor: Color.fromARGB(153, 84, 84, 88),
highContrastElevatedColor: const Color.fromARGB(94, 60, 60, 67), highContrastElevatedColor: Color.fromARGB(94, 60, 60, 67),
darkHighContrastElevatedColor: const Color.fromARGB(173, 84, 84, 88), darkHighContrastElevatedColor: Color.fromARGB(173, 84, 84, 88),
), ),
opaqueSeparator: CupertinoDynamicColor( opaqueSeparator: CupertinoDynamicColor(
color: const Color.fromARGB(255, 198, 198, 200), color: Color.fromARGB(255, 198, 198, 200),
darkColor: const Color.fromARGB(255, 56, 56, 58), darkColor: Color.fromARGB(255, 56, 56, 58),
highContrastColor: const Color.fromARGB(255, 198, 198, 200), highContrastColor: Color.fromARGB(255, 198, 198, 200),
darkHighContrastColor: const Color.fromARGB(255, 56, 56, 58), darkHighContrastColor: Color.fromARGB(255, 56, 56, 58),
elevatedColor: const Color.fromARGB(255, 198, 198, 200), elevatedColor: Color.fromARGB(255, 198, 198, 200),
darkElevatedColor: const Color.fromARGB(255, 56, 56, 58), darkElevatedColor: Color.fromARGB(255, 56, 56, 58),
highContrastElevatedColor: const Color.fromARGB(255, 198, 198, 200), highContrastElevatedColor: Color.fromARGB(255, 198, 198, 200),
darkHighContrastElevatedColor: const Color.fromARGB(255, 56, 56, 58), darkHighContrastElevatedColor: Color.fromARGB(255, 56, 56, 58),
), ),
link: CupertinoDynamicColor( link: CupertinoDynamicColor(
color: const Color.fromARGB(255, 0, 122, 255), color: Color.fromARGB(255, 0, 122, 255),
darkColor: const Color.fromARGB(255, 9, 132, 255), darkColor: Color.fromARGB(255, 9, 132, 255),
highContrastColor: const Color.fromARGB(255, 0, 122, 255), highContrastColor: Color.fromARGB(255, 0, 122, 255),
darkHighContrastColor: const Color.fromARGB(255, 9, 132, 255), darkHighContrastColor: Color.fromARGB(255, 9, 132, 255),
elevatedColor: const Color.fromARGB(255, 0, 122, 255), elevatedColor: Color.fromARGB(255, 0, 122, 255),
darkElevatedColor: const Color.fromARGB(255, 9, 132, 255), darkElevatedColor: Color.fromARGB(255, 9, 132, 255),
highContrastElevatedColor: const Color.fromARGB(255, 0, 122, 255), highContrastElevatedColor: Color.fromARGB(255, 0, 122, 255),
darkHighContrastElevatedColor: const Color.fromARGB(255, 9, 132, 255), darkHighContrastElevatedColor: Color.fromARGB(255, 9, 132, 255),
), ),
systemBlue: CupertinoDynamicColor.withBrightnessAndContrast( systemBlue: CupertinoDynamicColor.withBrightnessAndContrast(
color: const Color.fromARGB(255, 0, 122, 255), color: Color.fromARGB(255, 0, 122, 255),
darkColor: const Color.fromARGB(255, 10, 132, 255), darkColor: Color.fromARGB(255, 10, 132, 255),
highContrastColor: const Color.fromARGB(255, 0, 64, 221), highContrastColor: Color.fromARGB(255, 0, 64, 221),
darkHighContrastColor: const Color.fromARGB(255, 64, 156, 255), darkHighContrastColor: Color.fromARGB(255, 64, 156, 255),
), ),
systemGreen: CupertinoDynamicColor.withBrightnessAndContrast( systemGreen: CupertinoDynamicColor.withBrightnessAndContrast(
color: const Color.fromARGB(255, 52, 199, 89), color: Color.fromARGB(255, 52, 199, 89),
darkColor: const Color.fromARGB(255, 48, 209, 88), darkColor: Color.fromARGB(255, 48, 209, 88),
highContrastColor: const Color.fromARGB(255, 36, 138, 61), highContrastColor: Color.fromARGB(255, 36, 138, 61),
darkHighContrastColor: const Color.fromARGB(255, 48, 219, 91), darkHighContrastColor: Color.fromARGB(255, 48, 219, 91),
), ),
systemIndigo: CupertinoDynamicColor.withBrightnessAndContrast( systemIndigo: CupertinoDynamicColor.withBrightnessAndContrast(
color: const Color.fromARGB(255, 88, 86, 214), color: Color.fromARGB(255, 88, 86, 214),
darkColor: const Color.fromARGB(255, 94, 92, 230), darkColor: Color.fromARGB(255, 94, 92, 230),
highContrastColor: const Color.fromARGB(255, 54, 52, 163), highContrastColor: Color.fromARGB(255, 54, 52, 163),
darkHighContrastColor: const Color.fromARGB(255, 125, 122, 255), darkHighContrastColor: Color.fromARGB(255, 125, 122, 255),
), ),
systemOrange: CupertinoDynamicColor.withBrightnessAndContrast( systemOrange: CupertinoDynamicColor.withBrightnessAndContrast(
color: const Color.fromARGB(255, 255, 149, 0), color: Color.fromARGB(255, 255, 149, 0),
darkColor: const Color.fromARGB(255, 255, 159, 10), darkColor: Color.fromARGB(255, 255, 159, 10),
highContrastColor: const Color.fromARGB(255, 201, 52, 0), highContrastColor: Color.fromARGB(255, 201, 52, 0),
darkHighContrastColor: const Color.fromARGB(255, 255, 179, 64), darkHighContrastColor: Color.fromARGB(255, 255, 179, 64),
), ),
systemPink: CupertinoDynamicColor.withBrightnessAndContrast( systemPink: CupertinoDynamicColor.withBrightnessAndContrast(
color: const Color.fromARGB(255, 255, 45, 85), color: Color.fromARGB(255, 255, 45, 85),
darkColor: const Color.fromARGB(255, 255, 55, 95), darkColor: Color.fromARGB(255, 255, 55, 95),
highContrastColor: const Color.fromARGB(255, 211, 15, 69), highContrastColor: Color.fromARGB(255, 211, 15, 69),
darkHighContrastColor: const Color.fromARGB(255, 255, 100, 130), darkHighContrastColor: Color.fromARGB(255, 255, 100, 130),
), ),
systemPurple: CupertinoDynamicColor.withBrightnessAndContrast( systemPurple: CupertinoDynamicColor.withBrightnessAndContrast(
color: const Color.fromARGB(255, 175, 82, 222), color: Color.fromARGB(255, 175, 82, 222),
darkColor: const Color.fromARGB(255, 191, 90, 242), darkColor: Color.fromARGB(255, 191, 90, 242),
highContrastColor: const Color.fromARGB(255, 137, 68, 171), highContrastColor: Color.fromARGB(255, 137, 68, 171),
darkHighContrastColor: const Color.fromARGB(255, 218, 143, 255), darkHighContrastColor: Color.fromARGB(255, 218, 143, 255),
), ),
systemRed: CupertinoDynamicColor.withBrightnessAndContrast( systemRed: CupertinoDynamicColor.withBrightnessAndContrast(
color: const Color.fromARGB(255, 255, 59, 48), color: Color.fromARGB(255, 255, 59, 48),
darkColor: const Color.fromARGB(255, 255, 69, 58), darkColor: Color.fromARGB(255, 255, 69, 58),
highContrastColor: const Color.fromARGB(255, 215, 0, 21), highContrastColor: Color.fromARGB(255, 215, 0, 21),
darkHighContrastColor: const Color.fromARGB(255, 255, 105, 97), darkHighContrastColor: Color.fromARGB(255, 255, 105, 97),
), ),
systemTeal: CupertinoDynamicColor.withBrightnessAndContrast( systemTeal: CupertinoDynamicColor.withBrightnessAndContrast(
color: const Color.fromARGB(255, 90, 200, 250), color: Color.fromARGB(255, 90, 200, 250),
darkColor: const Color.fromARGB(255, 100, 210, 255), darkColor: Color.fromARGB(255, 100, 210, 255),
highContrastColor: const Color.fromARGB(255, 0, 113, 164), highContrastColor: Color.fromARGB(255, 0, 113, 164),
darkHighContrastColor: const Color.fromARGB(255, 112, 215, 255), darkHighContrastColor: Color.fromARGB(255, 112, 215, 255),
), ),
systemYellow: CupertinoDynamicColor.withBrightnessAndContrast( systemYellow: CupertinoDynamicColor.withBrightnessAndContrast(
color: const Color.fromARGB(255, 255, 204, 0), color: Color.fromARGB(255, 255, 204, 0),
darkColor: const Color.fromARGB(255, 255, 214, 10), darkColor: Color.fromARGB(255, 255, 214, 10),
highContrastColor: const Color.fromARGB(255, 160, 90, 0), highContrastColor: Color.fromARGB(255, 160, 90, 0),
darkHighContrastColor: const Color.fromARGB(255, 255, 212, 38), darkHighContrastColor: Color.fromARGB(255, 255, 212, 38),
), ),
systemGray: CupertinoDynamicColor.withBrightnessAndContrast( systemGray: CupertinoDynamicColor.withBrightnessAndContrast(
color: const Color.fromARGB(255, 142, 142, 147), color: Color.fromARGB(255, 142, 142, 147),
darkColor: const Color.fromARGB(255, 142, 142, 147), darkColor: Color.fromARGB(255, 142, 142, 147),
highContrastColor: const Color.fromARGB(255, 108, 108, 112), highContrastColor: Color.fromARGB(255, 108, 108, 112),
darkHighContrastColor: const Color.fromARGB(255, 174, 174, 178), darkHighContrastColor: Color.fromARGB(255, 174, 174, 178),
), ),
systemGray2: CupertinoDynamicColor.withBrightnessAndContrast( systemGray2: CupertinoDynamicColor.withBrightnessAndContrast(
color: const Color.fromARGB(255, 174, 174, 178), color: Color.fromARGB(255, 174, 174, 178),
darkColor: const Color.fromARGB(255, 99, 99, 102), darkColor: Color.fromARGB(255, 99, 99, 102),
highContrastColor: const Color.fromARGB(255, 142, 142, 147), highContrastColor: Color.fromARGB(255, 142, 142, 147),
darkHighContrastColor: const Color.fromARGB(255, 124, 124, 128), darkHighContrastColor: Color.fromARGB(255, 124, 124, 128),
), ),
systemGray3: CupertinoDynamicColor.withBrightnessAndContrast( systemGray3: CupertinoDynamicColor.withBrightnessAndContrast(
color: const Color.fromARGB(255, 199, 199, 204), color: Color.fromARGB(255, 199, 199, 204),
darkColor: const Color.fromARGB(255, 72, 72, 74), darkColor: Color.fromARGB(255, 72, 72, 74),
highContrastColor: const Color.fromARGB(255, 174, 174, 178), highContrastColor: Color.fromARGB(255, 174, 174, 178),
darkHighContrastColor: const Color.fromARGB(255, 84, 84, 86), darkHighContrastColor: Color.fromARGB(255, 84, 84, 86),
), ),
systemGray4: CupertinoDynamicColor.withBrightnessAndContrast( systemGray4: CupertinoDynamicColor.withBrightnessAndContrast(
color: const Color.fromARGB(255, 209, 209, 214), color: Color.fromARGB(255, 209, 209, 214),
darkColor: const Color.fromARGB(255, 58, 58, 60), darkColor: Color.fromARGB(255, 58, 58, 60),
highContrastColor: const Color.fromARGB(255, 188, 188, 192), highContrastColor: Color.fromARGB(255, 188, 188, 192),
darkHighContrastColor: const Color.fromARGB(255, 68, 68, 70), darkHighContrastColor: Color.fromARGB(255, 68, 68, 70),
), ),
systemGray5: CupertinoDynamicColor.withBrightnessAndContrast( systemGray5: CupertinoDynamicColor.withBrightnessAndContrast(
color: const Color.fromARGB(255, 229, 229, 234), color: Color.fromARGB(255, 229, 229, 234),
darkColor: const Color.fromARGB(255, 44, 44, 46), darkColor: Color.fromARGB(255, 44, 44, 46),
highContrastColor: const Color.fromARGB(255, 216, 216, 220), highContrastColor: Color.fromARGB(255, 216, 216, 220),
darkHighContrastColor: const Color.fromARGB(255, 54, 54, 56), darkHighContrastColor: Color.fromARGB(255, 54, 54, 56),
), ),
systemGray6: CupertinoDynamicColor.withBrightnessAndContrast( systemGray6: CupertinoDynamicColor.withBrightnessAndContrast(
color: const Color.fromARGB(255, 242, 242, 247), color: Color.fromARGB(255, 242, 242, 247),
darkColor: const Color.fromARGB(255, 28, 28, 30), darkColor: Color.fromARGB(255, 28, 28, 30),
highContrastColor: const Color.fromARGB(255, 235, 235, 240), highContrastColor: Color.fromARGB(255, 235, 235, 240),
darkHighContrastColor: const Color.fromARGB(255, 36, 36, 38), darkHighContrastColor: Color.fromARGB(255, 36, 36, 38),
), ),
); );
}
}
...@@ -38,7 +38,7 @@ const Color color7 = Color(0xFF000007); ...@@ -38,7 +38,7 @@ const Color color7 = Color(0xFF000007);
// A color that depends on color vibrancy, accessibility contrast, as well as user // A color that depends on color vibrancy, accessibility contrast, as well as user
// interface elevation. // interface elevation.
final CupertinoDynamicColor dynamicColor = CupertinoDynamicColor( const CupertinoDynamicColor dynamicColor = CupertinoDynamicColor(
color: color0, color: color0,
darkColor: color1, darkColor: color1,
elevatedColor: color2, elevatedColor: color2,
...@@ -50,7 +50,7 @@ final CupertinoDynamicColor dynamicColor = CupertinoDynamicColor( ...@@ -50,7 +50,7 @@ final CupertinoDynamicColor dynamicColor = CupertinoDynamicColor(
); );
// A color that uses [color0] in every circumstance. // A color that uses [color0] in every circumstance.
final Color notSoDynamicColor1 = CupertinoDynamicColor( const Color notSoDynamicColor1 = CupertinoDynamicColor(
color: color0, color: color0,
darkColor: color0, darkColor: color0,
darkHighContrastColor: color0, darkHighContrastColor: color0,
...@@ -62,7 +62,7 @@ final Color notSoDynamicColor1 = CupertinoDynamicColor( ...@@ -62,7 +62,7 @@ final Color notSoDynamicColor1 = CupertinoDynamicColor(
); );
// A color that uses [color1] for light mode, and [color0] for dark mode. // A color that uses [color1] for light mode, and [color0] for dark mode.
final Color vibrancyDependentColor1 = CupertinoDynamicColor( const Color vibrancyDependentColor1 = CupertinoDynamicColor(
color: color1, color: color1,
elevatedColor: color1, elevatedColor: color1,
highContrastColor: color1, highContrastColor: color1,
...@@ -75,7 +75,7 @@ final Color vibrancyDependentColor1 = CupertinoDynamicColor( ...@@ -75,7 +75,7 @@ final Color vibrancyDependentColor1 = CupertinoDynamicColor(
// A color that uses [color1] for normal contrast mode, and [color0] for high // A color that uses [color1] for normal contrast mode, and [color0] for high
// contrast mode. // contrast mode.
final Color contrastDependentColor1 = CupertinoDynamicColor( const Color contrastDependentColor1 = CupertinoDynamicColor(
color: color1, color: color1,
darkColor: color1, darkColor: color1,
elevatedColor: color1, elevatedColor: color1,
...@@ -88,7 +88,7 @@ final Color contrastDependentColor1 = CupertinoDynamicColor( ...@@ -88,7 +88,7 @@ final Color contrastDependentColor1 = CupertinoDynamicColor(
// A color that uses [color1] for base interface elevation, and [color0] for elevated // A color that uses [color1] for base interface elevation, and [color0] for elevated
// interface elevation. // interface elevation.
final Color elevationDependentColor1 = CupertinoDynamicColor( const Color elevationDependentColor1 = CupertinoDynamicColor(
color: color1, color: color1,
darkColor: color1, darkColor: color1,
highContrastColor: color1, highContrastColor: color1,
...@@ -101,7 +101,7 @@ final Color elevationDependentColor1 = CupertinoDynamicColor( ...@@ -101,7 +101,7 @@ final Color elevationDependentColor1 = CupertinoDynamicColor(
void main() { void main() {
test('== works as expected', () { test('== works as expected', () {
expect(dynamicColor, CupertinoDynamicColor( expect(dynamicColor, const CupertinoDynamicColor(
color: color0, color: color0,
darkColor: color1, darkColor: color1,
elevatedColor: color2, elevatedColor: color2,
...@@ -117,7 +117,7 @@ void main() { ...@@ -117,7 +117,7 @@ void main() {
expect(notSoDynamicColor1, isNot(contrastDependentColor1)); expect(notSoDynamicColor1, isNot(contrastDependentColor1));
expect(vibrancyDependentColor1, isNot(CupertinoDynamicColor( expect(vibrancyDependentColor1, isNot(const CupertinoDynamicColor(
color: color0, color: color0,
elevatedColor: color0, elevatedColor: color0,
highContrastColor: color0, highContrastColor: color0,
...@@ -147,7 +147,7 @@ void main() { ...@@ -147,7 +147,7 @@ void main() {
expect(elevationDependentColor1.toString(), 'CupertinoDynamicColor(*color = Color(0xff000001)*, elevatedColor = Color(0xff000000))'); expect(elevationDependentColor1.toString(), 'CupertinoDynamicColor(*color = Color(0xff000001)*, elevatedColor = Color(0xff000000))');
expect( expect(
CupertinoDynamicColor.withBrightnessAndContrast( const CupertinoDynamicColor.withBrightnessAndContrast(
color: color0, color: color0,
darkColor: color1, darkColor: color1,
highContrastColor: color2, highContrastColor: color2,
...@@ -161,21 +161,22 @@ void main() { ...@@ -161,21 +161,22 @@ void main() {
}); });
test('withVibrancy constructor creates colors that may depend on vibrancy', () { test('withVibrancy constructor creates colors that may depend on vibrancy', () {
expect(vibrancyDependentColor1, CupertinoDynamicColor.withBrightness( expect(vibrancyDependentColor1, const CupertinoDynamicColor.withBrightness(
color: color1, color: color1,
darkColor: color0, darkColor: color0,
)); ));
}); });
test('withVibrancyAndContrast constructor creates colors that may depend on contrast and vibrancy', () { test('withVibrancyAndContrast constructor creates colors that may depend on contrast and vibrancy', () {
expect(contrastDependentColor1, CupertinoDynamicColor.withBrightnessAndContrast( expect(contrastDependentColor1, const CupertinoDynamicColor.withBrightnessAndContrast(
color: color1, color: color1,
darkColor: color1, darkColor: color1,
highContrastColor: color0, highContrastColor: color0,
darkHighContrastColor: color0, darkHighContrastColor: color0,
)); ));
expect(CupertinoDynamicColor( expect(
const CupertinoDynamicColor(
color: color0, color: color0,
darkColor: color1, darkColor: color1,
highContrastColor: color2, highContrastColor: color2,
...@@ -185,17 +186,18 @@ void main() { ...@@ -185,17 +186,18 @@ void main() {
highContrastElevatedColor: color2, highContrastElevatedColor: color2,
darkHighContrastElevatedColor: color3, darkHighContrastElevatedColor: color3,
), ),
CupertinoDynamicColor.withBrightnessAndContrast( const CupertinoDynamicColor.withBrightnessAndContrast(
color: color0, color: color0,
darkColor: color1, darkColor: color1,
highContrastColor: color2, highContrastColor: color2,
darkHighContrastColor: color3, darkHighContrastColor: color3,
)); ),
);
}); });
testWidgets('Dynamic colors that are not actually dynamic should not claim dependencies', testWidgets('Dynamic colors that are not actually dynamic should not claim dependencies',
(WidgetTester tester) async { (WidgetTester tester) async {
await tester.pumpWidget(DependentWidget(color: notSoDynamicColor1)); await tester.pumpWidget(const DependentWidget(color: notSoDynamicColor1));
expect(tester.takeException(), null); expect(tester.takeException(), null);
expect(find.byType(DependentWidget), paints..rect(color: color0)); expect(find.byType(DependentWidget), paints..rect(color: color0));
...@@ -206,8 +208,8 @@ void main() { ...@@ -206,8 +208,8 @@ void main() {
'and its resolved color should change when its dependency changes', 'and its resolved color should change when its dependency changes',
(WidgetTester tester) async { (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
MediaQuery( const MediaQuery(
data: const MediaQueryData(platformBrightness: Brightness.light), data: MediaQueryData(platformBrightness: Brightness.light),
child: DependentWidget(color: vibrancyDependentColor1), child: DependentWidget(color: vibrancyDependentColor1),
), ),
); );
...@@ -218,8 +220,8 @@ void main() { ...@@ -218,8 +220,8 @@ void main() {
// Changing color vibrancy works. // Changing color vibrancy works.
await tester.pumpWidget( await tester.pumpWidget(
MediaQuery( const MediaQuery(
data: const MediaQueryData(platformBrightness: Brightness.dark), data: MediaQueryData(platformBrightness: Brightness.dark),
child: DependentWidget(color: vibrancyDependentColor1), child: DependentWidget(color: vibrancyDependentColor1),
), ),
); );
...@@ -230,10 +232,10 @@ void main() { ...@@ -230,10 +232,10 @@ void main() {
// CupertinoTheme should take percedence over MediaQuery. // CupertinoTheme should take percedence over MediaQuery.
await tester.pumpWidget( await tester.pumpWidget(
CupertinoTheme( const CupertinoTheme(
data: const CupertinoThemeData(brightness: Brightness.light), data: CupertinoThemeData(brightness: Brightness.light),
child: MediaQuery( child: MediaQuery(
data: const MediaQueryData(platformBrightness: Brightness.dark), data: MediaQueryData(platformBrightness: Brightness.dark),
child: DependentWidget(color: vibrancyDependentColor1), child: DependentWidget(color: vibrancyDependentColor1),
), ),
), ),
...@@ -249,8 +251,8 @@ void main() { ...@@ -249,8 +251,8 @@ void main() {
'and its resolved color should change when its dependency changes', 'and its resolved color should change when its dependency changes',
(WidgetTester tester) async { (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
MediaQuery( const MediaQuery(
data: const MediaQueryData(highContrast: false), data: MediaQueryData(highContrast: false),
child: DependentWidget(color: contrastDependentColor1), child: DependentWidget(color: contrastDependentColor1),
), ),
); );
...@@ -261,8 +263,8 @@ void main() { ...@@ -261,8 +263,8 @@ void main() {
// Changing accessibility contrast works. // Changing accessibility contrast works.
await tester.pumpWidget( await tester.pumpWidget(
MediaQuery( const MediaQuery(
data: const MediaQueryData(highContrast: true), data: MediaQueryData(highContrast: true),
child: DependentWidget(color: contrastDependentColor1), child: DependentWidget(color: contrastDependentColor1),
), ),
); );
...@@ -272,7 +274,7 @@ void main() { ...@@ -272,7 +274,7 @@ void main() {
expect(find.byType(DependentWidget), isNot(paints..rect(color: color1))); expect(find.byType(DependentWidget), isNot(paints..rect(color: color1)));
// Asserts when the required dependency is missing. // Asserts when the required dependency is missing.
await tester.pumpWidget(DependentWidget(color: contrastDependentColor1)); await tester.pumpWidget(const DependentWidget(color: contrastDependentColor1));
expect(tester.takeException()?.toString(), contains('does not contain a MediaQuery')); expect(tester.takeException()?.toString(), contains('does not contain a MediaQuery'));
}); });
...@@ -281,7 +283,7 @@ void main() { ...@@ -281,7 +283,7 @@ void main() {
'and its resolved color should change when its dependency changes', 'and its resolved color should change when its dependency changes',
(WidgetTester tester) async { (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
CupertinoUserInterfaceLevel( const CupertinoUserInterfaceLevel(
data: CupertinoUserInterfaceLevelData.base, data: CupertinoUserInterfaceLevelData.base,
child: DependentWidget(color: elevationDependentColor1), child: DependentWidget(color: elevationDependentColor1),
), ),
...@@ -293,7 +295,7 @@ void main() { ...@@ -293,7 +295,7 @@ void main() {
// Changing UI elevation works. // Changing UI elevation works.
await tester.pumpWidget( await tester.pumpWidget(
CupertinoUserInterfaceLevel( const CupertinoUserInterfaceLevel(
data: CupertinoUserInterfaceLevelData.elevated, data: CupertinoUserInterfaceLevelData.elevated,
child: DependentWidget(color: elevationDependentColor1), child: DependentWidget(color: elevationDependentColor1),
), ),
...@@ -304,12 +306,12 @@ void main() { ...@@ -304,12 +306,12 @@ void main() {
expect(find.byType(DependentWidget), isNot(paints..rect(color: color1))); expect(find.byType(DependentWidget), isNot(paints..rect(color: color1)));
// Asserts when the required dependency is missing. // Asserts when the required dependency is missing.
await tester.pumpWidget(DependentWidget(color: elevationDependentColor1)); await tester.pumpWidget(const DependentWidget(color: elevationDependentColor1));
expect(tester.takeException()?.toString(), contains('does not contain a CupertinoUserInterfaceLevel')); expect(tester.takeException()?.toString(), contains('does not contain a CupertinoUserInterfaceLevel'));
}); });
testWidgets('Dynamic color with all 3 depedencies works', (WidgetTester tester) async { testWidgets('Dynamic color with all 3 depedencies works', (WidgetTester tester) async {
final Color dynamicRainbowColor1 = CupertinoDynamicColor( const Color dynamicRainbowColor1 = CupertinoDynamicColor(
color: color0, color: color0,
darkColor: color1, darkColor: color1,
highContrastColor: color2, highContrastColor: color2,
...@@ -321,8 +323,8 @@ void main() { ...@@ -321,8 +323,8 @@ void main() {
); );
await tester.pumpWidget( await tester.pumpWidget(
MediaQuery( const MediaQuery(
data: const MediaQueryData(platformBrightness: Brightness.light, highContrast: false), data: MediaQueryData(platformBrightness: Brightness.light, highContrast: false),
child: CupertinoUserInterfaceLevel( child: CupertinoUserInterfaceLevel(
data: CupertinoUserInterfaceLevelData.base, data: CupertinoUserInterfaceLevelData.base,
child: DependentWidget(color: dynamicRainbowColor1), child: DependentWidget(color: dynamicRainbowColor1),
...@@ -332,8 +334,8 @@ void main() { ...@@ -332,8 +334,8 @@ void main() {
expect(find.byType(DependentWidget), paints..rect(color: color0)); expect(find.byType(DependentWidget), paints..rect(color: color0));
await tester.pumpWidget( await tester.pumpWidget(
MediaQuery( const MediaQuery(
data: const MediaQueryData(platformBrightness: Brightness.dark, highContrast: false), data: MediaQueryData(platformBrightness: Brightness.dark, highContrast: false),
child: CupertinoUserInterfaceLevel( child: CupertinoUserInterfaceLevel(
data: CupertinoUserInterfaceLevelData.base, data: CupertinoUserInterfaceLevelData.base,
child: DependentWidget(color: dynamicRainbowColor1), child: DependentWidget(color: dynamicRainbowColor1),
...@@ -343,8 +345,8 @@ void main() { ...@@ -343,8 +345,8 @@ void main() {
expect(find.byType(DependentWidget), paints..rect(color: color1)); expect(find.byType(DependentWidget), paints..rect(color: color1));
await tester.pumpWidget( await tester.pumpWidget(
MediaQuery( const MediaQuery(
data: const MediaQueryData(platformBrightness: Brightness.light, highContrast: true), data: MediaQueryData(platformBrightness: Brightness.light, highContrast: true),
child: CupertinoUserInterfaceLevel( child: CupertinoUserInterfaceLevel(
data: CupertinoUserInterfaceLevelData.base, data: CupertinoUserInterfaceLevelData.base,
child: DependentWidget(color: dynamicRainbowColor1), child: DependentWidget(color: dynamicRainbowColor1),
...@@ -354,8 +356,8 @@ void main() { ...@@ -354,8 +356,8 @@ void main() {
expect(find.byType(DependentWidget), paints..rect(color: color2)); expect(find.byType(DependentWidget), paints..rect(color: color2));
await tester.pumpWidget( await tester.pumpWidget(
MediaQuery( const MediaQuery(
data: const MediaQueryData(platformBrightness: Brightness.dark, highContrast: true), data: MediaQueryData(platformBrightness: Brightness.dark, highContrast: true),
child: CupertinoUserInterfaceLevel( child: CupertinoUserInterfaceLevel(
data: CupertinoUserInterfaceLevelData.base, data: CupertinoUserInterfaceLevelData.base,
child: DependentWidget(color: dynamicRainbowColor1), child: DependentWidget(color: dynamicRainbowColor1),
...@@ -365,8 +367,8 @@ void main() { ...@@ -365,8 +367,8 @@ void main() {
expect(find.byType(DependentWidget), paints..rect(color: color3)); expect(find.byType(DependentWidget), paints..rect(color: color3));
await tester.pumpWidget( await tester.pumpWidget(
MediaQuery( const MediaQuery(
data: const MediaQueryData(platformBrightness: Brightness.dark, highContrast: false), data: MediaQueryData(platformBrightness: Brightness.dark, highContrast: false),
child: CupertinoUserInterfaceLevel( child: CupertinoUserInterfaceLevel(
data: CupertinoUserInterfaceLevelData.elevated, data: CupertinoUserInterfaceLevelData.elevated,
child: DependentWidget(color: dynamicRainbowColor1), child: DependentWidget(color: dynamicRainbowColor1),
...@@ -376,8 +378,8 @@ void main() { ...@@ -376,8 +378,8 @@ void main() {
expect(find.byType(DependentWidget), paints..rect(color: color4)); expect(find.byType(DependentWidget), paints..rect(color: color4));
await tester.pumpWidget( await tester.pumpWidget(
MediaQuery( const MediaQuery(
data: const MediaQueryData(platformBrightness: Brightness.light, highContrast: true), data: MediaQueryData(platformBrightness: Brightness.light, highContrast: true),
child: CupertinoUserInterfaceLevel( child: CupertinoUserInterfaceLevel(
data: CupertinoUserInterfaceLevelData.elevated, data: CupertinoUserInterfaceLevelData.elevated,
child: DependentWidget(color: dynamicRainbowColor1), child: DependentWidget(color: dynamicRainbowColor1),
...@@ -387,8 +389,8 @@ void main() { ...@@ -387,8 +389,8 @@ void main() {
expect(find.byType(DependentWidget), paints..rect(color: color5)); expect(find.byType(DependentWidget), paints..rect(color: color5));
await tester.pumpWidget( await tester.pumpWidget(
MediaQuery( const MediaQuery(
data: const MediaQueryData(platformBrightness: Brightness.dark, highContrast: true), data: MediaQueryData(platformBrightness: Brightness.dark, highContrast: true),
child: CupertinoUserInterfaceLevel( child: CupertinoUserInterfaceLevel(
data: CupertinoUserInterfaceLevelData.elevated, data: CupertinoUserInterfaceLevelData.elevated,
child: DependentWidget(color: dynamicRainbowColor1), child: DependentWidget(color: dynamicRainbowColor1),
...@@ -398,8 +400,8 @@ void main() { ...@@ -398,8 +400,8 @@ void main() {
expect(find.byType(DependentWidget), paints..rect(color: color6)); expect(find.byType(DependentWidget), paints..rect(color: color6));
await tester.pumpWidget( await tester.pumpWidget(
MediaQuery( const MediaQuery(
data: const MediaQueryData(platformBrightness: Brightness.light, highContrast: false), data: MediaQueryData(platformBrightness: Brightness.light, highContrast: false),
child: CupertinoUserInterfaceLevel( child: CupertinoUserInterfaceLevel(
data: CupertinoUserInterfaceLevelData.elevated, data: CupertinoUserInterfaceLevelData.elevated,
child: DependentWidget(color: dynamicRainbowColor1), child: DependentWidget(color: dynamicRainbowColor1),
...@@ -418,9 +420,20 @@ void main() { ...@@ -418,9 +420,20 @@ void main() {
return const Placeholder(); return const Placeholder();
} }
const CupertinoDynamicColor kSystemBackground = CupertinoDynamicColor(
color: Color.fromARGB(255, 255, 255, 255),
darkColor: Color.fromARGB(255, 0, 0, 0),
highContrastColor: Color.fromARGB(255, 255, 255, 255),
darkHighContrastColor: Color.fromARGB(255, 0, 0, 0),
elevatedColor: Color.fromARGB(255, 255, 255, 255),
darkElevatedColor: Color.fromARGB(255, 28, 28, 30),
highContrastElevatedColor: Color.fromARGB(255, 255, 255, 255),
darkHighContrastElevatedColor: Color.fromARGB(255, 36, 36, 38),
);
testWidgets('exists in CupertinoApp', (WidgetTester tester) async { testWidgets('exists in CupertinoApp', (WidgetTester tester) async {
await tester.pumpWidget(CupertinoApp(home: Builder(builder: systemColorGetter))); await tester.pumpWidget(CupertinoApp(home: Builder(builder: systemColorGetter)));
expect(colors.systemBackground, CupertinoSystemColors.fallbackValues.systemBackground); expect(colors.systemBackground, kSystemBackground);
}); });
testWidgets('resolves against its own BuildContext', (WidgetTester tester) async { testWidgets('resolves against its own BuildContext', (WidgetTester tester) async {
...@@ -442,8 +455,8 @@ void main() { ...@@ -442,8 +455,8 @@ void main() {
); );
// In widget tests the OS colors should fallback to `fallbackValues`. // In widget tests the OS colors should fallback to `fallbackValues`.
expect(colors.systemBackground, isNot(CupertinoSystemColors.fallbackValues.systemBackground)); expect(colors.systemBackground, isNot(kSystemBackground));
expect(colors.systemBackground.value, CupertinoSystemColors.fallbackValues.systemBackground.darkElevatedColor.value); expect(colors.systemBackground.value, kSystemBackground.darkElevatedColor.value);
colors = null; colors = null;
// Changing dependencies works. // Changing dependencies works.
...@@ -464,7 +477,7 @@ void main() { ...@@ -464,7 +477,7 @@ void main() {
), ),
); );
expect(colors.systemBackground.value, CupertinoSystemColors.fallbackValues.systemBackground.elevatedColor.value); expect(colors.systemBackground.value, kSystemBackground.elevatedColor.value);
}); });
}); });
...@@ -472,7 +485,7 @@ void main() { ...@@ -472,7 +485,7 @@ void main() {
CupertinoDynamicColor color; CupertinoDynamicColor color;
await tester.pumpWidget( await tester.pumpWidget(
CupertinoApp( CupertinoApp(
theme: CupertinoThemeData( theme: const CupertinoThemeData(
brightness: Brightness.dark, brightness: Brightness.dark,
primaryColor: dynamicColor, primaryColor: dynamicColor,
), ),
...@@ -490,7 +503,7 @@ void main() { ...@@ -490,7 +503,7 @@ void main() {
// Changing dependencies works. // Changing dependencies works.
await tester.pumpWidget( await tester.pumpWidget(
CupertinoApp( CupertinoApp(
theme: CupertinoThemeData( theme: const CupertinoThemeData(
brightness: Brightness.light, brightness: Brightness.light,
primaryColor: dynamicColor, primaryColor: dynamicColor,
), ),
...@@ -508,7 +521,7 @@ void main() { ...@@ -508,7 +521,7 @@ void main() {
// Having a dependency below the CupertinoTheme widget works. // Having a dependency below the CupertinoTheme widget works.
await tester.pumpWidget( await tester.pumpWidget(
CupertinoApp( CupertinoApp(
theme: CupertinoThemeData(primaryColor: dynamicColor), theme: const CupertinoThemeData(primaryColor: dynamicColor),
home: MediaQuery( home: MediaQuery(
data: const MediaQueryData(platformBrightness: Brightness.light, highContrast: false), data: const MediaQueryData(platformBrightness: Brightness.light, highContrast: false),
child: CupertinoUserInterfaceLevel( child: CupertinoUserInterfaceLevel(
...@@ -530,7 +543,7 @@ void main() { ...@@ -530,7 +543,7 @@ void main() {
await tester.pumpWidget( await tester.pumpWidget(
CupertinoApp( CupertinoApp(
// No brightness is explicitly specified here so it should defer to MediaQuery. // No brightness is explicitly specified here so it should defer to MediaQuery.
theme: CupertinoThemeData(primaryColor: dynamicColor), theme: const CupertinoThemeData(primaryColor: dynamicColor),
home: MediaQuery( home: MediaQuery(
data: const MediaQueryData(platformBrightness: Brightness.dark, highContrast: true), data: const MediaQueryData(platformBrightness: Brightness.dark, highContrast: true),
child: CupertinoUserInterfaceLevel( child: CupertinoUserInterfaceLevel(
...@@ -559,7 +572,7 @@ void main() { ...@@ -559,7 +572,7 @@ void main() {
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( MaterialApp(
theme: ThemeData( theme: ThemeData(
cupertinoOverrideTheme: CupertinoThemeData( cupertinoOverrideTheme: const CupertinoThemeData(
brightness: Brightness.dark, brightness: Brightness.dark,
primaryColor: dynamicColor, primaryColor: dynamicColor,
), ),
...@@ -587,7 +600,7 @@ void main() { ...@@ -587,7 +600,7 @@ void main() {
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( MaterialApp(
theme: ThemeData( theme: ThemeData(
cupertinoOverrideTheme: CupertinoThemeData( cupertinoOverrideTheme: const CupertinoThemeData(
brightness: Brightness.dark, brightness: Brightness.dark,
primaryColor: dynamicColor, primaryColor: dynamicColor,
), ),
...@@ -614,7 +627,7 @@ void main() { ...@@ -614,7 +627,7 @@ void main() {
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( MaterialApp(
// This will create a MaterialBasedCupertinoThemeData with primaryColor set to `dynamicColor`. // This will create a MaterialBasedCupertinoThemeData with primaryColor set to `dynamicColor`.
theme: ThemeData(colorScheme: ColorScheme.dark(primary: dynamicColor)), theme: ThemeData(colorScheme: const ColorScheme.dark(primary: dynamicColor)),
home: MediaQuery( home: MediaQuery(
data: const MediaQueryData(platformBrightness: Brightness.dark, highContrast: true), data: const MediaQueryData(platformBrightness: Brightness.dark, highContrast: true),
child: CupertinoUserInterfaceLevel( child: CupertinoUserInterfaceLevel(
...@@ -637,16 +650,16 @@ void main() { ...@@ -637,16 +650,16 @@ void main() {
}); });
group('CupertinoSystemColors', () { group('CupertinoSystemColors', () {
final Color dynamicColor0 = CupertinoDynamicColor.withBrightness( const Color dynamicColor0 = CupertinoDynamicColor.withBrightness(
color: const Color(0x00000000), color: Color(0x00000000),
darkColor: const Color(0x00000000) darkColor: Color(0x00000000)
); );
final Color dynamicColor1 = CupertinoDynamicColor.withBrightness( const Color dynamicColor1 = CupertinoDynamicColor.withBrightness(
color: const Color(0x00000001), color: Color(0x00000001),
darkColor: const Color(0x00000000) darkColor: Color(0x00000000)
); );
final CupertinoSystemColorsData system0 = CupertinoSystemColorsData( const CupertinoSystemColorsData system0 = CupertinoSystemColorsData(
label: dynamicColor0, label: dynamicColor0,
secondaryLabel: dynamicColor0, secondaryLabel: dynamicColor0,
tertiaryLabel: dynamicColor0, tertiaryLabel: dynamicColor0,
......
...@@ -11,6 +11,17 @@ import 'package:flutter_test/flutter_test.dart'; ...@@ -11,6 +11,17 @@ import 'package:flutter_test/flutter_test.dart';
import '../rendering/mock_canvas.dart'; import '../rendering/mock_canvas.dart';
import '../widgets/semantics_tester.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() { void main() {
Future<void> _dragSlider(WidgetTester tester, Key sliderKey) { Future<void> _dragSlider(WidgetTester tester, Key sliderKey) {
...@@ -441,15 +452,15 @@ void main() { ...@@ -441,15 +452,15 @@ void main() {
}); });
testWidgets('Themes can be overridden by dynamic colors', (WidgetTester tester) async { testWidgets('Themes can be overridden by dynamic colors', (WidgetTester tester) async {
final CupertinoDynamicColor activeColor = CupertinoDynamicColor( const CupertinoDynamicColor activeColor = CupertinoDynamicColor(
color: const Color(0x00000001), color: Color(0x00000001),
darkColor: const Color(0x00000002), darkColor: Color(0x00000002),
elevatedColor: const Color(0x00000003), elevatedColor: Color(0x00000003),
highContrastColor: const Color(0x00000004), highContrastColor: Color(0x00000004),
darkElevatedColor: const Color(0x00000005), darkElevatedColor: Color(0x00000005),
darkHighContrastColor: const Color(0x00000006), darkHighContrastColor: Color(0x00000006),
highContrastElevatedColor: const Color(0x00000007), highContrastElevatedColor: Color(0x00000007),
darkHighContrastElevatedColor: const Color(0x00000008), darkHighContrastElevatedColor: Color(0x00000008),
); );
Widget withTraits(Brightness brightness, CupertinoUserInterfaceLevelData level, bool highContrast) { Widget withTraits(Brightness brightness, CupertinoUserInterfaceLevelData level, bool highContrast) {
...@@ -512,12 +523,12 @@ void main() { ...@@ -512,12 +523,12 @@ void main() {
expect( expect(
find.byType(CupertinoSlider), find.byType(CupertinoSlider),
paints..rrect(color: CupertinoSystemColors.fallbackValues.systemFill.color), paints..rrect(color: _kSystemFill.color),
); );
expect( expect(
find.byType(CupertinoSlider), find.byType(CupertinoSlider),
isNot(paints..rrect(color: CupertinoSystemColors.fallbackValues.systemFill.darkColor)), isNot(paints..rrect(color: _kSystemFill.darkColor)),
); );
await tester.pumpWidget( await tester.pumpWidget(
...@@ -535,12 +546,12 @@ void main() { ...@@ -535,12 +546,12 @@ void main() {
expect( expect(
find.byType(CupertinoSlider), find.byType(CupertinoSlider),
paints..rrect(color: CupertinoSystemColors.fallbackValues.systemFill.darkColor), paints..rrect(color: _kSystemFill.darkColor),
); );
expect( expect(
find.byType(CupertinoSlider), 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