Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
deb4184f
Unverified
Commit
deb4184f
authored
Sep 25, 2019
by
LongCatIsLooong
Committed by
GitHub
Sep 25, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove CupertinoSystemColors in favor of CupertinoColors (#40566)
parent
61c6c292
Changes
19
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
795 additions
and
1275 deletions
+795
-1275
action_sheet.dart
packages/flutter/lib/src/cupertino/action_sheet.dart
+2
-2
app.dart
packages/flutter/lib/src/cupertino/app.dart
+41
-44
button.dart
packages/flutter/lib/src/cupertino/button.dart
+8
-6
colors.dart
packages/flutter/lib/src/cupertino/colors.dart
+706
-1008
dialog.dart
packages/flutter/lib/src/cupertino/dialog.dart
+7
-7
slider.dart
packages/flutter/lib/src/cupertino/slider.dart
+2
-2
switch.dart
packages/flutter/lib/src/cupertino/switch.dart
+4
-4
bottom_tab_bar_test.dart
packages/flutter/test/cupertino/bottom_tab_bar_test.dart
+1
-1
button_test.dart
packages/flutter/test/cupertino/button_test.dart
+2
-2
colors_test.dart
packages/flutter/test/cupertino/colors_test.dart
+0
-180
dialog_test.dart
packages/flutter/test/cupertino/dialog_test.dart
+2
-2
tab_scaffold_test.dart
...es/flutter/test/cupertino/material/tab_scaffold_test.dart
+1
-1
nav_bar_test.dart
packages/flutter/test/cupertino/nav_bar_test.dart
+4
-3
nav_bar_transition_test.dart
packages/flutter/test/cupertino/nav_bar_transition_test.dart
+2
-2
segmented_control_test.dart
packages/flutter/test/cupertino/segmented_control_test.dart
+2
-2
slider_test.dart
packages/flutter/test/cupertino/slider_test.dart
+5
-3
tab_scaffold_test.dart
packages/flutter/test/cupertino/tab_scaffold_test.dart
+1
-1
text_field_test.dart
packages/flutter/test/cupertino/text_field_test.dart
+2
-2
theme_test.dart
packages/flutter/test/cupertino/theme_test.dart
+3
-3
No files found.
packages/flutter/lib/src/cupertino/action_sheet.dart
View file @
deb4184f
...
...
@@ -296,7 +296,7 @@ class CupertinoActionSheetAction extends StatelessWidget {
Widget
build
(
BuildContext
context
)
{
TextStyle
style
=
_kActionSheetActionStyle
.
copyWith
(
color:
isDestructiveAction
?
Cupertino
SystemColors
.
of
(
context
).
systemRed
?
Cupertino
DynamicColor
.
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
:
Cupertino
SystemColors
.
of
(
context
)
.
secondarySystemGroupedBackground
;
:
Cupertino
Colors
.
secondarySystemGroupedBackground
;
return
GestureDetector
(
excludeFromSemantics:
true
,
onTapDown:
_onTapDown
,
...
...
packages/flutter/lib/src/cupertino/app.dart
View file @
deb4184f
...
...
@@ -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
,
);
},
);
},
),
),
),
...
...
packages/flutter/lib/src/cupertino/button.dart
View file @
deb4184f
...
...
@@ -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 [Cupertino
System
Colors.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
(
Cupertino
SystemColors
.
of
(
context
)
.
placeholderText
,
context
);
:
CupertinoDynamicColor
.
resolve
(
Cupertino
Colors
.
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
(
...
...
packages/flutter/lib/src/cupertino/colors.dart
View file @
deb4184f
This diff is collapsed.
Click to expand it.
packages/flutter/lib/src/cupertino/dialog.dart
View file @
deb4184f
...
...
@@ -360,7 +360,7 @@ class _CupertinoDialogRenderWidget extends RenderObjectWidget {
return
_RenderCupertinoDialog
(
dividerThickness:
_kDividerThickness
/
MediaQuery
.
of
(
context
).
devicePixelRatio
,
isInAccessibilityMode:
_isInAccessibilityMode
(
context
),
dividerColor:
CupertinoDynamicColor
.
resolve
(
Cupertino
SystemColors
.
of
(
context
)
.
separator
,
context
),
dividerColor:
CupertinoDynamicColor
.
resolve
(
Cupertino
Colors
.
separator
,
context
),
);
}
...
...
@@ -368,7 +368,7 @@ class _CupertinoDialogRenderWidget extends RenderObjectWidget {
void
updateRenderObject
(
BuildContext
context
,
_RenderCupertinoDialog
renderObject
)
{
renderObject
..
isInAccessibilityMode
=
_isInAccessibilityMode
(
context
)
..
dividerColor
=
CupertinoDynamicColor
.
resolve
(
Cupertino
SystemColors
.
of
(
context
)
.
separator
,
context
);
..
dividerColor
=
CupertinoDynamicColor
.
resolve
(
Cupertino
Colors
.
separator
,
context
);
}
@override
...
...
@@ -858,7 +858,7 @@ class _CupertinoAlertContentSection extends StatelessWidget {
),
child:
DefaultTextStyle
(
style:
_kCupertinoDialogTitleStyle
.
copyWith
(
color:
CupertinoDynamicColor
.
resolve
(
Cupertino
SystemColors
.
of
(
context
)
.
label
,
context
),
color:
CupertinoDynamicColor
.
resolve
(
Cupertino
Colors
.
label
,
context
),
),
textAlign:
TextAlign
.
center
,
child:
title
,
...
...
@@ -874,7 +874,7 @@ class _CupertinoAlertContentSection extends StatelessWidget {
),
child:
DefaultTextStyle
(
style:
_kCupertinoDialogContentStyle
.
copyWith
(
color:
CupertinoDynamicColor
.
resolve
(
Cupertino
SystemColors
.
of
(
context
)
.
label
,
context
),
color:
CupertinoDynamicColor
.
resolve
(
Cupertino
Colors
.
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
?
Cupertino
SystemColors
.
of
(
context
).
systemRed
:
CupertinoSystemColors
.
of
(
context
)
.
systemBlue
,
isDestructiveAction
?
Cupertino
Colors
.
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
(
Cupertino
SystemColors
.
of
(
context
)
.
separator
,
context
),
dividerColor:
CupertinoDynamicColor
.
resolve
(
Cupertino
Colors
.
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
(
Cupertino
SystemColors
.
of
(
context
)
.
separator
,
context
);
..
dividerColor
=
CupertinoDynamicColor
.
resolve
(
Cupertino
Colors
.
separator
,
context
);
}
}
...
...
packages/flutter/lib/src/cupertino/slider.dart
View file @
deb4184f
...
...
@@ -268,7 +268,7 @@ class _CupertinoSliderRenderObjectWidget extends LeafRenderObjectWidget {
value:
value
,
divisions:
divisions
,
activeColor:
activeColor
,
trackColor:
CupertinoDynamicColor
.
resolve
(
Cupertino
SystemColors
.
of
(
context
)
.
systemFill
,
context
),
trackColor:
CupertinoDynamicColor
.
resolve
(
Cupertino
Colors
.
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
(
Cupertino
SystemColors
.
of
(
context
)
.
systemFill
,
context
)
..
trackColor
=
CupertinoDynamicColor
.
resolve
(
Cupertino
Colors
.
systemFill
,
context
)
..
onChanged
=
onChanged
..
onChangeStart
=
onChangeStart
..
onChangeEnd
=
onChangeEnd
...
...
packages/flutter/lib/src/cupertino/switch.dart
View file @
deb4184f
...
...
@@ -96,7 +96,7 @@ class CupertinoSwitch extends StatefulWidget {
/// The color to use when this switch is on.
///
/// Defaults to [Cupertino
SystemColorsData
.systemGreen] when null and ignores
/// Defaults to [Cupertino
Colors
.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
??
Cupertino
SystemColors
.
of
(
context
)
.
systemGreen
,
widget
.
activeColor
??
Cupertino
Colors
.
systemGreen
,
context
,
),
onChanged:
widget
.
onChanged
,
...
...
@@ -173,7 +173,7 @@ class _CupertinoSwitchRenderObjectWidget extends LeafRenderObjectWidget {
return
_RenderCupertinoSwitch
(
value:
value
,
activeColor:
activeColor
,
trackColor:
CupertinoDynamicColor
.
resolve
(
Cupertino
SystemColors
.
of
(
context
)
.
secondarySystemFill
,
context
),
trackColor:
CupertinoDynamicColor
.
resolve
(
Cupertino
Colors
.
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
(
Cupertino
SystemColors
.
of
(
context
)
.
secondarySystemFill
,
context
)
..
trackColor
=
CupertinoDynamicColor
.
resolve
(
Cupertino
Colors
.
secondarySystemFill
,
context
)
..
onChanged
=
onChanged
..
textDirection
=
Directionality
.
of
(
context
)
..
vsync
=
vsync
...
...
packages/flutter/test/cupertino/bottom_tab_bar_test.dart
View file @
deb4184f
...
...
@@ -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
{
...
...
packages/flutter/test/cupertino/button_test.dart
View file @
deb4184f
...
...
@@ -327,7 +327,7 @@ void main() {
),
),
);
expect
(
textStyle
.
color
,
CupertinoColors
.
activeOrang
e
);
expect
(
textStyle
.
color
.
value
,
CupertinoColors
.
activeOrange
.
darkColor
.
valu
e
);
await
tester
.
pumpWidget
(
CupertinoApp
(
...
...
@@ -348,7 +348,7 @@ void main() {
matching:
find
.
byType
(
DecoratedBox
),
)
).
decoration
;
expect
(
decoration
.
color
,
CupertinoColors
.
activeOrang
e
);
expect
(
decoration
.
color
.
value
,
CupertinoColors
.
activeOrange
.
darkColor
.
valu
e
);
});
}
...
...
packages/flutter/test/cupertino/colors_test.dart
View file @
deb4184f
...
...
@@ -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)*)'
,
],
);
});
});
}
packages/flutter/test/cupertino/dialog_test.dart
View file @
deb4184f
...
...
@@ -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
));
});
...
...
packages/flutter/test/cupertino/material/tab_scaffold_test.dart
View file @
deb4184f
...
...
@@ -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
{
...
...
packages/flutter/test/cupertino/nav_bar_test.dart
View file @
deb4184f
...
...
@@ -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
);
...
...
packages/flutter/test/cupertino/nav_bar_transition_test.dart
View file @
deb4184f
...
...
@@ -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
(
0xffffa
01a
));
expect
(
bottomMiddle
.
text
.
style
.
color
,
const
Color
(
0xffffa
923
));
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
(
0xffffa
01a
));
expect
(
topBackLabel
.
text
.
style
.
color
,
const
Color
(
0xffffa
923
));
expect
(
topBackLabel
.
text
.
style
.
fontWeight
,
FontWeight
.
w400
);
expect
(
topBackLabel
.
text
.
style
.
fontFamily
,
'.SF Pro Text'
);
expect
(
topBackLabel
.
text
.
style
.
letterSpacing
,
-
0.41
);
...
...
packages/flutter/test/cupertino/segmented_control_test.dart
View file @
deb4184f
...
...
@@ -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
.
activeOrang
e
);
expect
(
iconTheme
.
color
.
value
,
CupertinoColors
.
activeOrange
.
darkColor
.
valu
e
);
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
.
activeOrang
e
);
expect
(
textStyle
.
style
.
color
.
value
,
CupertinoColors
.
activeOrange
.
darkColor
.
valu
e
);
expect
(
iconTheme
.
color
,
CupertinoColors
.
black
);
},
);
...
...
packages/flutter/test/cupertino/slider_test.dart
View file @
deb4184f
...
...
@@ -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
),
);
});
...
...
packages/flutter/test/cupertino/tab_scaffold_test.dart
View file @
deb4184f
...
...
@@ -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
{
...
...
packages/flutter/test/cupertino/text_field_test.dart
View file @
deb4184f
...
...
@@ -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
(
...
...
packages/flutter/test/cupertino/theme_test.dart
View file @
deb4184f
...
...
@@ -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
);
},
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment