Unverified Commit deb4184f authored by LongCatIsLooong's avatar LongCatIsLooong Committed by GitHub

Remove CupertinoSystemColors in favor of CupertinoColors (#40566)

parent 61c6c292
......@@ -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,
......
......@@ -273,50 +273,47 @@ class _CupertinoAppState extends State<CupertinoApp> {
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: <T>(RouteSettings settings, WidgetBuilder builder) =>
CupertinoPageRoute<T>(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: <T>(RouteSettings settings, WidgetBuilder builder) =>
CupertinoPageRoute<T>(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,
);
},
);
},
),
),
),
......
......@@ -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<CupertinoButton> 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<CupertinoButton> 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(
......
......@@ -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);
}
}
......
......@@ -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
......
......@@ -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<CupertinoSwitch> 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
......
......@@ -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 {
......
......@@ -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);
});
}
......
......@@ -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(),
<String>[
'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)*)',
],
);
});
});
}
......@@ -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));
});
......
......@@ -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 {
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
},
);
......
......@@ -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),
);
});
......
......@@ -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 {
......
......@@ -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(
......
......@@ -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);
},
);
......
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