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
715af6eb
Commit
715af6eb
authored
Jan 20, 2016
by
Adam Barth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Port Tooltip to AnimationController
parent
6cea5dc8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
13 deletions
+15
-13
tooltip.dart
packages/flutter/lib/src/material/tooltip.dart
+15
-13
No files found.
packages/flutter/lib/src/material/tooltip.dart
View file @
715af6eb
...
...
@@ -71,13 +71,13 @@ class Tooltip extends StatefulComponent {
class
_TooltipState
extends
State
<
Tooltip
>
{
Performance
_performance
;
AnimationController
_controller
;
OverlayEntry
_entry
;
Timer
_timer
;
void
initState
()
{
super
.
initState
();
_
performance
=
new
Performance
(
duration:
config
.
fadeDuration
)
_
controller
=
new
AnimationController
(
duration:
config
.
fadeDuration
)
..
addStatusListener
((
PerformanceStatus
status
)
{
switch
(
status
)
{
case
PerformanceStatus
.
completed
:
...
...
@@ -100,7 +100,7 @@ class _TooltipState extends State<Tooltip> {
void
didUpdateConfig
(
Tooltip
oldConfig
)
{
super
.
didUpdateConfig
(
oldConfig
);
if
(
config
.
fadeDuration
!=
oldConfig
.
fadeDuration
)
_
performance
.
duration
=
config
.
fadeDuration
;
_
controller
.
duration
=
config
.
fadeDuration
;
if
(
_entry
!=
null
&&
(
config
.
message
!=
oldConfig
.
message
||
config
.
backgroundColor
!=
oldConfig
.
backgroundColor
||
...
...
@@ -117,7 +117,7 @@ class _TooltipState extends State<Tooltip> {
}
void
resetShowTimer
()
{
assert
(
_
performance
.
status
==
PerformanceStatus
.
completed
);
assert
(
_
controller
.
status
==
PerformanceStatus
.
completed
);
assert
(
_entry
!=
null
);
_timer
=
new
Timer
(
config
.
showDuration
,
hideTooltip
);
}
...
...
@@ -136,7 +136,10 @@ class _TooltipState extends State<Tooltip> {
height:
config
.
height
,
padding:
config
.
padding
,
opacity:
config
.
opacity
,
performance:
_performance
,
animation:
new
CurvedAnimation
(
parent:
_controller
,
curve:
Curves
.
ease
),
target:
target
,
verticalOffset:
config
.
verticalOffset
,
screenEdgeMargin:
config
.
screenEdgeMargin
,
...
...
@@ -146,9 +149,9 @@ class _TooltipState extends State<Tooltip> {
Overlay
.
of
(
context
).
insert
(
_entry
);
}
_timer
?.
cancel
();
if
(
_
performance
.
status
!=
PerformanceStatus
.
completed
)
{
if
(
_
controller
.
status
!=
PerformanceStatus
.
completed
)
{
_timer
=
null
;
_
performance
.
forward
();
_
controller
.
forward
();
}
else
{
resetShowTimer
();
}
...
...
@@ -158,7 +161,7 @@ class _TooltipState extends State<Tooltip> {
assert
(
_entry
!=
null
);
_timer
?.
cancel
();
_timer
=
null
;
_
performance
.
reverse
();
_
controller
.
reverse
();
}
void
deactivate
()
{
...
...
@@ -232,7 +235,7 @@ class _TooltipOverlay extends StatelessComponent {
this
.
height
,
this
.
padding
,
this
.
opacity
,
this
.
performance
,
this
.
animation
,
this
.
target
,
this
.
verticalOffset
,
this
.
screenEdgeMargin
,
...
...
@@ -246,7 +249,7 @@ class _TooltipOverlay extends StatelessComponent {
final
double
borderRadius
;
final
double
height
;
final
EdgeDims
padding
;
final
PerformanceView
performance
;
final
Animated
<
double
>
animation
;
final
Point
target
;
final
double
verticalOffset
;
final
EdgeDims
screenEdgeMargin
;
...
...
@@ -266,9 +269,8 @@ class _TooltipOverlay extends StatelessComponent {
screenEdgeMargin:
screenEdgeMargin
,
preferBelow:
preferBelow
),
child:
new
OldFadeTransition
(
performance:
performance
,
opacity:
new
AnimatedValue
<
double
>(
0.0
,
end:
1.0
,
curve:
Curves
.
ease
),
child:
new
FadeTransition
(
opacity:
animation
,
child:
new
Opacity
(
opacity:
opacity
,
child:
new
Container
(
...
...
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