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
acb61ace
Unverified
Commit
acb61ace
authored
Nov 10, 2021
by
Taha Tesser
Committed by
GitHub
Nov 10, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[CupertinoActivityIndicator] Add `color` parameter (#92172)
parent
d196fe0f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
64 additions
and
3 deletions
+64
-3
activity_indicator.dart
packages/flutter/lib/src/cupertino/activity_indicator.dart
+8
-2
progress_indicator.dart
packages/flutter/lib/src/material/progress_indicator.dart
+2
-1
activity_indicator_test.dart
packages/flutter/test/cupertino/activity_indicator_test.dart
+26
-0
progress_indicator_test.dart
packages/flutter/test/material/progress_indicator_test.dart
+28
-0
No files found.
packages/flutter/lib/src/cupertino/activity_indicator.dart
View file @
acb61ace
...
@@ -27,6 +27,7 @@ class CupertinoActivityIndicator extends StatefulWidget {
...
@@ -27,6 +27,7 @@ class CupertinoActivityIndicator extends StatefulWidget {
/// Creates an iOS-style activity indicator that spins clockwise.
/// Creates an iOS-style activity indicator that spins clockwise.
const
CupertinoActivityIndicator
({
const
CupertinoActivityIndicator
({
Key
?
key
,
Key
?
key
,
this
.
color
,
this
.
animating
=
true
,
this
.
animating
=
true
,
this
.
radius
=
_kDefaultIndicatorRadius
,
this
.
radius
=
_kDefaultIndicatorRadius
,
})
:
assert
(
animating
!=
null
),
})
:
assert
(
animating
!=
null
),
...
@@ -43,6 +44,7 @@ class CupertinoActivityIndicator extends StatefulWidget {
...
@@ -43,6 +44,7 @@ class CupertinoActivityIndicator extends StatefulWidget {
/// to 1.0.
/// to 1.0.
const
CupertinoActivityIndicator
.
partiallyRevealed
({
const
CupertinoActivityIndicator
.
partiallyRevealed
({
Key
?
key
,
Key
?
key
,
this
.
color
,
this
.
radius
=
_kDefaultIndicatorRadius
,
this
.
radius
=
_kDefaultIndicatorRadius
,
this
.
progress
=
1.0
,
this
.
progress
=
1.0
,
})
:
assert
(
radius
!=
null
),
})
:
assert
(
radius
!=
null
),
...
@@ -53,6 +55,11 @@ class CupertinoActivityIndicator extends StatefulWidget {
...
@@ -53,6 +55,11 @@ class CupertinoActivityIndicator extends StatefulWidget {
animating
=
false
,
animating
=
false
,
super
(
key:
key
);
super
(
key:
key
);
/// Color of the activity indicator.
///
/// Defaults to color extracted from native iOS.
final
Color
?
color
;
/// Whether the activity indicator is running its animation.
/// Whether the activity indicator is running its animation.
///
///
/// Defaults to true.
/// Defaults to true.
...
@@ -117,8 +124,7 @@ class _CupertinoActivityIndicatorState extends State<CupertinoActivityIndicator>
...
@@ -117,8 +124,7 @@ class _CupertinoActivityIndicatorState extends State<CupertinoActivityIndicator>
child:
CustomPaint
(
child:
CustomPaint
(
painter:
_CupertinoActivityIndicatorPainter
(
painter:
_CupertinoActivityIndicatorPainter
(
position:
_controller
,
position:
_controller
,
activeColor:
activeColor:
widget
.
color
??
CupertinoDynamicColor
.
resolve
(
_kActiveTickColor
,
context
),
CupertinoDynamicColor
.
resolve
(
_kActiveTickColor
,
context
),
radius:
widget
.
radius
,
radius:
widget
.
radius
,
progress:
widget
.
progress
,
progress:
widget
.
progress
,
),
),
...
...
packages/flutter/lib/src/material/progress_indicator.dart
View file @
acb61ace
...
@@ -594,7 +594,8 @@ class _CircularProgressIndicatorState extends State<CircularProgressIndicator> w
...
@@ -594,7 +594,8 @@ class _CircularProgressIndicatorState extends State<CircularProgressIndicator> w
}
}
Widget
_buildCupertinoIndicator
(
BuildContext
context
)
{
Widget
_buildCupertinoIndicator
(
BuildContext
context
)
{
return
CupertinoActivityIndicator
(
key:
widget
.
key
);
final
Color
?
tickColor
=
widget
.
backgroundColor
;
return
CupertinoActivityIndicator
(
key:
widget
.
key
,
color:
tickColor
);
}
}
Widget
_buildMaterialIndicator
(
BuildContext
context
,
double
headValue
,
double
tailValue
,
double
offsetValue
,
double
rotationValue
)
{
Widget
_buildMaterialIndicator
(
BuildContext
context
,
double
headValue
,
double
tailValue
,
double
offsetValue
,
double
rotationValue
)
{
...
...
packages/flutter/test/cupertino/activity_indicator_test.dart
View file @
acb61ace
...
@@ -158,6 +158,32 @@ void main() {
...
@@ -158,6 +158,32 @@ void main() {
..
rrect
(
rrect:
const
RRect
.
fromLTRBXY
(-
10
,
-
100
/
3
,
10
,
-
100
,
10
,
10
)),
..
rrect
(
rrect:
const
RRect
.
fromLTRBXY
(-
10
,
-
100
/
3
,
10
,
-
100
,
10
,
10
)),
);
);
});
});
testWidgets
(
'Can specify color'
,
(
WidgetTester
tester
)
async
{
final
Key
key
=
UniqueKey
();
await
tester
.
pumpWidget
(
Center
(
child:
RepaintBoundary
(
key:
key
,
child:
Container
(
color:
CupertinoColors
.
white
,
child:
const
CupertinoActivityIndicator
(
animating:
false
,
color:
Color
(
0xFF5D3FD3
),
radius:
100
,
),
),
),
),
);
expect
(
find
.
byType
(
CupertinoActivityIndicator
),
paints
..
rrect
(
rrect:
const
RRect
.
fromLTRBXY
(-
10
,
-
100
/
3
,
10
,
-
100
,
10
,
10
),
color:
const
Color
(
0x935d3fd3
)),
);
});
}
}
Widget
buildCupertinoActivityIndicator
(
[
bool
?
animating
])
{
Widget
buildCupertinoActivityIndicator
(
[
bool
?
animating
])
{
...
...
packages/flutter/test/material/progress_indicator_test.dart
View file @
acb61ace
...
@@ -822,6 +822,34 @@ void main() {
...
@@ -822,6 +822,34 @@ void main() {
}),
}),
);
);
testWidgets
(
'Adaptive CircularProgressIndicator can use backgroundColor to change tick color for iOS'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
const
MaterialApp
(
home:
Scaffold
(
body:
Material
(
child:
CircularProgressIndicator
.
adaptive
(
backgroundColor:
Color
(
0xFF5D3FD3
),
),
),
),
),
);
expect
(
find
.
byType
(
CupertinoActivityIndicator
),
paints
..
rrect
(
rrect:
const
RRect
.
fromLTRBXY
(-
1
,
-
10
/
3
,
1
,
-
10
,
1
,
1
),
color:
const
Color
(
0x935D3FD3
)),
);
},
variant:
const
TargetPlatformVariant
(<
TargetPlatform
>
{
TargetPlatform
.
iOS
,
TargetPlatform
.
macOS
,
}),
);
testWidgets
(
testWidgets
(
'Adaptive CircularProgressIndicator does not display CupertinoActivityIndicator in non-iOS'
,
'Adaptive CircularProgressIndicator does not display CupertinoActivityIndicator in non-iOS'
,
(
WidgetTester
tester
)
async
{
(
WidgetTester
tester
)
async
{
...
...
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