From deb4184f632abf78b62527968f5fb6d8f73b4d28 Mon Sep 17 00:00:00 2001 From: LongCatIsLooong <31859944+LongCatIsLooong@users.noreply.github.com> Date: Wed, 25 Sep 2019 10:17:37 -0700 Subject: [PATCH] Remove CupertinoSystemColors in favor of CupertinoColors (#40566) --- .../lib/src/cupertino/action_sheet.dart | 4 +- packages/flutter/lib/src/cupertino/app.dart | 85 +- .../flutter/lib/src/cupertino/button.dart | 14 +- .../flutter/lib/src/cupertino/colors.dart | 1202 ++++++----------- .../flutter/lib/src/cupertino/dialog.dart | 14 +- .../flutter/lib/src/cupertino/slider.dart | 4 +- .../flutter/lib/src/cupertino/switch.dart | 8 +- .../test/cupertino/bottom_tab_bar_test.dart | 2 +- .../flutter/test/cupertino/button_test.dart | 4 +- .../flutter/test/cupertino/colors_test.dart | 180 --- .../flutter/test/cupertino/dialog_test.dart | 4 +- .../cupertino/material/tab_scaffold_test.dart | 2 +- .../flutter/test/cupertino/nav_bar_test.dart | 7 +- .../cupertino/nav_bar_transition_test.dart | 4 +- .../cupertino/segmented_control_test.dart | 4 +- .../flutter/test/cupertino/slider_test.dart | 8 +- .../test/cupertino/tab_scaffold_test.dart | 2 +- .../test/cupertino/text_field_test.dart | 4 +- .../flutter/test/cupertino/theme_test.dart | 6 +- 19 files changed, 539 insertions(+), 1019 deletions(-) diff --git a/packages/flutter/lib/src/cupertino/action_sheet.dart b/packages/flutter/lib/src/cupertino/action_sheet.dart index 335ae2f19c..ae38af77b6 100644 --- a/packages/flutter/lib/src/cupertino/action_sheet.dart +++ b/packages/flutter/lib/src/cupertino/action_sheet.dart @@ -296,7 +296,7 @@ class CupertinoActionSheetAction extends StatelessWidget { Widget build(BuildContext context) { TextStyle style = _kActionSheetActionStyle.copyWith( color: isDestructiveAction - ? CupertinoSystemColors.of(context).systemRed + ? CupertinoDynamicColor.resolve(CupertinoColors.systemRed, context) : CupertinoTheme.of(context).primaryColor, ); @@ -362,7 +362,7 @@ class _CupertinoActionSheetCancelButtonState extends State<_CupertinoActionSheet Widget build(BuildContext context) { final Color backgroundColor = isBeingPressed ? _kCancelPressedColor - : CupertinoSystemColors.of(context).secondarySystemGroupedBackground; + : CupertinoColors.secondarySystemGroupedBackground; return GestureDetector( excludeFromSemantics: true, onTapDown: _onTapDown, diff --git a/packages/flutter/lib/src/cupertino/app.dart b/packages/flutter/lib/src/cupertino/app.dart index b164b35976..57e7c63be2 100644 --- a/packages/flutter/lib/src/cupertino/app.dart +++ b/packages/flutter/lib/src/cupertino/app.dart @@ -273,50 +273,47 @@ class _CupertinoAppState extends State { data: CupertinoUserInterfaceLevelData.base, child: CupertinoTheme( data: effectiveThemeData, - child: CupertinoSystemColors( - data: CupertinoSystemColors.of(context, useFallbackValues: true), - child: Builder( - builder: (BuildContext context) { - return WidgetsApp( - key: GlobalObjectKey(this), - navigatorKey: widget.navigatorKey, - navigatorObservers: _navigatorObservers, - pageRouteBuilder: (RouteSettings settings, WidgetBuilder builder) => - CupertinoPageRoute(settings: settings, builder: builder), - home: widget.home, - routes: widget.routes, - initialRoute: widget.initialRoute, - onGenerateRoute: widget.onGenerateRoute, - onUnknownRoute: widget.onUnknownRoute, - builder: widget.builder, - title: widget.title, - onGenerateTitle: widget.onGenerateTitle, - textStyle: effectiveThemeData.textTheme.textStyle, - color: CupertinoDynamicColor.resolve(widget.color ?? effectiveThemeData.primaryColor, context), - locale: widget.locale, - localizationsDelegates: _localizationsDelegates, - localeResolutionCallback: widget.localeResolutionCallback, - localeListResolutionCallback: widget.localeListResolutionCallback, - supportedLocales: widget.supportedLocales, - showPerformanceOverlay: widget.showPerformanceOverlay, - checkerboardRasterCacheImages: widget.checkerboardRasterCacheImages, - checkerboardOffscreenLayers: widget.checkerboardOffscreenLayers, - showSemanticsDebugger: widget.showSemanticsDebugger, - debugShowCheckedModeBanner: widget.debugShowCheckedModeBanner, - inspectorSelectButtonBuilder: (BuildContext context, VoidCallback onPressed) { - return CupertinoButton.filled( - child: const Icon( - CupertinoIcons.search, - size: 28.0, - color: CupertinoColors.white, - ), - padding: EdgeInsets.zero, - onPressed: onPressed, - ); - }, - ); - }, - ), + child: Builder( + builder: (BuildContext context) { + return WidgetsApp( + key: GlobalObjectKey(this), + navigatorKey: widget.navigatorKey, + navigatorObservers: _navigatorObservers, + pageRouteBuilder: (RouteSettings settings, WidgetBuilder builder) => + CupertinoPageRoute(settings: settings, builder: builder), + home: widget.home, + routes: widget.routes, + initialRoute: widget.initialRoute, + onGenerateRoute: widget.onGenerateRoute, + onUnknownRoute: widget.onUnknownRoute, + builder: widget.builder, + title: widget.title, + onGenerateTitle: widget.onGenerateTitle, + textStyle: effectiveThemeData.textTheme.textStyle, + color: CupertinoDynamicColor.resolve(widget.color ?? effectiveThemeData.primaryColor, context), + locale: widget.locale, + localizationsDelegates: _localizationsDelegates, + localeResolutionCallback: widget.localeResolutionCallback, + localeListResolutionCallback: widget.localeListResolutionCallback, + supportedLocales: widget.supportedLocales, + showPerformanceOverlay: widget.showPerformanceOverlay, + checkerboardRasterCacheImages: widget.checkerboardRasterCacheImages, + checkerboardOffscreenLayers: widget.checkerboardOffscreenLayers, + showSemanticsDebugger: widget.showSemanticsDebugger, + debugShowCheckedModeBanner: widget.debugShowCheckedModeBanner, + inspectorSelectButtonBuilder: (BuildContext context, VoidCallback onPressed) { + return CupertinoButton.filled( + child: const Icon( + CupertinoIcons.search, + size: 28.0, + color: CupertinoColors.white, + ), + padding: EdgeInsets.zero, + onPressed: onPressed, + ); + }, + ); + }, ), ), ), diff --git a/packages/flutter/lib/src/cupertino/button.dart b/packages/flutter/lib/src/cupertino/button.dart index 627097816b..eb748d0b1f 100644 --- a/packages/flutter/lib/src/cupertino/button.dart +++ b/packages/flutter/lib/src/cupertino/button.dart @@ -31,12 +31,13 @@ class CupertinoButton extends StatefulWidget { @required this.child, this.padding, this.color, - this.disabledColor, + this.disabledColor = CupertinoColors.quaternarySystemFill, this.minSize = kMinInteractiveDimensionCupertino, this.pressedOpacity = 0.1, this.borderRadius = const BorderRadius.all(Radius.circular(8.0)), @required this.onPressed, }) : assert(pressedOpacity == null || (pressedOpacity >= 0.0 && pressedOpacity <= 1.0)), + assert(disabledColor != null), _filled = false, super(key: key); @@ -50,12 +51,13 @@ class CupertinoButton extends StatefulWidget { Key key, @required this.child, this.padding, - this.disabledColor, + this.disabledColor = CupertinoColors.quaternarySystemFill, this.minSize = kMinInteractiveDimensionCupertino, this.pressedOpacity = 0.1, this.borderRadius = const BorderRadius.all(Radius.circular(8.0)), @required this.onPressed, }) : assert(pressedOpacity == null || (pressedOpacity >= 0.0 && pressedOpacity <= 1.0)), + assert(disabledColor != null), color = null, _filled = true, super(key: key); @@ -82,8 +84,8 @@ class CupertinoButton extends StatefulWidget { /// /// Ignored if the [CupertinoButton] doesn't also have a [color]. /// - /// Defaults to [CupertinoSystemColors.quaternarySystemFill] when [color] is - /// specified and [disabledColor] is null. + /// Defaults to [CupertinoColors.quaternarySystemFill] when [color] is + /// specified. Must not be null. final Color disabledColor; /// The callback that is called when the button is tapped or otherwise activated. @@ -214,7 +216,7 @@ class _CupertinoButtonState extends State with SingleTickerProv ? themeData.primaryContrastingColor : enabled ? primaryColor - : CupertinoDynamicColor.resolve(CupertinoSystemColors.of(context).placeholderText, context); + : CupertinoDynamicColor.resolve(CupertinoColors.placeholderText, context); final TextStyle textStyle = themeData.textTheme.textStyle.copyWith(color: foregroundColor); @@ -239,7 +241,7 @@ class _CupertinoButtonState extends State with SingleTickerProv decoration: BoxDecoration( borderRadius: widget.borderRadius, color: backgroundColor != null && !enabled - ? CupertinoDynamicColor.resolve(widget.disabledColor ?? CupertinoSystemColors.of(context).quaternarySystemFill, context) + ? CupertinoDynamicColor.resolve(widget.disabledColor, context) : backgroundColor, ), child: Padding( diff --git a/packages/flutter/lib/src/cupertino/colors.dart b/packages/flutter/lib/src/cupertino/colors.dart index 80dc57be05..d80de64c67 100644 --- a/packages/flutter/lib/src/cupertino/colors.dart +++ b/packages/flutter/lib/src/cupertino/colors.dart @@ -21,24 +21,23 @@ import 'theme.dart'; class CupertinoColors { CupertinoColors._(); - /// iOS 10's default blue color. Used to indicate active elements such as + /// iOS 13's default blue color. Used to indicate active elements such as /// buttons, selected tabs and your own chat bubbles. /// /// This is SystemBlue in the iOS palette. - static const Color activeBlue = Color(0xFF007AFF); + static const CupertinoDynamicColor activeBlue = systemBlue; - /// iOS 10's default green color. Used to indicate active accents such as + /// iOS 13's default green color. Used to indicate active accents such as /// the switch in its on state and some accent buttons such as the call button /// and Apple Map's 'Go' button. /// /// This is SystemGreen in the iOS palette. - static const Color activeGreen = Color(0xFF4CD964); + static const CupertinoDynamicColor activeGreen = systemGreen; - /// iOS 12's default dark mode color. Used in place of the [activeBlue] color - /// as the default active elements' color when the theme's brightness is dark. + /// iOS 13's orange color. /// /// This is SystemOrange in the iOS palette. - static const Color activeOrange = Color(0xFFFF9500); + static const CupertinoDynamicColor activeOrange = systemOrange; /// Opaque white color. Used for backgrounds and fonts against dark backgrounds. /// @@ -78,7 +77,7 @@ class CupertinoColors { /// Used in iOS 13 for unselected selectables such as tab bar items in their /// inactive state or de-emphasized subtitles and details text. /// - /// Not the same gray as disabled buttons etc. + /// Not the same grey as disabled buttons etc. /// /// This is the disabled color in the iOS palette. static const Color inactiveGray = CupertinoDynamicColor.withBrightness( @@ -86,14 +85,455 @@ class CupertinoColors { darkColor: Color(0xFF757575), ); - /// Used for iOS 10 for destructive actions such as the delete actions in + /// Used for iOS 13 for destructive actions such as the delete actions in /// table view cells and dialogs. /// /// Not the same red as the camera shutter or springboard icon notifications /// or the foreground red theme in various native apps such as HealthKit. /// /// This is SystemRed in the iOS palette. - static const Color destructiveRed = Color(0xFFFF3B30); + static const Color destructiveRed = systemRed; + + /// A blue color that can adapt to the given [BuildContext]. + /// + /// See also: + /// + /// * [UIColor.systemBlue](https://developer.apple.com/documentation/uikit/uicolor/3173141-systemblue), + /// the `UIKit` equivalent. + static const CupertinoDynamicColor systemBlue = CupertinoDynamicColor.withBrightnessAndContrast( + color: Color.fromARGB(255, 0, 122, 255), + darkColor: Color.fromARGB(255, 10, 132, 255), + highContrastColor: Color.fromARGB(255, 0, 64, 221), + darkHighContrastColor: Color.fromARGB(255, 64, 156, 255), + ); + + /// A green color that can adapt to the given [BuildContext]. + /// + /// See also: + /// + /// * [UIColor.systemGreen](https://developer.apple.com/documentation/uikit/uicolor/3173144-systemgreen), + /// the `UIKit` equivalent. + static const CupertinoDynamicColor systemGreen = CupertinoDynamicColor.withBrightnessAndContrast( + color: Color.fromARGB(255, 52, 199, 89), + darkColor: Color.fromARGB(255, 48, 209, 88), + highContrastColor: Color.fromARGB(255, 36, 138, 61), + darkHighContrastColor: Color.fromARGB(255, 48, 219, 91), + ); + + /// An indigo color that can adapt to the given [BuildContext]. + /// + /// See also: + /// + /// * [UIColor.systemIndigo](https://developer.apple.com/documentation/uikit/uicolor/3173146-systemindigo), + /// the `UIKit` equivalent. + static const CupertinoDynamicColor systemIndigo = CupertinoDynamicColor.withBrightnessAndContrast( + color: Color.fromARGB(255, 88, 86, 214), + darkColor: Color.fromARGB(255, 94, 92, 230), + highContrastColor: Color.fromARGB(255, 54, 52, 163), + darkHighContrastColor: Color.fromARGB(255, 125, 122, 255), + ); + + /// An orange color that can adapt to the given [BuildContext]. + /// + /// See also: + /// + /// * [UIColor.systemOrange](https://developer.apple.com/documentation/uikit/uicolor/3173147-systemorange), + /// the `UIKit` equivalent. + static const CupertinoDynamicColor systemOrange = CupertinoDynamicColor.withBrightnessAndContrast( + color: Color.fromARGB(255, 255, 149, 0), + darkColor: Color.fromARGB(255, 255, 159, 10), + highContrastColor: Color.fromARGB(255, 201, 52, 0), + darkHighContrastColor: Color.fromARGB(255, 255, 179, 64), + ); + + /// A pink color that can adapt to the given [BuildContext]. + /// + /// See also: + /// + /// * [UIColor.systemPink](https://developer.apple.com/documentation/uikit/uicolor/3173148-systempink), + /// the `UIKit` equivalent. + static const CupertinoDynamicColor systemPink = CupertinoDynamicColor.withBrightnessAndContrast( + color: Color.fromARGB(255, 255, 45, 85), + darkColor: Color.fromARGB(255, 255, 55, 95), + highContrastColor: Color.fromARGB(255, 211, 15, 69), + darkHighContrastColor: Color.fromARGB(255, 255, 100, 130), + ); + + /// A purple color that can adapt to the given [BuildContext]. + /// + /// See also: + /// + /// * [UIColor.systemPurple](https://developer.apple.com/documentation/uikit/uicolor/3173149-systempurple), + /// the `UIKit` equivalent. + static const CupertinoDynamicColor systemPurple = CupertinoDynamicColor.withBrightnessAndContrast( + color: Color.fromARGB(255, 175, 82, 222), + darkColor: Color.fromARGB(255, 191, 90, 242), + highContrastColor: Color.fromARGB(255, 137, 68, 171), + darkHighContrastColor: Color.fromARGB(255, 218, 143, 255), + ); + + /// A red color that can adapt to the given [BuildContext]. + /// + /// See also: + /// + /// * [UIColor.systemRed](https://developer.apple.com/documentation/uikit/uicolor/3173150-systemred), + /// the `UIKit` equivalent. + static const CupertinoDynamicColor systemRed = CupertinoDynamicColor.withBrightnessAndContrast( + color: Color.fromARGB(255, 255, 59, 48), + darkColor: Color.fromARGB(255, 255, 69, 58), + highContrastColor: Color.fromARGB(255, 215, 0, 21), + darkHighContrastColor: Color.fromARGB(255, 255, 105, 97), + ); + + /// A teal color that can adapt to the given [BuildContext]. + /// + /// See also: + /// + /// * [UIColor.systemTeal](https://developer.apple.com/documentation/uikit/uicolor/3173151-systemteal), + /// the `UIKit` equivalent. + static const CupertinoDynamicColor systemTeal = CupertinoDynamicColor.withBrightnessAndContrast( + color: Color.fromARGB(255, 90, 200, 250), + darkColor: Color.fromARGB(255, 100, 210, 255), + highContrastColor: Color.fromARGB(255, 0, 113, 164), + darkHighContrastColor: Color.fromARGB(255, 112, 215, 255), + ); + + /// A yellow color that can adapt to the given [BuildContext]. + /// + /// See also: + /// + /// * [UIColor.systemYellow](https://developer.apple.com/documentation/uikit/uicolor/3173152-systemyellow), + /// the `UIKit` equivalent. + static const CupertinoDynamicColor systemYellow = CupertinoDynamicColor.withBrightnessAndContrast( + color: Color.fromARGB(255, 255, 204, 0), + darkColor: Color.fromARGB(255, 255, 214, 10), + highContrastColor: Color.fromARGB(255, 160, 90, 0), + darkHighContrastColor: Color.fromARGB(255, 255, 212, 38), + ); + + /// The base grey color. + /// + /// See also: + /// + /// * [UIColor.systemGray](https://developer.apple.com/documentation/uikit/uicolor/3173143-systemgray), + /// the `UIKit` equivalent. + static const CupertinoDynamicColor systemGrey = CupertinoDynamicColor.withBrightnessAndContrast( + color: Color.fromARGB(255, 142, 142, 147), + darkColor: Color.fromARGB(255, 142, 142, 147), + highContrastColor: Color.fromARGB(255, 108, 108, 112), + darkHighContrastColor: Color.fromARGB(255, 174, 174, 178), + ); + + /// A second-level shade of grey. + /// + /// See also: + /// + /// * [UIColor.systemGray2](https://developer.apple.com/documentation/uikit/uicolor/3255071-systemgray2), + /// the `UIKit` equivalent. + static const CupertinoDynamicColor systemGrey2 = CupertinoDynamicColor.withBrightnessAndContrast( + color: Color.fromARGB(255, 174, 174, 178), + darkColor: Color.fromARGB(255, 99, 99, 102), + highContrastColor: Color.fromARGB(255, 142, 142, 147), + darkHighContrastColor: Color.fromARGB(255, 124, 124, 128), + ); + + /// A third-level shade of grey. + /// + /// See also: + /// + /// * [UIColor.systemGray3](https://developer.apple.com/documentation/uikit/uicolor/3255072-systemgray3), + /// the `UIKit` equivalent. + static const CupertinoDynamicColor systemGrey3 = CupertinoDynamicColor.withBrightnessAndContrast( + color: Color.fromARGB(255, 199, 199, 204), + darkColor: Color.fromARGB(255, 72, 72, 74), + highContrastColor: Color.fromARGB(255, 174, 174, 178), + darkHighContrastColor: Color.fromARGB(255, 84, 84, 86), + ); + + /// A fourth-level shade of grey. + /// + /// See also: + /// + /// * [UIColor.systemGray4](https://developer.apple.com/documentation/uikit/uicolor/3255073-systemgray4), + /// the `UIKit` equivalent. + static const CupertinoDynamicColor systemGrey4 = CupertinoDynamicColor.withBrightnessAndContrast( + color: Color.fromARGB(255, 209, 209, 214), + darkColor: Color.fromARGB(255, 58, 58, 60), + highContrastColor: Color.fromARGB(255, 188, 188, 192), + darkHighContrastColor: Color.fromARGB(255, 68, 68, 70), + ); + + /// A fifth-level shade of grey. + /// + /// See also: + /// + /// * [UIColor.systemGray5](https://developer.apple.com/documentation/uikit/uicolor/3255074-systemgray5), + /// the `UIKit` equivalent. + static const CupertinoDynamicColor systemGrey5 = CupertinoDynamicColor.withBrightnessAndContrast( + color: Color.fromARGB(255, 229, 229, 234), + darkColor: Color.fromARGB(255, 44, 44, 46), + highContrastColor: Color.fromARGB(255, 216, 216, 220), + darkHighContrastColor: Color.fromARGB(255, 54, 54, 56), + ); + + /// A sixth-level shade of grey. + /// + /// See also: + /// + /// * [UIColor.systemGray6](https://developer.apple.com/documentation/uikit/uicolor/3255075-systemgray6), + /// the `UIKit` equivalent. + static const CupertinoDynamicColor systemGrey6 = CupertinoDynamicColor.withBrightnessAndContrast( + color: Color.fromARGB(255, 242, 242, 247), + darkColor: Color.fromARGB(255, 28, 28, 30), + highContrastColor: Color.fromARGB(255, 235, 235, 240), + darkHighContrastColor: Color.fromARGB(255, 36, 36, 38), + ); + + /// The color for text labels containing primary content, equivalent to + /// [UIColor.label](https://developer.apple.com/documentation/uikit/uicolor/3173131-label). + static const CupertinoDynamicColor label = CupertinoDynamicColor( + color: Color.fromARGB(255, 0, 0, 0), + darkColor: Color.fromARGB(255, 255, 255, 255), + highContrastColor: Color.fromARGB(255, 0, 0, 0), + darkHighContrastColor: Color.fromARGB(255, 255, 255, 255), + elevatedColor: Color.fromARGB(255, 0, 0, 0), + darkElevatedColor: Color.fromARGB(255, 255, 255, 255), + highContrastElevatedColor: Color.fromARGB(255, 0, 0, 0), + darkHighContrastElevatedColor: Color.fromARGB(255, 255, 255, 255), + ); + + /// The color for text labels containing secondary content, equivalent to + /// [UIColor.secondaryLabel](https://developer.apple.com/documentation/uikit/uicolor/3173136-secondarylabel). + static const CupertinoDynamicColor secondaryLabel = CupertinoDynamicColor( + color: Color.fromARGB(255, 0, 0, 0), + darkColor: Color.fromARGB(255, 255, 255, 255), + highContrastColor: Color.fromARGB(255, 0, 0, 0), + darkHighContrastColor: Color.fromARGB(255, 255, 255, 255), + elevatedColor: Color.fromARGB(255, 0, 0, 0), + darkElevatedColor: Color.fromARGB(255, 255, 255, 255), + highContrastElevatedColor: Color.fromARGB(255, 0, 0, 0), + darkHighContrastElevatedColor: Color.fromARGB(255, 255, 255, 255), + ); + + /// The color for text labels containing tertiary content, equivalent to + /// [UIColor.tertiaryLabel](https://developer.apple.com/documentation/uikit/uicolor/3173153-tertiarylabel). + static const CupertinoDynamicColor tertiaryLabel = CupertinoDynamicColor( + color: Color.fromARGB(76, 60, 60, 67), + darkColor: Color.fromARGB(76, 235, 235, 245), + highContrastColor: Color.fromARGB(96, 60, 60, 67), + darkHighContrastColor: Color.fromARGB(96, 235, 235, 245), + elevatedColor: Color.fromARGB(76, 60, 60, 67), + darkElevatedColor: Color.fromARGB(76, 235, 235, 245), + highContrastElevatedColor: Color.fromARGB(96, 60, 60, 67), + darkHighContrastElevatedColor: Color.fromARGB(96, 235, 235, 245), + ); + + /// The color for text labels containing quaternary content, equivalent to + /// [UIColor.quaternaryLabel](https://developer.apple.com/documentation/uikit/uicolor/3173135-quaternarylabel). + static const CupertinoDynamicColor quaternaryLabel = CupertinoDynamicColor( + color: Color.fromARGB(45, 60, 60, 67), + darkColor: Color.fromARGB(40, 235, 235, 245), + highContrastColor: Color.fromARGB(66, 60, 60, 67), + darkHighContrastColor: Color.fromARGB(61, 235, 235, 245), + elevatedColor: Color.fromARGB(45, 60, 60, 67), + darkElevatedColor: Color.fromARGB(40, 235, 235, 245), + highContrastElevatedColor: Color.fromARGB(66, 60, 60, 67), + darkHighContrastElevatedColor: Color.fromARGB(61, 235, 235, 245), + ); + + /// An overlay fill color for thin and small shapes, equivalent to + /// [UIColor.systemFill](https://developer.apple.com/documentation/uikit/uicolor/3255070-systemfill). + static const CupertinoDynamicColor systemFill = 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), + ); + + /// An overlay fill color for medium-size shapes, equivalent to + /// [UIColor.secondarySystemFill](https://developer.apple.com/documentation/uikit/uicolor/3255069-secondarysystemfill). + static const CupertinoDynamicColor secondarySystemFill = CupertinoDynamicColor( + color: Color.fromARGB(40, 120, 120, 128), + darkColor: Color.fromARGB(81, 120, 120, 128), + highContrastColor: Color.fromARGB(61, 120, 120, 128), + darkHighContrastColor: Color.fromARGB(102, 120, 120, 128), + elevatedColor: Color.fromARGB(40, 120, 120, 128), + darkElevatedColor: Color.fromARGB(81, 120, 120, 128), + highContrastElevatedColor: Color.fromARGB(61, 120, 120, 128), + darkHighContrastElevatedColor: Color.fromARGB(102, 120, 120, 128), + ); + + /// An overlay fill color for large shapes, equivalent to + /// [UIColor.tertiarySystemFill](https://developer.apple.com/documentation/uikit/uicolor/3255076-tertiarysystemfill). + static const CupertinoDynamicColor tertiarySystemFill = CupertinoDynamicColor( + color: Color.fromARGB(30, 118, 118, 128), + darkColor: Color.fromARGB(61, 118, 118, 128), + highContrastColor: Color.fromARGB(51, 118, 118, 128), + darkHighContrastColor: Color.fromARGB(81, 118, 118, 128), + elevatedColor: Color.fromARGB(30, 118, 118, 128), + darkElevatedColor: Color.fromARGB(61, 118, 118, 128), + highContrastElevatedColor: Color.fromARGB(51, 118, 118, 128), + darkHighContrastElevatedColor: Color.fromARGB(81, 118, 118, 128), + ); + + /// An overlay fill color for large areas containing complex content, equivalent + /// to [UIColor.quaternarySystemFill](https://developer.apple.com/documentation/uikit/uicolor/3255068-quaternarysystemfill). + static const CupertinoDynamicColor quaternarySystemFill = CupertinoDynamicColor( + color: Color.fromARGB(20, 116, 116, 128), + darkColor: Color.fromARGB(45, 118, 118, 128), + highContrastColor: Color.fromARGB(40, 116, 116, 128), + darkHighContrastColor: Color.fromARGB(66, 118, 118, 128), + elevatedColor: Color.fromARGB(20, 116, 116, 128), + darkElevatedColor: Color.fromARGB(45, 118, 118, 128), + highContrastElevatedColor: Color.fromARGB(40, 116, 116, 128), + darkHighContrastElevatedColor: Color.fromARGB(66, 118, 118, 128), + ); + + /// The color for placeholder text in controls or text views, equivalent to + /// [UIColor.placeholderText](https://developer.apple.com/documentation/uikit/uicolor/3173134-placeholdertext). + static const CupertinoDynamicColor placeholderText = CupertinoDynamicColor( + color: Color.fromARGB(76, 60, 60, 67), + darkColor: Color.fromARGB(76, 235, 235, 245), + highContrastColor: Color.fromARGB(96, 60, 60, 67), + darkHighContrastColor: Color.fromARGB(96, 235, 235, 245), + elevatedColor: Color.fromARGB(76, 60, 60, 67), + darkElevatedColor: Color.fromARGB(76, 235, 235, 245), + highContrastElevatedColor: Color.fromARGB(96, 60, 60, 67), + darkHighContrastElevatedColor: Color.fromARGB(96, 235, 235, 245), + ); + + /// The color for the main background of your interface, equivalent to + /// [UIColor.systemBackground](https://developer.apple.com/documentation/uikit/uicolor/3173140-systembackground). + /// + /// Typically used for designs that have a white primary background in a light environment. + static const CupertinoDynamicColor systemBackground = 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), + ); + + /// The color for content layered on top of the main background, equivalent to + /// [UIColor.secondarySystemBackground](https://developer.apple.com/documentation/uikit/uicolor/3173137-secondarysystembackground). + /// + /// Typically used for designs that have a white primary background in a light environment. + static const CupertinoDynamicColor secondarySystemBackground = CupertinoDynamicColor( + color: Color.fromARGB(255, 242, 242, 247), + darkColor: Color.fromARGB(255, 28, 28, 30), + highContrastColor: Color.fromARGB(255, 235, 235, 240), + darkHighContrastColor: Color.fromARGB(255, 36, 36, 38), + elevatedColor: Color.fromARGB(255, 242, 242, 247), + darkElevatedColor: Color.fromARGB(255, 44, 44, 46), + highContrastElevatedColor: Color.fromARGB(255, 235, 235, 240), + darkHighContrastElevatedColor: Color.fromARGB(255, 54, 54, 56), + ); + + /// The color for content layered on top of secondary backgrounds, equivalent + /// to [UIColor.tertiarySystemBackground](https://developer.apple.com/documentation/uikit/uicolor/3173154-tertiarysystembackground). + /// + /// Typically used for designs that have a white primary background in a light environment. + static const CupertinoDynamicColor tertiarySystemBackground = CupertinoDynamicColor( + color: Color.fromARGB(255, 255, 255, 255), + darkColor: Color.fromARGB(255, 44, 44, 46), + highContrastColor: Color.fromARGB(255, 255, 255, 255), + darkHighContrastColor: Color.fromARGB(255, 54, 54, 56), + elevatedColor: Color.fromARGB(255, 255, 255, 255), + darkElevatedColor: Color.fromARGB(255, 58, 58, 60), + highContrastElevatedColor: Color.fromARGB(255, 255, 255, 255), + darkHighContrastElevatedColor: Color.fromARGB(255, 68, 68, 70), + ); + + /// The color for the main background of your grouped interface, equivalent to + /// [UIColor.systemGroupedBackground](https://developer.apple.com/documentation/uikit/uicolor/3173145-systemgroupedbackground). + /// + /// Typically used for grouped content, including table views and platter-based designs. + static const CupertinoDynamicColor systemGroupedBackground = CupertinoDynamicColor( + color: Color.fromARGB(255, 242, 242, 247), + darkColor: Color.fromARGB(255, 0, 0, 0), + highContrastColor: Color.fromARGB(255, 235, 235, 240), + darkHighContrastColor: Color.fromARGB(255, 0, 0, 0), + elevatedColor: Color.fromARGB(255, 242, 242, 247), + darkElevatedColor: Color.fromARGB(255, 28, 28, 30), + highContrastElevatedColor: Color.fromARGB(255, 235, 235, 240), + darkHighContrastElevatedColor: Color.fromARGB(255, 36, 36, 38), + ); + + /// The color for content layered on top of the main background of your grouped interface, + /// equivalent to [UIColor.secondarySystemGroupedBackground](https://developer.apple.com/documentation/uikit/uicolor/3173138-secondarysystemgroupedbackground). + /// + /// Typically used for grouped content, including table views and platter-based designs. + static const CupertinoDynamicColor secondarySystemGroupedBackground = CupertinoDynamicColor( + color: Color.fromARGB(255, 255, 255, 255), + darkColor: Color.fromARGB(255, 28, 28, 30), + highContrastColor: Color.fromARGB(255, 255, 255, 255), + darkHighContrastColor: Color.fromARGB(255, 36, 36, 38), + elevatedColor: Color.fromARGB(255, 255, 255, 255), + darkElevatedColor: Color.fromARGB(255, 44, 44, 46), + highContrastElevatedColor: Color.fromARGB(255, 255, 255, 255), + darkHighContrastElevatedColor: Color.fromARGB(255, 54, 54, 56), + ); + + /// The color for content layered on top of secondary backgrounds of your grouped interface, + /// equivalent to [UIColor.tertiarySystemGroupedBackground](https://developer.apple.com/documentation/uikit/uicolor/3173155-tertiarysystemgroupedbackground). + /// + /// Typically used for grouped content, including table views and platter-based designs. + static const CupertinoDynamicColor tertiarySystemGroupedBackground = CupertinoDynamicColor( + color: Color.fromARGB(255, 242, 242, 247), + darkColor: Color.fromARGB(255, 44, 44, 46), + highContrastColor: Color.fromARGB(255, 235, 235, 240), + darkHighContrastColor: Color.fromARGB(255, 54, 54, 56), + elevatedColor: Color.fromARGB(255, 242, 242, 247), + darkElevatedColor: Color.fromARGB(255, 58, 58, 60), + highContrastElevatedColor: Color.fromARGB(255, 235, 235, 240), + darkHighContrastElevatedColor: Color.fromARGB(255, 68, 68, 70), + ); + + /// The color for thin borders or divider lines that allows some underlying content to be visible, + /// equivalent to [UIColor.separator](https://developer.apple.com/documentation/uikit/uicolor/3173139-separator). + static const CupertinoDynamicColor separator = CupertinoDynamicColor( + color: Color.fromARGB(73, 60, 60, 67), + darkColor: Color.fromARGB(153, 84, 84, 88), + highContrastColor: Color.fromARGB(94, 60, 60, 67), + darkHighContrastColor: Color.fromARGB(173, 84, 84, 88), + elevatedColor: Color.fromARGB(73, 60, 60, 67), + darkElevatedColor: Color.fromARGB(153, 84, 84, 88), + highContrastElevatedColor: Color.fromARGB(94, 60, 60, 67), + darkHighContrastElevatedColor: Color.fromARGB(173, 84, 84, 88), + ); + + /// The color for borders or divider lines that hide any underlying content, + /// equivalent to [UIColor.opaqueSeparator](https://developer.apple.com/documentation/uikit/uicolor/3173133-opaqueseparator). + static const CupertinoDynamicColor opaqueSeparator = CupertinoDynamicColor( + color: Color.fromARGB(255, 198, 198, 200), + darkColor: Color.fromARGB(255, 56, 56, 58), + highContrastColor: Color.fromARGB(255, 198, 198, 200), + darkHighContrastColor: Color.fromARGB(255, 56, 56, 58), + elevatedColor: Color.fromARGB(255, 198, 198, 200), + darkElevatedColor: Color.fromARGB(255, 56, 56, 58), + highContrastElevatedColor: Color.fromARGB(255, 198, 198, 200), + darkHighContrastElevatedColor: Color.fromARGB(255, 56, 56, 58), + ); + + /// The color for links, equivalent to + /// [UIColor.link](https://developer.apple.com/documentation/uikit/uicolor/3173132-link). + static const CupertinoDynamicColor link = CupertinoDynamicColor( + color: Color.fromARGB(255, 0, 122, 255), + darkColor: Color.fromARGB(255, 9, 132, 255), + highContrastColor: Color.fromARGB(255, 0, 122, 255), + darkHighContrastColor: Color.fromARGB(255, 9, 132, 255), + elevatedColor: Color.fromARGB(255, 0, 122, 255), + darkElevatedColor: Color.fromARGB(255, 9, 132, 255), + highContrastElevatedColor: Color.fromARGB(255, 0, 122, 255), + darkHighContrastElevatedColor: Color.fromARGB(255, 9, 132, 255), + ); } /// A [Color] subclass that represents a family of colors, and the currect effective @@ -137,8 +577,6 @@ class CupertinoColors { /// /// * [CupertinoUserInterfaceLevel], an [InheritedWidget] that may affect color /// resolution of a `CupertinoDynamicColor`. -/// * [CupertinoSystemColors], an [InheritedWidget] that exposes system colors -/// of iOS 13+. /// * https://developer.apple.com/documentation/uikit/uicolor/3238042-resolvedcolor. @immutable class CupertinoDynamicColor extends Color { @@ -494,743 +932,3 @@ class CupertinoDynamicColor extends Color { return '$runtimeType(${xs.join(', ')})'; } } - -/// A color palette that typically matches iOS 13+ system colors. -/// -/// Generally you should not create a [CupertinoSystemColorsData] yourself. -/// Use [CupertinoSystemColors.of] to get the [CupertinoSystemColorsData] from the -/// current [BuildContext] if possible, or [CupertinoSystemColors.fromSystem] -/// when the current [BuildContext] is not available (e.g., in [CupertinoApp]'s -/// constructor). -@immutable -class CupertinoSystemColorsData extends Diagnosticable { - /// Creates a color palette. - /// - /// Generally you should not create your own `CupertinoSystemColorsData`. - /// Use [CupertinoSystemColors.of] to get the [CupertinoSystemColorsData] from the - /// current [BuildContext] if possible, or [CupertinoSystemColors.fromSystem] - /// when the current [BuildContext] is not available (e.g., in [CupertinoApp]'s - /// constructor). - const CupertinoSystemColorsData({ - @required this.label, - @required this.secondaryLabel, - @required this.tertiaryLabel, - @required this.quaternaryLabel, - @required this.systemFill, - @required this.secondarySystemFill, - @required this.tertiarySystemFill, - @required this.quaternarySystemFill, - @required this.placeholderText, - @required this.systemBackground, - @required this.secondarySystemBackground, - @required this.tertiarySystemBackground, - @required this.systemGroupedBackground, - @required this.secondarySystemGroupedBackground, - @required this.tertiarySystemGroupedBackground, - @required this.separator, - @required this.opaqueSeparator, - @required this.link, - @required this.systemBlue, - @required this.systemGreen, - @required this.systemIndigo, - @required this.systemOrange, - @required this.systemPink, - @required this.systemPurple, - @required this.systemRed, - @required this.systemTeal, - @required this.systemYellow, - @required this.systemGray, - @required this.systemGray2, - @required this.systemGray3, - @required this.systemGray4, - @required this.systemGray5, - @required this.systemGray6, - }) : assert(label != null), - assert(secondaryLabel != null), - assert(tertiaryLabel != null), - assert(quaternaryLabel != null), - assert(systemFill != null), - assert(secondarySystemFill != null), - assert(tertiarySystemFill != null), - assert(quaternarySystemFill != null), - assert(placeholderText != null), - assert(systemBackground != null), - assert(secondarySystemBackground != null), - assert(tertiarySystemBackground != null), - assert(systemGroupedBackground != null), - assert(secondarySystemGroupedBackground != null), - assert(tertiarySystemGroupedBackground != null), - assert(separator != null), - assert(opaqueSeparator != null), - assert(link != null), - assert(systemBlue != null), - assert(systemGreen != null), - assert(systemIndigo != null), - assert(systemOrange != null), - assert(systemPink != null), - assert(systemPurple != null), - assert(systemRed != null), - assert(systemTeal != null), - assert(systemYellow != null), - assert(systemGray != null), - assert(systemGray2 != null), - assert(systemGray3 != null), - assert(systemGray4 != null), - assert(systemGray5 != null), - assert(systemGray6 != null), - super(); - - /// The color for text labels containing primary content. - final CupertinoDynamicColor label; - - /// The color for text labels containing secondary content. - final CupertinoDynamicColor secondaryLabel; - - /// The color for text labels containing tertiary content. - final CupertinoDynamicColor tertiaryLabel; - - /// The color for text labels containing quaternary content. - final CupertinoDynamicColor quaternaryLabel; - - /// An overlay fill color for thin and small shapes. - final CupertinoDynamicColor systemFill; - - /// An overlay fill color for medium-size shapes. - final CupertinoDynamicColor secondarySystemFill; - - /// An overlay fill color for large shapes. - final CupertinoDynamicColor tertiarySystemFill; - - /// An overlay fill color for large areas containing complex content. - final CupertinoDynamicColor quaternarySystemFill; - - /// The color for placeholder text in controls or text views. - final CupertinoDynamicColor placeholderText; - - /// The color for the main background of your interface. - /// - /// Typically used for designs that have a white primary background in a light environment. - final CupertinoDynamicColor systemBackground; - - /// The color for content layered on top of the main background. - /// - /// Typically used for designs that have a white primary background in a light environment. - final CupertinoDynamicColor secondarySystemBackground; - - /// The color for content layered on top of secondary backgrounds. - /// - /// Typically used for designs that have a white primary background in a light environment. - final CupertinoDynamicColor tertiarySystemBackground; - - /// The color for the main background of your grouped interface. - /// - /// Typically used for grouped content, including table views and platter-based designs. - final CupertinoDynamicColor systemGroupedBackground; - - /// The color for content layered on top of the main background of your grouped interface. - /// - /// Typically used for grouped content, including table views and platter-based designs. - final CupertinoDynamicColor secondarySystemGroupedBackground; - - /// The color for content layered on top of secondary backgrounds of your grouped interface. - /// - /// Typically used for grouped content, including table views and platter-based designs. - final CupertinoDynamicColor tertiarySystemGroupedBackground; - - /// The color for thin borders or divider lines that allows some underlying content to be visible. - final CupertinoDynamicColor separator; - - /// The color for borders or divider lines that hide any underlying content. - final CupertinoDynamicColor opaqueSeparator; - - /// The color for links. - final CupertinoDynamicColor link; - - /// A blue color that can adapt to the given [BuildContext]. - final CupertinoDynamicColor systemBlue; - - /// A green color that can adapt to the given [BuildContext]. - final CupertinoDynamicColor systemGreen; - - /// An indigo color that can adapt to the given [BuildContext]. - final CupertinoDynamicColor systemIndigo; - - /// An orange color that can adapt to the given [BuildContext]. - final CupertinoDynamicColor systemOrange; - - /// A pink color that can adapt to the given [BuildContext]. - final CupertinoDynamicColor systemPink; - - /// A purple color that can adapt to the given [BuildContext]. - final CupertinoDynamicColor systemPurple; - - /// A red color that can adapt to the given [BuildContext]. - final CupertinoDynamicColor systemRed; - - /// A teal color that can adapt to the given [BuildContext]. - final CupertinoDynamicColor systemTeal; - - /// A yellow color that can adapt to the given [BuildContext]. - final CupertinoDynamicColor systemYellow; - - /// The base gray color. - final CupertinoDynamicColor systemGray; - - /// A second-level shade of grey. - final CupertinoDynamicColor systemGray2; - - /// A third-level shade of grey. - final CupertinoDynamicColor systemGray3; - - /// A fourth-level shade of grey. - final CupertinoDynamicColor systemGray4; - - /// A fifth-level shade of grey. - final CupertinoDynamicColor systemGray5; - - /// A sixth-level shade of grey. - final CupertinoDynamicColor systemGray6; - - /// Resolve every color in the palette using the given [BuildContext], by calling - /// [CupertinoDynamicColor.resolve], and return a new [CupertinoSystemColorsData] - /// with all the resolved colors. - CupertinoSystemColorsData resolveColors(BuildContext context) { - return CupertinoSystemColorsData( - label: CupertinoDynamicColor.resolve(label, context), - secondaryLabel: CupertinoDynamicColor.resolve(secondaryLabel, context), - tertiaryLabel: CupertinoDynamicColor.resolve(tertiaryLabel, context), - quaternaryLabel: CupertinoDynamicColor.resolve(quaternaryLabel, context), - systemFill: CupertinoDynamicColor.resolve(systemFill, context), - secondarySystemFill: CupertinoDynamicColor.resolve(secondarySystemFill, context), - tertiarySystemFill: CupertinoDynamicColor.resolve(tertiarySystemFill, context), - quaternarySystemFill: CupertinoDynamicColor.resolve(quaternarySystemFill, context), - placeholderText: CupertinoDynamicColor.resolve(placeholderText, context), - systemBackground: CupertinoDynamicColor.resolve(systemBackground, context), - secondarySystemBackground: CupertinoDynamicColor.resolve(secondarySystemBackground, context), - tertiarySystemBackground: CupertinoDynamicColor.resolve(tertiarySystemBackground, context), - systemGroupedBackground: CupertinoDynamicColor.resolve(systemGroupedBackground, context), - secondarySystemGroupedBackground: CupertinoDynamicColor.resolve(secondarySystemGroupedBackground, context), - tertiarySystemGroupedBackground: CupertinoDynamicColor.resolve(tertiarySystemGroupedBackground, context), - separator: CupertinoDynamicColor.resolve(separator, context), - opaqueSeparator: CupertinoDynamicColor.resolve(opaqueSeparator, context), - link: CupertinoDynamicColor.resolve(link, context), - systemBlue: CupertinoDynamicColor.resolve(systemBlue, context), - systemGreen: CupertinoDynamicColor.resolve(systemGreen, context), - systemIndigo: CupertinoDynamicColor.resolve(systemIndigo, context), - systemOrange: CupertinoDynamicColor.resolve(systemOrange, context), - systemPink: CupertinoDynamicColor.resolve(systemPink, context), - systemPurple: CupertinoDynamicColor.resolve(systemPurple, context), - systemRed: CupertinoDynamicColor.resolve(systemRed, context), - systemTeal: CupertinoDynamicColor.resolve(systemTeal, context), - systemYellow: CupertinoDynamicColor.resolve(systemYellow, context), - systemGray: CupertinoDynamicColor.resolve(systemGray, context), - systemGray2: CupertinoDynamicColor.resolve(systemGray2, context), - systemGray3: CupertinoDynamicColor.resolve(systemGray3, context), - systemGray4: CupertinoDynamicColor.resolve(systemGray4, context), - systemGray5: CupertinoDynamicColor.resolve(systemGray5, context), - systemGray6: CupertinoDynamicColor.resolve(systemGray6, context), - ); - } - - @override - bool operator ==(dynamic other) { - if (identical(this, other)) - return true; - return other.runtimeType == runtimeType - && other.label == label - && other.secondaryLabel == secondaryLabel - && other.tertiaryLabel == tertiaryLabel - && other.quaternaryLabel == quaternaryLabel - && other.systemFill == systemFill - && other.secondarySystemFill == secondarySystemFill - && other.tertiarySystemFill == tertiarySystemFill - && other.quaternarySystemFill == quaternarySystemFill - && other.placeholderText == placeholderText - && other.systemBackground == systemBackground - && other.secondarySystemBackground == secondarySystemBackground - && other.tertiarySystemBackground == tertiarySystemBackground - && other.systemGroupedBackground == systemGroupedBackground - && other.secondarySystemGroupedBackground == secondarySystemGroupedBackground - && other.tertiarySystemGroupedBackground == tertiarySystemGroupedBackground - && other.separator == separator - && other.opaqueSeparator== opaqueSeparator - && other.link == link - && other.systemBlue == systemBlue - && other.systemGreen == systemGreen - && other.systemIndigo == systemIndigo - && other.systemOrange == systemOrange - && other.systemPink == systemPink - && other.systemPurple == systemPurple - && other.systemRed == systemRed - && other.systemTeal == systemTeal - && other.systemYellow == systemYellow - && other.systemGray == systemGray - && other.systemGray2 == systemGray2 - && other.systemGray3 == systemGray3 - && other.systemGray4 == systemGray4 - && other.systemGray5 == systemGray5 - && other.systemGray6 == systemGray6; - } - - @override - int get hashCode { - return hashList( - [ - label, - secondaryLabel, - tertiaryLabel, - quaternaryLabel, - systemFill, - secondarySystemFill, - tertiarySystemFill, - quaternarySystemFill, - placeholderText, - systemBackground, - secondarySystemBackground, - tertiarySystemBackground, - systemGroupedBackground, - secondarySystemGroupedBackground, - tertiarySystemGroupedBackground, - separator, - opaqueSeparator, - link, - systemBlue, - systemGreen, - systemIndigo, - systemOrange, - systemPink, - systemPurple, - systemRed, - systemTeal, - systemYellow, - systemGray, - systemGray2, - systemGray3, - systemGray4, - systemGray5, - systemGray6, - ]); - } - - /// Creates a copy of this CupertinoSystemColorsData but with the given fields - /// replace with the new values. - CupertinoSystemColorsData copyWith({ - CupertinoDynamicColor label, - CupertinoDynamicColor secondaryLabel, - CupertinoDynamicColor tertiaryLabel, - CupertinoDynamicColor quaternaryLabel, - CupertinoDynamicColor systemFill, - CupertinoDynamicColor secondarySystemFill, - CupertinoDynamicColor tertiarySystemFill, - CupertinoDynamicColor quaternarySystemFill, - CupertinoDynamicColor placeholderText, - CupertinoDynamicColor systemBackground, - CupertinoDynamicColor secondarySystemBackground, - CupertinoDynamicColor tertiarySystemBackground, - CupertinoDynamicColor systemGroupedBackground, - CupertinoDynamicColor secondarySystemGroupedBackground, - CupertinoDynamicColor tertiarySystemGroupedBackground, - CupertinoDynamicColor separator, - CupertinoDynamicColor opaqueSeparator, - CupertinoDynamicColor link, - CupertinoDynamicColor systemBlue, - CupertinoDynamicColor systemGreen, - CupertinoDynamicColor systemIndigo, - CupertinoDynamicColor systemOrange, - CupertinoDynamicColor systemPink, - CupertinoDynamicColor systemPurple, - CupertinoDynamicColor systemRed, - CupertinoDynamicColor systemTeal, - CupertinoDynamicColor systemYellow, - CupertinoDynamicColor systemGray, - CupertinoDynamicColor systemGray2, - CupertinoDynamicColor systemGray3, - CupertinoDynamicColor systemGray4, - CupertinoDynamicColor systemGray5, - CupertinoDynamicColor systemGray6, - }) { - return CupertinoSystemColorsData( - label: label ?? this.label, - secondaryLabel: secondaryLabel ?? this.secondaryLabel, - tertiaryLabel: tertiaryLabel ?? this.tertiaryLabel, - quaternaryLabel: quaternaryLabel ?? this.quaternaryLabel, - systemFill: systemFill ?? this.systemFill, - secondarySystemFill: secondarySystemFill ?? this.secondarySystemFill, - tertiarySystemFill: tertiarySystemFill ?? this.tertiarySystemFill, - quaternarySystemFill: quaternarySystemFill ?? this.quaternarySystemFill, - placeholderText: placeholderText ?? this.placeholderText, - systemBackground: systemBackground ?? this.systemBackground, - secondarySystemBackground: secondarySystemBackground ?? this.secondarySystemBackground, - tertiarySystemBackground: tertiarySystemBackground ?? this.tertiarySystemBackground, - systemGroupedBackground: systemGroupedBackground ?? this.systemGroupedBackground, - secondarySystemGroupedBackground: secondarySystemGroupedBackground ?? this.secondarySystemGroupedBackground, - tertiarySystemGroupedBackground: tertiarySystemGroupedBackground ?? this.tertiarySystemGroupedBackground, - separator: separator ?? this.separator, - opaqueSeparator: opaqueSeparator ?? this.opaqueSeparator, - link: link ?? this.link, - systemBlue: systemBlue ?? this.systemBlue, - systemGreen: systemGreen ?? this.systemGreen, - systemIndigo: systemIndigo ?? this.systemIndigo, - systemOrange: systemOrange ?? this.systemOrange, - systemPink: systemPink ?? this.systemPink, - systemPurple: systemPurple ?? this.systemPurple, - systemRed: systemRed ?? this.systemRed, - systemTeal: systemTeal ?? this.systemTeal, - systemYellow: systemYellow ?? this.systemYellow, - systemGray: systemGray ?? this.systemGray, - systemGray2: systemGray2 ?? this.systemGray2, - systemGray3: systemGray3 ?? this.systemGray3, - systemGray4: systemGray4 ?? this.systemGray4, - systemGray5: systemGray5 ?? this.systemGray5, - systemGray6: systemGray6 ?? this.systemGray6, - ); - } - - @override - void debugFillProperties(DiagnosticPropertiesBuilder properties) { - super.debugFillProperties(properties); - properties.add(ColorProperty('label', label)); - properties.add(ColorProperty('secondaryLabel', secondaryLabel)); - properties.add(ColorProperty('tertiaryLabel', tertiaryLabel)); - properties.add(ColorProperty('quaternaryLabel', quaternaryLabel)); - properties.add(ColorProperty('systemFill', systemFill)); - properties.add(ColorProperty('secondarySystemFill', secondarySystemFill)); - properties.add(ColorProperty('tertiarySystemFill', tertiarySystemFill)); - properties.add(ColorProperty('quaternarySystemFill', quaternarySystemFill)); - properties.add(ColorProperty('placeholderText', placeholderText)); - properties.add(ColorProperty('systemBackground', systemBackground)); - properties.add(ColorProperty('secondarySystemBackground', secondarySystemBackground)); - properties.add(ColorProperty('tertiarySystemBackground', tertiarySystemBackground)); - properties.add(ColorProperty('systemGroupedBackground', systemGroupedBackground)); - properties.add(ColorProperty('secondarySystemGroupedBackground', secondarySystemGroupedBackground)); - properties.add(ColorProperty('tertiarySystemGroupedBackground', tertiarySystemGroupedBackground)); - properties.add(ColorProperty('separator', separator)); - properties.add(ColorProperty('opaqueSeparator', opaqueSeparator)); - properties.add(ColorProperty('link', link)); - properties.add(ColorProperty('systemBlue', systemBlue)); - properties.add(ColorProperty('systemGreen', systemGreen)); - properties.add(ColorProperty('systemIndigo', systemIndigo)); - properties.add(ColorProperty('systemOrange', systemOrange)); - properties.add(ColorProperty('systemPink', systemPink)); - properties.add(ColorProperty('systemPurple', systemPurple)); - properties.add(ColorProperty('systemRed', systemRed)); - properties.add(ColorProperty('systemTeal', systemTeal)); - properties.add(ColorProperty('systemYellow', systemYellow)); - properties.add(ColorProperty('systemGray', systemGray)); - properties.add(ColorProperty('systemGray2', systemGray2)); - properties.add(ColorProperty('systemGray3', systemGray3)); - properties.add(ColorProperty('systemGray4', systemGray4)); - properties.add(ColorProperty('systemGray5', systemGray5)); - properties.add(ColorProperty('systemGray6', systemGray6)); - } -} - -/// Establishes a subtree where iOS system colors resolve to the given data. -/// -/// Typically the given [CupertinoSystemColorsData] is resolved against its own -/// [BuildContext] using [CupertinoSystemColorsData.resolveColors]. -class CupertinoSystemColors extends InheritedWidget { - /// Creates a widget that provides a given [CupertinoSystemColorsData] to its - /// descendants. - const CupertinoSystemColors({ - Key key, - @required CupertinoSystemColorsData data, - Widget child, - }) : _data = data, - assert(data != null), - super(key: key, child: child); - - final CupertinoSystemColorsData _data; - - @override - bool updateShouldNotify(CupertinoSystemColors oldWidget) => oldWidget._data != _data; - - /// Retrieves the iOS system colors from the given [BuildContext]. - /// - /// Falls back to [fromSystem] if a [CupertinoSystemColors] widget couldn't be - /// found in the ancestry tree. When [fromSystem] returns null, setting [useFallbackValues] - /// to true will make the method return a set of default system colors extracted - /// from iOS 13 beta. - static CupertinoSystemColorsData of(BuildContext context, { bool useFallbackValues = true }) { - assert(context != null); - assert(useFallbackValues != null); - final CupertinoSystemColors widget = context.inheritFromWidgetOfExactType(CupertinoSystemColors); - return widget?._data ?? (useFallbackValues ? _kSystemColorsFallback : null); - } -} - -// Fallback System Colors, extracted from: -// https://developer.apple.com/design/human-interface-guidelines/ios/visual-design/color/#dynamic-system-colors -// and iOS 13 beta. -const CupertinoSystemColorsData _kSystemColorsFallback = CupertinoSystemColorsData( - label: CupertinoDynamicColor( - color: Color.fromARGB(255, 0, 0, 0), - darkColor: Color.fromARGB(255, 255, 255, 255), - highContrastColor: Color.fromARGB(255, 0, 0, 0), - darkHighContrastColor: Color.fromARGB(255, 255, 255, 255), - elevatedColor: Color.fromARGB(255, 0, 0, 0), - darkElevatedColor: Color.fromARGB(255, 255, 255, 255), - highContrastElevatedColor: Color.fromARGB(255, 0, 0, 0), - darkHighContrastElevatedColor: Color.fromARGB(255, 255, 255, 255), - ), - secondaryLabel: CupertinoDynamicColor( - color: Color.fromARGB(255, 0, 0, 0), - darkColor: Color.fromARGB(255, 255, 255, 255), - highContrastColor: Color.fromARGB(255, 0, 0, 0), - darkHighContrastColor: Color.fromARGB(255, 255, 255, 255), - elevatedColor: Color.fromARGB(255, 0, 0, 0), - darkElevatedColor: Color.fromARGB(255, 255, 255, 255), - highContrastElevatedColor: Color.fromARGB(255, 0, 0, 0), - darkHighContrastElevatedColor: Color.fromARGB(255, 255, 255, 255), - ), - tertiaryLabel: CupertinoDynamicColor( - color: Color.fromARGB(76, 60, 60, 67), - darkColor: Color.fromARGB(76, 235, 235, 245), - highContrastColor: Color.fromARGB(96, 60, 60, 67), - darkHighContrastColor: Color.fromARGB(96, 235, 235, 245), - elevatedColor: Color.fromARGB(76, 60, 60, 67), - darkElevatedColor: Color.fromARGB(76, 235, 235, 245), - highContrastElevatedColor: Color.fromARGB(96, 60, 60, 67), - darkHighContrastElevatedColor: Color.fromARGB(96, 235, 235, 245), - ), - quaternaryLabel: CupertinoDynamicColor( - color: Color.fromARGB(45, 60, 60, 67), - darkColor: Color.fromARGB(40, 235, 235, 245), - highContrastColor: Color.fromARGB(66, 60, 60, 67), - darkHighContrastColor: Color.fromARGB(61, 235, 235, 245), - elevatedColor: Color.fromARGB(45, 60, 60, 67), - darkElevatedColor: Color.fromARGB(40, 235, 235, 245), - highContrastElevatedColor: Color.fromARGB(66, 60, 60, 67), - darkHighContrastElevatedColor: Color.fromARGB(61, 235, 235, 245), - ), - systemFill: 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), - ), - secondarySystemFill: CupertinoDynamicColor( - color: Color.fromARGB(40, 120, 120, 128), - darkColor: Color.fromARGB(81, 120, 120, 128), - highContrastColor: Color.fromARGB(61, 120, 120, 128), - darkHighContrastColor: Color.fromARGB(102, 120, 120, 128), - elevatedColor: Color.fromARGB(40, 120, 120, 128), - darkElevatedColor: Color.fromARGB(81, 120, 120, 128), - highContrastElevatedColor: Color.fromARGB(61, 120, 120, 128), - darkHighContrastElevatedColor: Color.fromARGB(102, 120, 120, 128), - ), - tertiarySystemFill: CupertinoDynamicColor( - color: Color.fromARGB(30, 118, 118, 128), - darkColor: Color.fromARGB(61, 118, 118, 128), - highContrastColor: Color.fromARGB(51, 118, 118, 128), - darkHighContrastColor: Color.fromARGB(81, 118, 118, 128), - elevatedColor: Color.fromARGB(30, 118, 118, 128), - darkElevatedColor: Color.fromARGB(61, 118, 118, 128), - highContrastElevatedColor: Color.fromARGB(51, 118, 118, 128), - darkHighContrastElevatedColor: Color.fromARGB(81, 118, 118, 128), - ), - quaternarySystemFill: CupertinoDynamicColor( - color: Color.fromARGB(20, 116, 116, 128), - darkColor: Color.fromARGB(45, 118, 118, 128), - highContrastColor: Color.fromARGB(40, 116, 116, 128), - darkHighContrastColor: Color.fromARGB(66, 118, 118, 128), - elevatedColor: Color.fromARGB(20, 116, 116, 128), - darkElevatedColor: Color.fromARGB(45, 118, 118, 128), - highContrastElevatedColor: Color.fromARGB(40, 116, 116, 128), - darkHighContrastElevatedColor: Color.fromARGB(66, 118, 118, 128), - ), - placeholderText: CupertinoDynamicColor( - color: Color.fromARGB(76, 60, 60, 67), - darkColor: Color.fromARGB(76, 235, 235, 245), - highContrastColor: Color.fromARGB(96, 60, 60, 67), - darkHighContrastColor: Color.fromARGB(96, 235, 235, 245), - elevatedColor: Color.fromARGB(76, 60, 60, 67), - darkElevatedColor: Color.fromARGB(76, 235, 235, 245), - highContrastElevatedColor: Color.fromARGB(96, 60, 60, 67), - darkHighContrastElevatedColor: Color.fromARGB(96, 235, 235, 245), - ), - systemBackground: 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), - ), - secondarySystemBackground: CupertinoDynamicColor( - color: Color.fromARGB(255, 242, 242, 247), - darkColor: Color.fromARGB(255, 28, 28, 30), - highContrastColor: Color.fromARGB(255, 235, 235, 240), - darkHighContrastColor: Color.fromARGB(255, 36, 36, 38), - elevatedColor: Color.fromARGB(255, 242, 242, 247), - darkElevatedColor: Color.fromARGB(255, 44, 44, 46), - highContrastElevatedColor: Color.fromARGB(255, 235, 235, 240), - darkHighContrastElevatedColor: Color.fromARGB(255, 54, 54, 56), - ), - tertiarySystemBackground: CupertinoDynamicColor( - color: Color.fromARGB(255, 255, 255, 255), - darkColor: Color.fromARGB(255, 44, 44, 46), - highContrastColor: Color.fromARGB(255, 255, 255, 255), - darkHighContrastColor: Color.fromARGB(255, 54, 54, 56), - elevatedColor: Color.fromARGB(255, 255, 255, 255), - darkElevatedColor: Color.fromARGB(255, 58, 58, 60), - highContrastElevatedColor: Color.fromARGB(255, 255, 255, 255), - darkHighContrastElevatedColor: Color.fromARGB(255, 68, 68, 70), - ), - systemGroupedBackground: CupertinoDynamicColor( - color: Color.fromARGB(255, 242, 242, 247), - darkColor: Color.fromARGB(255, 0, 0, 0), - highContrastColor: Color.fromARGB(255, 235, 235, 240), - darkHighContrastColor: Color.fromARGB(255, 0, 0, 0), - elevatedColor: Color.fromARGB(255, 242, 242, 247), - darkElevatedColor: Color.fromARGB(255, 28, 28, 30), - highContrastElevatedColor: Color.fromARGB(255, 235, 235, 240), - darkHighContrastElevatedColor: Color.fromARGB(255, 36, 36, 38), - ), - secondarySystemGroupedBackground: CupertinoDynamicColor( - color: Color.fromARGB(255, 255, 255, 255), - darkColor: Color.fromARGB(255, 28, 28, 30), - highContrastColor: Color.fromARGB(255, 255, 255, 255), - darkHighContrastColor: Color.fromARGB(255, 36, 36, 38), - elevatedColor: Color.fromARGB(255, 255, 255, 255), - darkElevatedColor: Color.fromARGB(255, 44, 44, 46), - highContrastElevatedColor: Color.fromARGB(255, 255, 255, 255), - darkHighContrastElevatedColor: Color.fromARGB(255, 54, 54, 56), - ), - tertiarySystemGroupedBackground: CupertinoDynamicColor( - color: Color.fromARGB(255, 242, 242, 247), - darkColor: Color.fromARGB(255, 44, 44, 46), - highContrastColor: Color.fromARGB(255, 235, 235, 240), - darkHighContrastColor: Color.fromARGB(255, 54, 54, 56), - elevatedColor: Color.fromARGB(255, 242, 242, 247), - darkElevatedColor: Color.fromARGB(255, 58, 58, 60), - highContrastElevatedColor: Color.fromARGB(255, 235, 235, 240), - darkHighContrastElevatedColor: Color.fromARGB(255, 68, 68, 70), - ), - separator: CupertinoDynamicColor( - color: Color.fromARGB(73, 60, 60, 67), - darkColor: Color.fromARGB(153, 84, 84, 88), - highContrastColor: Color.fromARGB(94, 60, 60, 67), - darkHighContrastColor: Color.fromARGB(173, 84, 84, 88), - elevatedColor: Color.fromARGB(73, 60, 60, 67), - darkElevatedColor: Color.fromARGB(153, 84, 84, 88), - highContrastElevatedColor: Color.fromARGB(94, 60, 60, 67), - darkHighContrastElevatedColor: Color.fromARGB(173, 84, 84, 88), - ), - opaqueSeparator: CupertinoDynamicColor( - color: Color.fromARGB(255, 198, 198, 200), - darkColor: Color.fromARGB(255, 56, 56, 58), - highContrastColor: Color.fromARGB(255, 198, 198, 200), - darkHighContrastColor: Color.fromARGB(255, 56, 56, 58), - elevatedColor: Color.fromARGB(255, 198, 198, 200), - darkElevatedColor: Color.fromARGB(255, 56, 56, 58), - highContrastElevatedColor: Color.fromARGB(255, 198, 198, 200), - darkHighContrastElevatedColor: Color.fromARGB(255, 56, 56, 58), - ), - link: CupertinoDynamicColor( - color: Color.fromARGB(255, 0, 122, 255), - darkColor: Color.fromARGB(255, 9, 132, 255), - highContrastColor: Color.fromARGB(255, 0, 122, 255), - darkHighContrastColor: Color.fromARGB(255, 9, 132, 255), - elevatedColor: Color.fromARGB(255, 0, 122, 255), - darkElevatedColor: Color.fromARGB(255, 9, 132, 255), - highContrastElevatedColor: Color.fromARGB(255, 0, 122, 255), - darkHighContrastElevatedColor: Color.fromARGB(255, 9, 132, 255), - ), - systemBlue: CupertinoDynamicColor.withBrightnessAndContrast( - color: Color.fromARGB(255, 0, 122, 255), - darkColor: Color.fromARGB(255, 10, 132, 255), - highContrastColor: Color.fromARGB(255, 0, 64, 221), - darkHighContrastColor: Color.fromARGB(255, 64, 156, 255), - ), - systemGreen: CupertinoDynamicColor.withBrightnessAndContrast( - color: Color.fromARGB(255, 52, 199, 89), - darkColor: Color.fromARGB(255, 48, 209, 88), - highContrastColor: Color.fromARGB(255, 36, 138, 61), - darkHighContrastColor: Color.fromARGB(255, 48, 219, 91), - ), - systemIndigo: CupertinoDynamicColor.withBrightnessAndContrast( - color: Color.fromARGB(255, 88, 86, 214), - darkColor: Color.fromARGB(255, 94, 92, 230), - highContrastColor: Color.fromARGB(255, 54, 52, 163), - darkHighContrastColor: Color.fromARGB(255, 125, 122, 255), - ), - systemOrange: CupertinoDynamicColor.withBrightnessAndContrast( - color: Color.fromARGB(255, 255, 149, 0), - darkColor: Color.fromARGB(255, 255, 159, 10), - highContrastColor: Color.fromARGB(255, 201, 52, 0), - darkHighContrastColor: Color.fromARGB(255, 255, 179, 64), - ), - systemPink: CupertinoDynamicColor.withBrightnessAndContrast( - color: Color.fromARGB(255, 255, 45, 85), - darkColor: Color.fromARGB(255, 255, 55, 95), - highContrastColor: Color.fromARGB(255, 211, 15, 69), - darkHighContrastColor: Color.fromARGB(255, 255, 100, 130), - ), - systemPurple: CupertinoDynamicColor.withBrightnessAndContrast( - color: Color.fromARGB(255, 175, 82, 222), - darkColor: Color.fromARGB(255, 191, 90, 242), - highContrastColor: Color.fromARGB(255, 137, 68, 171), - darkHighContrastColor: Color.fromARGB(255, 218, 143, 255), - ), - systemRed: CupertinoDynamicColor.withBrightnessAndContrast( - color: Color.fromARGB(255, 255, 59, 48), - darkColor: Color.fromARGB(255, 255, 69, 58), - highContrastColor: Color.fromARGB(255, 215, 0, 21), - darkHighContrastColor: Color.fromARGB(255, 255, 105, 97), - ), - systemTeal: CupertinoDynamicColor.withBrightnessAndContrast( - color: Color.fromARGB(255, 90, 200, 250), - darkColor: Color.fromARGB(255, 100, 210, 255), - highContrastColor: Color.fromARGB(255, 0, 113, 164), - darkHighContrastColor: Color.fromARGB(255, 112, 215, 255), - ), - systemYellow: CupertinoDynamicColor.withBrightnessAndContrast( - color: Color.fromARGB(255, 255, 204, 0), - darkColor: Color.fromARGB(255, 255, 214, 10), - highContrastColor: Color.fromARGB(255, 160, 90, 0), - darkHighContrastColor: Color.fromARGB(255, 255, 212, 38), - ), - systemGray: CupertinoDynamicColor.withBrightnessAndContrast( - color: Color.fromARGB(255, 142, 142, 147), - darkColor: Color.fromARGB(255, 142, 142, 147), - highContrastColor: Color.fromARGB(255, 108, 108, 112), - darkHighContrastColor: Color.fromARGB(255, 174, 174, 178), - ), - systemGray2: CupertinoDynamicColor.withBrightnessAndContrast( - color: Color.fromARGB(255, 174, 174, 178), - darkColor: Color.fromARGB(255, 99, 99, 102), - highContrastColor: Color.fromARGB(255, 142, 142, 147), - darkHighContrastColor: Color.fromARGB(255, 124, 124, 128), - ), - systemGray3: CupertinoDynamicColor.withBrightnessAndContrast( - color: Color.fromARGB(255, 199, 199, 204), - darkColor: Color.fromARGB(255, 72, 72, 74), - highContrastColor: Color.fromARGB(255, 174, 174, 178), - darkHighContrastColor: Color.fromARGB(255, 84, 84, 86), - ), - systemGray4: CupertinoDynamicColor.withBrightnessAndContrast( - color: Color.fromARGB(255, 209, 209, 214), - darkColor: Color.fromARGB(255, 58, 58, 60), - highContrastColor: Color.fromARGB(255, 188, 188, 192), - darkHighContrastColor: Color.fromARGB(255, 68, 68, 70), - ), - systemGray5: CupertinoDynamicColor.withBrightnessAndContrast( - color: Color.fromARGB(255, 229, 229, 234), - darkColor: Color.fromARGB(255, 44, 44, 46), - highContrastColor: Color.fromARGB(255, 216, 216, 220), - darkHighContrastColor: Color.fromARGB(255, 54, 54, 56), - ), - systemGray6: CupertinoDynamicColor.withBrightnessAndContrast( - color: Color.fromARGB(255, 242, 242, 247), - darkColor: Color.fromARGB(255, 28, 28, 30), - highContrastColor: Color.fromARGB(255, 235, 235, 240), - darkHighContrastColor: Color.fromARGB(255, 36, 36, 38), - ), -); diff --git a/packages/flutter/lib/src/cupertino/dialog.dart b/packages/flutter/lib/src/cupertino/dialog.dart index 9764d061dd..6473d051f5 100644 --- a/packages/flutter/lib/src/cupertino/dialog.dart +++ b/packages/flutter/lib/src/cupertino/dialog.dart @@ -360,7 +360,7 @@ class _CupertinoDialogRenderWidget extends RenderObjectWidget { return _RenderCupertinoDialog( dividerThickness: _kDividerThickness / MediaQuery.of(context).devicePixelRatio, isInAccessibilityMode: _isInAccessibilityMode(context), - dividerColor: CupertinoDynamicColor.resolve(CupertinoSystemColors.of(context).separator, context), + dividerColor: CupertinoDynamicColor.resolve(CupertinoColors.separator, context), ); } @@ -368,7 +368,7 @@ class _CupertinoDialogRenderWidget extends RenderObjectWidget { void updateRenderObject(BuildContext context, _RenderCupertinoDialog renderObject) { renderObject ..isInAccessibilityMode = _isInAccessibilityMode(context) - ..dividerColor = CupertinoDynamicColor.resolve(CupertinoSystemColors.of(context).separator, context); + ..dividerColor = CupertinoDynamicColor.resolve(CupertinoColors.separator, context); } @override @@ -858,7 +858,7 @@ class _CupertinoAlertContentSection extends StatelessWidget { ), child: DefaultTextStyle( style: _kCupertinoDialogTitleStyle.copyWith( - color: CupertinoDynamicColor.resolve(CupertinoSystemColors.of(context).label, context), + color: CupertinoDynamicColor.resolve(CupertinoColors.label, context), ), textAlign: TextAlign.center, child: title, @@ -874,7 +874,7 @@ class _CupertinoAlertContentSection extends StatelessWidget { ), child: DefaultTextStyle( style: _kCupertinoDialogContentStyle.copyWith( - color: CupertinoDynamicColor.resolve(CupertinoSystemColors.of(context).label, context), + color: CupertinoDynamicColor.resolve(CupertinoColors.label, context), ), textAlign: TextAlign.center, child: content, @@ -1158,7 +1158,7 @@ class CupertinoDialogAction extends StatelessWidget { Widget build(BuildContext context) { TextStyle style = _kCupertinoDialogActionStyle.copyWith( color: CupertinoDynamicColor.resolve( - isDestructiveAction ? CupertinoSystemColors.of(context).systemRed : CupertinoSystemColors.of(context).systemBlue, + isDestructiveAction ? CupertinoColors.systemRed : CupertinoColors.systemBlue, context, ), ); @@ -1233,7 +1233,7 @@ class _CupertinoDialogActionsRenderWidget extends MultiChildRenderObjectWidget { dividerThickness: _dividerThickness, dialogColor: CupertinoDynamicColor.resolve(_kDialogColor, context), dialogPressedColor: CupertinoDynamicColor.resolve(_kDialogPressedColor, context), - dividerColor: CupertinoDynamicColor.resolve(CupertinoSystemColors.of(context).separator, context), + dividerColor: CupertinoDynamicColor.resolve(CupertinoColors.separator, context), ); } @@ -1246,7 +1246,7 @@ class _CupertinoDialogActionsRenderWidget extends MultiChildRenderObjectWidget { ..dividerThickness = _dividerThickness ..dialogColor = CupertinoDynamicColor.resolve(_kDialogColor, context) ..dialogPressedColor = CupertinoDynamicColor.resolve(_kDialogPressedColor, context) - ..dividerColor = CupertinoDynamicColor.resolve(CupertinoSystemColors.of(context).separator, context); + ..dividerColor = CupertinoDynamicColor.resolve(CupertinoColors.separator, context); } } diff --git a/packages/flutter/lib/src/cupertino/slider.dart b/packages/flutter/lib/src/cupertino/slider.dart index 33da482c48..770d0d5e34 100644 --- a/packages/flutter/lib/src/cupertino/slider.dart +++ b/packages/flutter/lib/src/cupertino/slider.dart @@ -268,7 +268,7 @@ class _CupertinoSliderRenderObjectWidget extends LeafRenderObjectWidget { value: value, divisions: divisions, activeColor: activeColor, - trackColor: CupertinoDynamicColor.resolve(CupertinoSystemColors.of(context).systemFill, context), + trackColor: CupertinoDynamicColor.resolve(CupertinoColors.systemFill, context), onChanged: onChanged, onChangeStart: onChangeStart, onChangeEnd: onChangeEnd, @@ -283,7 +283,7 @@ class _CupertinoSliderRenderObjectWidget extends LeafRenderObjectWidget { ..value = value ..divisions = divisions ..activeColor = activeColor - ..trackColor = CupertinoDynamicColor.resolve(CupertinoSystemColors.of(context).systemFill, context) + ..trackColor = CupertinoDynamicColor.resolve(CupertinoColors.systemFill, context) ..onChanged = onChanged ..onChangeStart = onChangeStart ..onChangeEnd = onChangeEnd diff --git a/packages/flutter/lib/src/cupertino/switch.dart b/packages/flutter/lib/src/cupertino/switch.dart index 57056f6b97..61d616cffc 100644 --- a/packages/flutter/lib/src/cupertino/switch.dart +++ b/packages/flutter/lib/src/cupertino/switch.dart @@ -96,7 +96,7 @@ class CupertinoSwitch extends StatefulWidget { /// The color to use when this switch is on. /// - /// Defaults to [CupertinoSystemColorsData.systemGreen] when null and ignores + /// Defaults to [CupertinoColors.systemGreen] when null and ignores /// the [CupertinoTheme] in accordance to native iOS behavior. final Color activeColor; @@ -141,7 +141,7 @@ class _CupertinoSwitchState extends State with TickerProviderSt child: _CupertinoSwitchRenderObjectWidget( value: widget.value, activeColor: CupertinoDynamicColor.resolve( - widget.activeColor ?? CupertinoSystemColors.of(context).systemGreen, + widget.activeColor ?? CupertinoColors.systemGreen, context, ), onChanged: widget.onChanged, @@ -173,7 +173,7 @@ class _CupertinoSwitchRenderObjectWidget extends LeafRenderObjectWidget { return _RenderCupertinoSwitch( value: value, activeColor: activeColor, - trackColor: CupertinoDynamicColor.resolve(CupertinoSystemColors.of(context).secondarySystemFill, context), + trackColor: CupertinoDynamicColor.resolve(CupertinoColors.secondarySystemFill, context), onChanged: onChanged, textDirection: Directionality.of(context), vsync: vsync, @@ -186,7 +186,7 @@ class _CupertinoSwitchRenderObjectWidget extends LeafRenderObjectWidget { renderObject ..value = value ..activeColor = activeColor - ..trackColor = CupertinoDynamicColor.resolve(CupertinoSystemColors.of(context).secondarySystemFill, context) + ..trackColor = CupertinoDynamicColor.resolve(CupertinoColors.secondarySystemFill, context) ..onChanged = onChanged ..textDirection = Directionality.of(context) ..vsync = vsync diff --git a/packages/flutter/test/cupertino/bottom_tab_bar_test.dart b/packages/flutter/test/cupertino/bottom_tab_bar_test.dart index a3d716ee09..491847217b 100644 --- a/packages/flutter/test/cupertino/bottom_tab_bar_test.dart +++ b/packages/flutter/test/cupertino/bottom_tab_bar_test.dart @@ -217,8 +217,8 @@ void main() { of: find.text('Tab 2'), matching: find.byType(RichText), )); - expect(actualActive.text.style.color, CupertinoColors.activeOrange); + expect(actualActive.text.style.color.value, CupertinoColors.activeOrange.darkColor.value); }); testWidgets('Use active icon', (WidgetTester tester) async { diff --git a/packages/flutter/test/cupertino/button_test.dart b/packages/flutter/test/cupertino/button_test.dart index 7b29978878..c80cb24272 100644 --- a/packages/flutter/test/cupertino/button_test.dart +++ b/packages/flutter/test/cupertino/button_test.dart @@ -327,7 +327,7 @@ void main() { ), ), ); - expect(textStyle.color, CupertinoColors.activeOrange); + expect(textStyle.color.value, CupertinoColors.activeOrange.darkColor.value); await tester.pumpWidget( CupertinoApp( @@ -348,7 +348,7 @@ void main() { matching: find.byType(DecoratedBox), ) ).decoration; - expect(decoration.color, CupertinoColors.activeOrange); + expect(decoration.color.value, CupertinoColors.activeOrange.darkColor.value); }); } diff --git a/packages/flutter/test/cupertino/colors_test.dart b/packages/flutter/test/cupertino/colors_test.dart index 89cea7bc06..f16842f4c6 100644 --- a/packages/flutter/test/cupertino/colors_test.dart +++ b/packages/flutter/test/cupertino/colors_test.dart @@ -415,76 +415,6 @@ void main() { expect(find.byType(DependentWidget), paints..rect(color: color7)); }); - group('CupertinoSystemColors widget', () { - CupertinoSystemColorsData colors; - setUp(() { colors = null; }); - - Widget systemColorGetter(BuildContext context) { - colors = CupertinoSystemColors.of(context); - 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 { - await tester.pumpWidget(CupertinoApp(home: Builder(builder: systemColorGetter))); - expect(colors.systemBackground, kSystemBackground); - }); - - testWidgets('resolves against its own BuildContext', (WidgetTester tester) async { - await tester.pumpWidget( - CupertinoApp( - theme: const CupertinoThemeData(brightness: Brightness.dark), - home: CupertinoUserInterfaceLevel( - data: CupertinoUserInterfaceLevelData.elevated, - child: Builder( - builder: (BuildContext context) { - return CupertinoSystemColors( - child: Builder(builder: systemColorGetter), - data: CupertinoSystemColors.of(context).resolveColors(context), - ); - }, - ), - ), - ), - ); - - // In widget tests the OS colors should fallback to `fallbackValues`. - expect(colors.systemBackground, isNot(kSystemBackground)); - expect(colors.systemBackground.value, kSystemBackground.darkElevatedColor.value); - - colors = null; - // Changing dependencies works. - await tester.pumpWidget( - CupertinoApp( - theme: const CupertinoThemeData(brightness: Brightness.light), - home: Builder( - builder: (BuildContext context) { - return CupertinoUserInterfaceLevel( - data: CupertinoUserInterfaceLevelData.elevated, - child: CupertinoSystemColors( - child: Builder(builder: systemColorGetter), - data: CupertinoSystemColors.of(context).resolveColors(context), - ), - ); - }, - ), - ), - ); - - expect(colors.systemBackground.value, kSystemBackground.elevatedColor.value); - }); - }); - testWidgets('CupertinoDynamicColor used in a CupertinoTheme', (WidgetTester tester) async { CupertinoDynamicColor color; await tester.pumpWidget( @@ -652,114 +582,4 @@ void main() { expect(color, isNot(dynamicColor.darkHighContrastElevatedColor)); }); }); - - group('CupertinoSystemColors', () { - const Color dynamicColor0 = CupertinoDynamicColor.withBrightness( - color: Color(0x00000000), - darkColor: Color(0x00000000), - ); - const Color dynamicColor1 = CupertinoDynamicColor.withBrightness( - color: Color(0x00000001), - darkColor: Color(0x00000000), - ); - - const CupertinoSystemColorsData system0 = CupertinoSystemColorsData( - label: dynamicColor0, - secondaryLabel: dynamicColor0, - tertiaryLabel: dynamicColor0, - quaternaryLabel: dynamicColor0, - systemFill: dynamicColor0, - secondarySystemFill: dynamicColor0, - tertiarySystemFill: dynamicColor0, - quaternarySystemFill: dynamicColor0, - placeholderText: dynamicColor0, - systemBackground: dynamicColor0, - secondarySystemBackground: dynamicColor0, - tertiarySystemBackground: dynamicColor0, - systemGroupedBackground: dynamicColor0, - secondarySystemGroupedBackground: dynamicColor0, - tertiarySystemGroupedBackground: dynamicColor0, - separator: dynamicColor0, - opaqueSeparator: dynamicColor0, - link: dynamicColor0, - systemBlue: dynamicColor0, - systemGreen: dynamicColor0, - systemIndigo: dynamicColor0, - systemOrange: dynamicColor0, - systemPink: dynamicColor0, - systemPurple: dynamicColor0, - systemRed: dynamicColor0, - systemTeal: dynamicColor0, - systemYellow: dynamicColor0, - systemGray: dynamicColor0, - systemGray2: dynamicColor0, - systemGray3: dynamicColor0, - systemGray4: dynamicColor0, - systemGray5: dynamicColor0, - systemGray6: dynamicColor0, - ); - - test('CupertinoSystemColorsData.== and CupertinoSystemColorsData.copyWith', () { - expect(system0, system0); - expect(system0, system0.copyWith()); - expect(system0, system0.copyWith(link: dynamicColor0)); - final CupertinoSystemColorsData withDifferentLink = system0.copyWith(link: dynamicColor1); - expect(withDifferentLink.link, dynamicColor1); - expect(system0, isNot(withDifferentLink)); - }); - - test('CupertinoSystemColorsData.hashCode', () { - expect(system0.hashCode, system0.hashCode); - expect(system0.hashCode, system0.copyWith().hashCode); - expect(system0.hashCode, system0.copyWith(link: dynamicColor0).hashCode); - expect(system0.hashCode, isNot(system0.copyWith(link: dynamicColor1).hashCode)); - }); - - test('CupertinoSystemColorsData.debugFillProperties', () { - final DiagnosticPropertiesBuilder builder = DiagnosticPropertiesBuilder(); - system0.debugFillProperties(builder); - - expect( - builder.properties - .where((DiagnosticsNode node) => !node.isFiltered(DiagnosticLevel.info)) - .map((DiagnosticsNode node) => node.toString()) - .toList(), - [ - 'label: CupertinoDynamicColor(*color = Color(0x00000000)*)', - 'secondaryLabel: CupertinoDynamicColor(*color = Color(0x00000000)*)', - 'tertiaryLabel: CupertinoDynamicColor(*color = Color(0x00000000)*)', - 'quaternaryLabel: CupertinoDynamicColor(*color = Color(0x00000000)*)', - 'systemFill: CupertinoDynamicColor(*color = Color(0x00000000)*)', - 'secondarySystemFill: CupertinoDynamicColor(*color = Color(0x00000000)*)', - 'tertiarySystemFill: CupertinoDynamicColor(*color = Color(0x00000000)*)', - 'quaternarySystemFill: CupertinoDynamicColor(*color = Color(0x00000000)*)', - 'placeholderText: CupertinoDynamicColor(*color = Color(0x00000000)*)', - 'systemBackground: CupertinoDynamicColor(*color = Color(0x00000000)*)', - 'secondarySystemBackground: CupertinoDynamicColor(*color = Color(0x00000000)*)', - 'tertiarySystemBackground: CupertinoDynamicColor(*color = Color(0x00000000)*)', - 'systemGroupedBackground: CupertinoDynamicColor(*color = Color(0x00000000)*)', - 'secondarySystemGroupedBackground: CupertinoDynamicColor(*color = Color(0x00000000)*)', - 'tertiarySystemGroupedBackground: CupertinoDynamicColor(*color = Color(0x00000000)*)', - 'separator: CupertinoDynamicColor(*color = Color(0x00000000)*)', - 'opaqueSeparator: CupertinoDynamicColor(*color = Color(0x00000000)*)', - 'link: CupertinoDynamicColor(*color = Color(0x00000000)*)', - 'systemBlue: CupertinoDynamicColor(*color = Color(0x00000000)*)', - 'systemGreen: CupertinoDynamicColor(*color = Color(0x00000000)*)', - 'systemIndigo: CupertinoDynamicColor(*color = Color(0x00000000)*)', - 'systemOrange: CupertinoDynamicColor(*color = Color(0x00000000)*)', - 'systemPink: CupertinoDynamicColor(*color = Color(0x00000000)*)', - 'systemPurple: CupertinoDynamicColor(*color = Color(0x00000000)*)', - 'systemRed: CupertinoDynamicColor(*color = Color(0x00000000)*)', - 'systemTeal: CupertinoDynamicColor(*color = Color(0x00000000)*)', - 'systemYellow: CupertinoDynamicColor(*color = Color(0x00000000)*)', - 'systemGray: CupertinoDynamicColor(*color = Color(0x00000000)*)', - 'systemGray2: CupertinoDynamicColor(*color = Color(0x00000000)*)', - 'systemGray3: CupertinoDynamicColor(*color = Color(0x00000000)*)', - 'systemGray4: CupertinoDynamicColor(*color = Color(0x00000000)*)', - 'systemGray5: CupertinoDynamicColor(*color = Color(0x00000000)*)', - 'systemGray6: CupertinoDynamicColor(*color = Color(0x00000000)*)', - ], - ); - }); - }); } diff --git a/packages/flutter/test/cupertino/dialog_test.dart b/packages/flutter/test/cupertino/dialog_test.dart index d123992fa4..541b1c692c 100644 --- a/packages/flutter/test/cupertino/dialog_test.dart +++ b/packages/flutter/test/cupertino/dialog_test.dart @@ -60,7 +60,7 @@ void main() { final DefaultTextStyle widget = tester.widget(find.byType(DefaultTextStyle)); - expect(widget.style.color.withAlpha(255), CupertinoColors.destructiveRed); + expect(widget.style.color.withAlpha(255).value, CupertinoColors.destructiveRed.value); }); testWidgets('Dialog dark theme', (WidgetTester tester) async { @@ -183,7 +183,7 @@ void main() { final DefaultTextStyle widget = tester.widget(find.byType(DefaultTextStyle)); - expect(widget.style.color.withAlpha(255), CupertinoColors.destructiveRed); + expect(widget.style.color.withAlpha(255).value, CupertinoColors.destructiveRed.value); expect(widget.style.fontWeight, equals(FontWeight.w600)); }); diff --git a/packages/flutter/test/cupertino/material/tab_scaffold_test.dart b/packages/flutter/test/cupertino/material/tab_scaffold_test.dart index cea9d1c5bc..0e4d43e354 100644 --- a/packages/flutter/test/cupertino/material/tab_scaffold_test.dart +++ b/packages/flutter/test/cupertino/material/tab_scaffold_test.dart @@ -171,7 +171,7 @@ void main() { of: find.text('Tab 2'), matching: find.byType(RichText), )); - expect(tab2.text.style.color, CupertinoColors.destructiveRed); + expect(tab2.text.style.color.value, CupertinoColors.systemRed.darkColor.value); }); testWidgets('Does not lose state when focusing on text input', (WidgetTester tester) async { diff --git a/packages/flutter/test/cupertino/nav_bar_test.dart b/packages/flutter/test/cupertino/nav_bar_test.dart index 521606e0cc..967d6cde82 100644 --- a/packages/flutter/test/cupertino/nav_bar_test.dart +++ b/packages/flutter/test/cupertino/nav_bar_test.dart @@ -188,18 +188,19 @@ void main() { testWidgets('Nav bar respects themes', (WidgetTester tester) async { count = 0x000000; + const CupertinoDynamicColor orange = CupertinoColors.activeOrange; await tester.pumpWidget( CupertinoApp( theme: const CupertinoThemeData(brightness: Brightness.dark), home: CupertinoNavigationBar( leading: CupertinoButton( onPressed: () { }, - child: const _ExpectStyles(color: CupertinoColors.activeOrange, index: 0x000001), + child: _ExpectStyles(color: orange.darkColor, index: 0x000001), ), middle: const _ExpectStyles(color: CupertinoColors.white, index: 0x000100), trailing: CupertinoButton( onPressed: () { }, - child: const _ExpectStyles(color: CupertinoColors.activeOrange, index: 0x010000), + child: _ExpectStyles(color: orange.darkColor, index: 0x010000), ), ), ), @@ -1134,7 +1135,7 @@ class _ExpectStyles extends StatelessWidget { @override Widget build(BuildContext context) { final TextStyle style = DefaultTextStyle.of(context).style; - expect(style.color, color); + expect(style.color.value, color.value); expect(style.fontFamily, '.SF Pro Text'); expect(style.fontSize, 17.0); expect(style.letterSpacing, -0.41); diff --git a/packages/flutter/test/cupertino/nav_bar_transition_test.dart b/packages/flutter/test/cupertino/nav_bar_transition_test.dart index c86855c768..c18edfe422 100644 --- a/packages/flutter/test/cupertino/nav_bar_transition_test.dart +++ b/packages/flutter/test/cupertino/nav_bar_transition_test.dart @@ -246,14 +246,14 @@ void main() { // Move animation further a bit. await tester.pump(const Duration(milliseconds: 200)); - expect(bottomMiddle.text.style.color, const Color(0xffffa01a)); + expect(bottomMiddle.text.style.color, const Color(0xffffa923)); expect(bottomMiddle.text.style.fontWeight, FontWeight.w400); expect(bottomMiddle.text.style.fontFamily, '.SF Pro Text'); expect(bottomMiddle.text.style.letterSpacing, -0.41); checkOpacity(tester, flying(tester, find.text('Page 1')).first, 0.0); - expect(topBackLabel.text.style.color, const Color(0xffffa01a)); + expect(topBackLabel.text.style.color, const Color(0xffffa923)); expect(topBackLabel.text.style.fontWeight, FontWeight.w400); expect(topBackLabel.text.style.fontFamily, '.SF Pro Text'); expect(topBackLabel.text.style.letterSpacing, -0.41); diff --git a/packages/flutter/test/cupertino/segmented_control_test.dart b/packages/flutter/test/cupertino/segmented_control_test.dart index db23eec686..88099e398b 100644 --- a/packages/flutter/test/cupertino/segmented_control_test.dart +++ b/packages/flutter/test/cupertino/segmented_control_test.dart @@ -335,7 +335,7 @@ void main() { IconThemeData iconTheme = IconTheme.of(tester.element(find.byIcon(const IconData(1)))); expect(textStyle.style.color, CupertinoColors.black); - expect(iconTheme.color, CupertinoColors.activeOrange); + expect(iconTheme.color.value, CupertinoColors.activeOrange.darkColor.value); await tester.tap(find.byIcon(const IconData(1))); await tester.pump(); @@ -344,7 +344,7 @@ void main() { textStyle = tester.widget(find.widgetWithText(DefaultTextStyle, 'Child 1').first); iconTheme = IconTheme.of(tester.element(find.byIcon(const IconData(1)))); - expect(textStyle.style.color, CupertinoColors.activeOrange); + expect(textStyle.style.color.value, CupertinoColors.activeOrange.darkColor.value); expect(iconTheme.color, CupertinoColors.black); }, ); diff --git a/packages/flutter/test/cupertino/slider_test.dart b/packages/flutter/test/cupertino/slider_test.dart index aa151896a3..3cb0342391 100644 --- a/packages/flutter/test/cupertino/slider_test.dart +++ b/packages/flutter/test/cupertino/slider_test.dart @@ -412,7 +412,7 @@ void main() { expect( find.byType(CupertinoSlider), // First line it paints is blue. - paints..rrect(color: CupertinoColors.activeBlue), + paints..rrect(color: CupertinoColors.systemBlue.color), ); await tester.pumpWidget( @@ -426,9 +426,11 @@ void main() { ), ), ); + + const CupertinoDynamicColor orange = CupertinoColors.activeOrange; expect( find.byType(CupertinoSlider), - paints..rrect(color: CupertinoColors.activeOrange), + paints..rrect(color: orange.darkColor), ); }); @@ -447,7 +449,7 @@ void main() { ); expect( find.byType(CupertinoSlider), - paints..rrect(color: CupertinoColors.activeGreen), + paints..rrect(color: CupertinoColors.systemGreen.darkColor), ); }); diff --git a/packages/flutter/test/cupertino/tab_scaffold_test.dart b/packages/flutter/test/cupertino/tab_scaffold_test.dart index 43c1ddb44d..dfc9b2e7bd 100644 --- a/packages/flutter/test/cupertino/tab_scaffold_test.dart +++ b/packages/flutter/test/cupertino/tab_scaffold_test.dart @@ -378,7 +378,7 @@ void main() { of: find.text('Tab 2'), matching: find.byType(RichText), )); - expect(tab2.text.style.color, CupertinoColors.destructiveRed); + expect(tab2.text.style.color.value, CupertinoColors.systemRed.darkColor.value); }); testWidgets('Tab contents are padded when there are view insets', (WidgetTester tester) async { diff --git a/packages/flutter/test/cupertino/text_field_test.dart b/packages/flutter/test/cupertino/text_field_test.dart index c34e3bd5c4..943fb31dd2 100644 --- a/packages/flutter/test/cupertino/text_field_test.dart +++ b/packages/flutter/test/cupertino/text_field_test.dart @@ -2807,7 +2807,7 @@ void main() { tester.firstState(find.byType(EditableText)); final RenderEditable renderEditable = editableTextState.renderEditable; - expect(renderEditable.cursorColor, CupertinoColors.activeBlue); + expect(renderEditable.cursorColor, CupertinoColors.activeBlue.color); await tester.pumpWidget( const CupertinoApp( @@ -2819,7 +2819,7 @@ void main() { ); await tester.pump(); - expect(renderEditable.cursorColor, CupertinoColors.activeOrange); + expect(renderEditable.cursorColor, CupertinoColors.activeOrange.darkColor); await tester.pumpWidget( const CupertinoApp( diff --git a/packages/flutter/test/cupertino/theme_test.dart b/packages/flutter/test/cupertino/theme_test.dart index c445b822bb..abd7231db2 100644 --- a/packages/flutter/test/cupertino/theme_test.dart +++ b/packages/flutter/test/cupertino/theme_test.dart @@ -129,10 +129,10 @@ void main() { )); expect(theme.brightness, Brightness.dark); - expect(theme.primaryColor, CupertinoColors.activeGreen); + expect(theme.primaryColor.value, CupertinoColors.systemGreen.darkColor.value); // Now check calculated derivatives. - expect(theme.textTheme.actionTextStyle.color, CupertinoColors.activeGreen); - expect(theme.scaffoldBackgroundColor, CupertinoColors.black); + expect(theme.textTheme.actionTextStyle.color.value, CupertinoColors.systemGreen.darkColor.value); + expect(theme.scaffoldBackgroundColor.value, CupertinoColors.black.value); }, );