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
c2e91ad4
Unverified
Commit
c2e91ad4
authored
Sep 21, 2020
by
Jason C.H
Committed by
GitHub
Sep 21, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove deprecated activity indicator (#66020)
parent
e0afee5b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
73 deletions
+14
-73
activity_indicator.dart
packages/flutter/lib/src/cupertino/activity_indicator.dart
+14
-73
No files found.
packages/flutter/lib/src/cupertino/activity_indicator.dart
View file @
c2e91ad4
...
...
@@ -18,19 +18,6 @@ const Color _kActiveTickColor = CupertinoDynamicColor.withBrightness(
darkColor:
Color
(
0xFFEBEBF5
),
);
/// Define the iOS version style of [CupertinoActivityIndicator].
enum
CupertinoActivityIndicatorIOSVersionStyle
{
/// The style that is used in iOS13 and earlier (12 points).
@Deprecated
(
'Use iOS14 instead. '
'This feature was deprecated after v1.21.0-1.0.pre.'
)
iOS13
,
/// The style that was introduced in iOS14 (8 points).
iOS14
,
}
/// An iOS-style activity indicator that spins clockwise.
///
/// {@youtube 560 315 https://www.youtube.com/watch?v=AENVH-ZqKDQ}
...
...
@@ -44,11 +31,6 @@ class CupertinoActivityIndicator extends StatefulWidget {
Key
key
,
this
.
animating
=
true
,
this
.
radius
=
_kDefaultIndicatorRadius
,
@Deprecated
(
'Leave this field default to use latest style. '
'This feature was deprecated after v1.21.0-1.0.pre.'
)
this
.
iOSVersionStyle
=
CupertinoActivityIndicatorIOSVersionStyle
.
iOS14
,
})
:
assert
(
animating
!=
null
),
assert
(
radius
!=
null
),
assert
(
radius
>
0.0
),
...
...
@@ -65,11 +47,6 @@ class CupertinoActivityIndicator extends StatefulWidget {
Key
key
,
this
.
radius
=
_kDefaultIndicatorRadius
,
this
.
progress
=
1.0
,
@Deprecated
(
'Leave this field default to use latest style. '
'This feature was deprecated after v1.21.0-1.0.pre.'
)
this
.
iOSVersionStyle
=
CupertinoActivityIndicatorIOSVersionStyle
.
iOS14
,
})
:
assert
(
radius
!=
null
),
assert
(
radius
>
0.0
),
assert
(
progress
!=
null
),
...
...
@@ -96,12 +73,6 @@ class CupertinoActivityIndicator extends StatefulWidget {
/// Defaults to 1.0. Must be between 0.0 and 1.0 inclusive, and cannot be null.
final
double
progress
;
/// The iOS version style of activity indicator.
///
/// Defaults to [CupertinoActivityIndicatorIOSVersionStyle.iOS14].
// TODO(ctrysbita): Deprecate after official release, https://github.com/flutter/flutter/issues/62521
final
CupertinoActivityIndicatorIOSVersionStyle
iOSVersionStyle
;
@override
_CupertinoActivityIndicatorState
createState
()
=>
_CupertinoActivityIndicatorState
();
...
...
@@ -153,7 +124,6 @@ class _CupertinoActivityIndicatorState extends State<CupertinoActivityIndicator>
CupertinoDynamicColor
.
resolve
(
_kActiveTickColor
,
context
),
radius:
widget
.
radius
,
progress:
widget
.
progress
,
iOSVersionStyle:
widget
.
iOSVersionStyle
,
),
),
);
...
...
@@ -164,37 +134,16 @@ const double _kTwoPI = math.pi * 2.0;
/// Alpha values extracted from the native component (for both dark and light mode) to
/// draw the spinning ticks.
const
Map
<
CupertinoActivityIndicatorIOSVersionStyle
,
List
<
int
>>
_kAlphaValuesMap
=
<
CupertinoActivityIndicatorIOSVersionStyle
,
List
<
int
>>{
/// The order of these values is designed to match the first frame of the iOS activity indicator which
/// has the most prominent tick at 9 o'clock.
CupertinoActivityIndicatorIOSVersionStyle
.
iOS13
:
<
int
>[
47
,
47
,
47
,
47
,
64
,
81
,
97
,
114
,
131
,
147
,
47
,
47
],
/// Alpha values for new style that introduced in iOS14.
CupertinoActivityIndicatorIOSVersionStyle
.
iOS14
:
<
int
>[
47
,
47
,
47
,
47
,
72
,
97
,
122
,
147
,
],
};
const
List
<
int
>
_kAlphaValues
=
<
int
>[
47
,
47
,
47
,
47
,
72
,
97
,
122
,
147
,
];
/// The alpha value that is used to draw the partially revealed ticks.
const
int
_partiallyRevealedAlpha
=
147
;
...
...
@@ -205,16 +154,9 @@ class _CupertinoActivityIndicatorPainter extends CustomPainter {
@required
this
.
activeColor
,
@required
this
.
radius
,
@required
this
.
progress
,
CupertinoActivityIndicatorIOSVersionStyle
iOSVersionStyle
=
CupertinoActivityIndicatorIOSVersionStyle
.
iOS13
,
})
:
alphaValues
=
_kAlphaValuesMap
[
iOSVersionStyle
],
tickFundamentalRRect
=
RRect
.
fromLTRBXY
(
})
:
tickFundamentalRRect
=
RRect
.
fromLTRBXY
(
-
radius
/
_kDefaultIndicatorRadius
,
-
radius
/
(
iOSVersionStyle
==
CupertinoActivityIndicatorIOSVersionStyle
.
iOS14
?
3.0
:
2.0
),
-
radius
/
3.0
,
radius
/
_kDefaultIndicatorRadius
,
-
radius
,
radius
/
_kDefaultIndicatorRadius
,
...
...
@@ -227,13 +169,12 @@ class _CupertinoActivityIndicatorPainter extends CustomPainter {
final
double
radius
;
final
double
progress
;
final
List
<
int
>
alphaValues
;
final
RRect
tickFundamentalRRect
;
@override
void
paint
(
Canvas
canvas
,
Size
size
)
{
final
Paint
paint
=
Paint
();
final
int
tickCount
=
a
lphaValues
.
length
;
final
int
tickCount
=
_kA
lphaValues
.
length
;
canvas
.
save
();
canvas
.
translate
(
size
.
width
/
2.0
,
size
.
height
/
2.0
);
...
...
@@ -243,7 +184,7 @@ class _CupertinoActivityIndicatorPainter extends CustomPainter {
for
(
int
i
=
0
;
i
<
tickCount
*
progress
;
++
i
)
{
final
int
t
=
(
i
-
activeTick
)
%
tickCount
;
paint
.
color
=
activeColor
.
withAlpha
(
progress
<
1
?
_partiallyRevealedAlpha
:
a
lphaValues
[
t
]);
.
withAlpha
(
progress
<
1
?
_partiallyRevealedAlpha
:
_kA
lphaValues
[
t
]);
canvas
.
drawRRect
(
tickFundamentalRRect
,
paint
);
canvas
.
rotate
(
_kTwoPI
/
tickCount
);
}
...
...
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