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
f818fbe0
Unverified
Commit
f818fbe0
authored
Oct 08, 2019
by
LongCatIsLooong
Committed by
GitHub
Oct 08, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update CupertinoActivityIndicator colors and gradient (#42032)
parent
c64b236f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
15 deletions
+42
-15
goldens.version
bin/internal/goldens.version
+1
-1
activity_indicator.dart
packages/flutter/lib/src/cupertino/activity_indicator.dart
+10
-6
activity_indicator_test.dart
packages/flutter/test/cupertino/activity_indicator_test.dart
+31
-8
No files found.
bin/internal/goldens.version
View file @
f818fbe0
fc0d93237ae0c7d27c1b8a07927a35434f1cf4e4
7efcec3e8b0bbb6748a992b23a0a89300aa323c7
packages/flutter/lib/src/cupertino/activity_indicator.dart
View file @
f818fbe0
...
@@ -9,10 +9,11 @@ import 'package:flutter/widgets.dart';
...
@@ -9,10 +9,11 @@ import 'package:flutter/widgets.dart';
import
'colors.dart'
;
import
'colors.dart'
;
const
double
_kDefaultIndicatorRadius
=
10.0
;
const
double
_kDefaultIndicatorRadius
=
10.0
;
// Extracted from the large activity indicators in https://developer.apple.com/design/resources/.
// Extracted from iOS 13.2 Beta.
const
Color
_kActiveTickColor
=
CupertinoDynamicColor
.
withBrightness
(
const
Color
_kActiveTickColor
=
CupertinoDynamicColor
.
withBrightness
(
color:
Color
(
0x
99606067
),
color:
Color
(
0x
FF3C3C44
),
darkColor:
Color
(
0x
99
EBEBF5
),
darkColor:
Color
(
0x
FF
EBEBF5
),
);
);
/// An iOS-style activity indicator that spins clockwise.
/// An iOS-style activity indicator that spins clockwise.
...
@@ -96,7 +97,10 @@ class _CupertinoActivityIndicatorState extends State<CupertinoActivityIndicator>
...
@@ -96,7 +97,10 @@ class _CupertinoActivityIndicatorState extends State<CupertinoActivityIndicator>
const
double
_kTwoPI
=
math
.
pi
*
2.0
;
const
double
_kTwoPI
=
math
.
pi
*
2.0
;
const
int
_kTickCount
=
12
;
const
int
_kTickCount
=
12
;
const
int
_kHalfTickCount
=
_kTickCount
~/
2
;
// Alpha values extracted from the native component (for both dark and light mode).
// The list has a length of 12.
const
List
<
int
>
_alphaValues
=
<
int
>[
147
,
131
,
114
,
97
,
81
,
64
,
47
,
47
,
47
,
47
,
47
,
47
];
class
_CupertinoActivityIndicatorPainter
extends
CustomPainter
{
class
_CupertinoActivityIndicatorPainter
extends
CustomPainter
{
_CupertinoActivityIndicatorPainter
({
_CupertinoActivityIndicatorPainter
({
...
@@ -127,8 +131,8 @@ class _CupertinoActivityIndicatorPainter extends CustomPainter {
...
@@ -127,8 +131,8 @@ class _CupertinoActivityIndicatorPainter extends CustomPainter {
final
int
activeTick
=
(
_kTickCount
*
position
.
value
).
floor
();
final
int
activeTick
=
(
_kTickCount
*
position
.
value
).
floor
();
for
(
int
i
=
0
;
i
<
_kTickCount
;
++
i
)
{
for
(
int
i
=
0
;
i
<
_kTickCount
;
++
i
)
{
final
double
t
=
(((
i
+
activeTick
)
%
_kTickCount
)
/
_kHalfTickCount
).
clamp
(
0.0
,
1.0
)
;
final
int
t
=
(
i
+
activeTick
)
%
_kTickCount
;
paint
.
color
=
activeColor
.
with
Opacity
((
t
*
activeColor
.
opacity
).
clamp
(
0
,
1
)
);
paint
.
color
=
activeColor
.
with
Alpha
(
_alphaValues
[
t
]
);
canvas
.
drawRRect
(
tickFundamentalRRect
,
paint
);
canvas
.
drawRRect
(
tickFundamentalRRect
,
paint
);
canvas
.
rotate
(-
_kTwoPI
/
_kTickCount
);
canvas
.
rotate
(-
_kTwoPI
/
_kTickCount
);
}
}
...
...
packages/flutter/test/cupertino/activity_indicator_test.dart
View file @
f818fbe0
...
@@ -27,23 +27,46 @@ void main() {
...
@@ -27,23 +27,46 @@ void main() {
});
});
testWidgets
(
'Activity indicator dark mode'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Activity indicator dark mode'
,
(
WidgetTester
tester
)
async
{
final
Key
key
=
UniqueKey
();
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
const
MediaQuery
(
Center
(
data:
MediaQueryData
(
platformBrightness:
Brightness
.
light
),
child:
MediaQuery
(
child:
CupertinoActivityIndicator
(),
data:
const
MediaQueryData
(
platformBrightness:
Brightness
.
light
),
child:
RepaintBoundary
(
key:
key
,
child:
Container
(
color:
CupertinoColors
.
white
,
child:
const
CupertinoActivityIndicator
(
animating:
false
,
radius:
35
),
),
),
),
),
),
);
);
expect
(
find
.
byType
(
CupertinoActivityIndicator
),
paints
..
rrect
(
color:
const
Color
(
0x99606067
)));
await
expectLater
(
find
.
byKey
(
key
),
matchesGoldenFile
(
'activityIndicator.paused.light.png'
,
version:
0
),
);
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
const
MediaQuery
(
Center
(
data:
MediaQueryData
(
platformBrightness:
Brightness
.
dark
),
child:
MediaQuery
(
child:
CupertinoActivityIndicator
(),
data:
const
MediaQueryData
(
platformBrightness:
Brightness
.
dark
),
child:
RepaintBoundary
(
key:
key
,
child:
Container
(
color:
CupertinoColors
.
black
,
child:
const
CupertinoActivityIndicator
(
animating:
false
,
radius:
35
),
),
),
),
),
),
);
);
expect
(
find
.
byType
(
CupertinoActivityIndicator
),
paints
..
rrect
(
color:
const
Color
(
0x99EBEBF5
)));
await
expectLater
(
find
.
byKey
(
key
),
matchesGoldenFile
(
'activityIndicator.paused.dark.png'
,
version:
0
),
);
});
});
// Regression test for https://github.com/flutter/flutter/issues/41345.
// Regression test for https://github.com/flutter/flutter/issues/41345.
...
...
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