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
ecdd55e4
Commit
ecdd55e4
authored
Feb 12, 2016
by
Ian Hickson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1796 from abarth/progress_nits
Fix style nits in progress_indicator.dart
parents
16ecfeb0
0ae02d2f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
27 deletions
+23
-27
progress_indicator.dart
packages/flutter/lib/src/material/progress_indicator.dart
+23
-27
No files found.
packages/flutter/lib/src/material/progress_indicator.dart
View file @
ecdd55e4
...
...
@@ -3,9 +3,7 @@
// found in the LICENSE file.
import
'dart:math'
as
math
;
import
'dart:ui'
as
ui
;
import
'package:flutter/animation.dart'
;
import
'package:flutter/widgets.dart'
;
import
'theme.dart'
;
...
...
@@ -49,7 +47,7 @@ class _LinearProgressIndicatorPainter extends CustomPainter {
void
paint
(
Canvas
canvas
,
Size
size
)
{
Paint
paint
=
new
Paint
()
..
color
=
backgroundColor
..
style
=
ui
.
PaintingStyle
.
fill
;
..
style
=
PaintingStyle
.
fill
;
canvas
.
drawRect
(
Point
.
origin
&
size
,
paint
);
paint
.
color
=
valueColor
;
...
...
@@ -151,18 +149,18 @@ class _CircularProgressIndicatorPainter extends CustomPainter {
Paint
paint
=
new
Paint
()
..
color
=
valueColor
..
strokeWidth
=
_kCircularProgressIndicatorStrokeWidth
..
style
=
ui
.
PaintingStyle
.
stroke
;
..
style
=
PaintingStyle
.
stroke
;
// Determinite
if
(
value
!=
null
)
{
// Determinite
double
angle
=
value
.
clamp
(
0.0
,
1.0
)
*
_kSweep
;
Path
path
=
new
Path
()
..
arcTo
(
Point
.
origin
&
size
,
_kStartAngle
,
angle
,
false
);
canvas
.
drawPath
(
path
,
paint
);
// Non-determinite
}
else
{
paint
.
strokeCap
=
ui
.
StrokeCap
.
square
;
// Non-determinite
paint
.
strokeCap
=
StrokeCap
.
square
;
double
arcSweep
=
math
.
max
(
headValue
*
3
/
2
*
math
.
PI
-
tailValue
*
3
/
2
*
math
.
PI
,
_kEpsilon
);
Path
path
=
new
Path
()
...
...
@@ -213,8 +211,8 @@ class CircularProgressIndicator extends ProgressIndicator {
}
// TODO(jestelle) This should probably go somewhere else? And maybe be more
// general?
class
RepeatingCurveTween
extends
Animatable
<
double
>
{
RepeatingCurveTween
({
this
.
curve
,
this
.
repeats
});
class
_
RepeatingCurveTween
extends
Animatable
<
double
>
{
_
RepeatingCurveTween
({
this
.
curve
,
this
.
repeats
});
Curve
curve
;
int
repeats
;
...
...
@@ -233,8 +231,8 @@ class RepeatingCurveTween extends Animatable<double> {
// TODO(jestelle) This should probably go somewhere else? And maybe be more
// general? Or maybe the IntTween should actually work this way?
class
StepTween
extends
Tween
<
int
>
{
StepTween
({
int
begin
,
int
end
})
:
super
(
begin:
begin
,
end:
end
);
class
_
StepTween
extends
Tween
<
int
>
{
_
StepTween
({
int
begin
,
int
end
})
:
super
(
begin:
begin
,
end:
end
);
// The inherited lerp() function doesn't work with ints because it multiplies
// the begin and end types by a double, and int * double returns a double.
...
...
@@ -242,31 +240,29 @@ class StepTween extends Tween<int> {
}
// Tweens used by circular progress indicator
final
RepeatingCurveTween
_kStrokeHeadTween
=
new
RepeatingCurveTween
(
final
_
RepeatingCurveTween
_kStrokeHeadTween
=
new
_
RepeatingCurveTween
(
curve:
new
Interval
(
0.0
,
0.5
,
curve:
Curves
.
fastOutSlowIn
),
repeats:
5
);
final
RepeatingCurveTween
_kStrokeTailTween
=
new
RepeatingCurveTween
(
final
_
RepeatingCurveTween
_kStrokeTailTween
=
new
_
RepeatingCurveTween
(
curve:
new
Interval
(
0.5
,
1.0
,
curve:
Curves
.
fastOutSlowIn
),
repeats:
5
);
final
StepTween
_kStepTween
=
new
StepTween
(
begin:
0
,
end:
5
);
final
_StepTween
_kStepTween
=
new
_
StepTween
(
begin:
0
,
end:
5
);
final
RepeatingCurveTween
_kRotationTween
=
new
RepeatingCurveTween
(
curve:
Curves
.
linear
,
repeats:
5
);
final
_
RepeatingCurveTween
_kRotationTween
=
new
_
RepeatingCurveTween
(
curve:
Curves
.
linear
,
repeats:
5
);
class
_CircularProgressIndicatorState
extends
State
<
CircularProgressIndicator
>
{
Animation
<
double
>
_animation
;
AnimationController
_controller
;
AnimationController
_animationController
;
void
initState
()
{
super
.
initState
();
_
c
ontroller
=
new
AnimationController
(
_
animationC
ontroller
=
new
AnimationController
(
duration:
const
Duration
(
milliseconds:
6666
)
)..
repeat
();
_animation
=
new
CurvedAnimation
(
parent:
_controller
,
curve:
Curves
.
linear
);
}
Widget
build
(
BuildContext
context
)
{
...
...
@@ -274,13 +270,13 @@ class _CircularProgressIndicatorState extends State<CircularProgressIndicator> {
return
config
.
_buildIndicator
(
context
,
0.0
,
0.0
,
0
,
0.0
);
return
new
AnimatedBuilder
(
animation:
_animation
,
animation:
_animation
Controller
,
builder:
(
BuildContext
context
,
Widget
child
)
{
return
config
.
_buildIndicator
(
context
,
_kStrokeHeadTween
.
evaluate
(
_animation
),
_kStrokeTailTween
.
evaluate
(
_animation
),
_kStepTween
.
evaluate
(
_animation
),
_kRotationTween
.
evaluate
(
_animation
));
_kStrokeHeadTween
.
evaluate
(
_animation
Controller
),
_kStrokeTailTween
.
evaluate
(
_animation
Controller
),
_kStepTween
.
evaluate
(
_animation
Controller
),
_kRotationTween
.
evaluate
(
_animation
Controller
));
}
);
}
...
...
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