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
63d3b6db
Commit
63d3b6db
authored
Sep 16, 2015
by
Ian Hickson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1183 from Hixie/dismissable
Be more explicit about what's state in dismissable
parents
12a09822
adf7c48d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
23 deletions
+33
-23
dismissable.dart
packages/flutter/lib/src/widgets/dismissable.dart
+33
-23
No files found.
packages/flutter/lib/src/widgets/dismissable.dart
View file @
63d3b6db
...
...
@@ -75,14 +75,6 @@ class Dismissable extends StatefulComponent {
_startResizePerformance
();
}
Point
get
_activeCardDragEndPoint
{
if
(!
_isActive
)
return
Point
.
origin
;
assert
(
_size
!=
null
);
double
extent
=
_directionIsYAxis
?
_size
.
height
:
_size
.
width
;
return
new
Point
(
_dragExtent
.
sign
*
extent
*
_kDismissCardThreshold
,
0.0
);
}
bool
get
_isActive
{
return
_size
!=
null
&&
(
_dragUnderway
||
_fadePerformance
.
isAnimating
);
}
...
...
@@ -120,9 +112,11 @@ class Dismissable extends StatefulComponent {
void
_handleDragStart
()
{
if
(
_fadePerformance
.
isAnimating
)
return
;
_dragUnderway
=
true
;
_dragExtent
=
0.0
;
_fadePerformance
.
progress
=
0.0
;
setState
(()
{
_dragUnderway
=
true
;
_dragExtent
=
0.0
;
_fadePerformance
.
progress
=
0.0
;
});
}
void
_handleDragUpdate
(
double
scrollOffset
)
{
...
...
@@ -149,8 +143,14 @@ class Dismissable extends StatefulComponent {
break
;
}
if
(
oldDragExtent
.
sign
!=
_dragExtent
.
sign
)
setState
(()
{});
// Rebuild to update the new drag endpoint.
if
(
oldDragExtent
.
sign
!=
_dragExtent
.
sign
)
{
setState
(()
{
// Rebuild to update the new drag endpoint.
// The sign of _dragExtent is part of our build state;
// the actual value is not, it's just used to configure
// the performances.
});
}
if
(!
_fadePerformance
.
isAnimating
)
_fadePerformance
.
progress
=
_dragExtent
.
abs
()
/
(
_size
.
width
*
_kDismissCardThreshold
);
}
...
...
@@ -188,16 +188,18 @@ class Dismissable extends StatefulComponent {
if
(!
_isActive
||
_fadePerformance
.
isAnimating
)
return
;
_dragUnderway
=
false
;
if
(
_fadePerformance
.
isCompleted
)
{
_startResizePerformance
();
}
else
if
(
_isFlingGesture
(
velocity
))
{
double
flingVelocity
=
_directionIsYAxis
?
velocity
.
dy
:
velocity
.
dx
;
_dragExtent
=
flingVelocity
.
sign
;
_fadePerformance
.
fling
(
velocity:
flingVelocity
.
abs
()
*
_kFlingVelocityScale
);
}
else
{
_fadePerformance
.
reverse
();
}
setState
(()
{
_dragUnderway
=
false
;
if
(
_fadePerformance
.
isCompleted
)
{
_startResizePerformance
();
}
else
if
(
_isFlingGesture
(
velocity
))
{
double
flingVelocity
=
_directionIsYAxis
?
velocity
.
dy
:
velocity
.
dx
;
_dragExtent
=
flingVelocity
.
sign
;
_fadePerformance
.
fling
(
velocity:
flingVelocity
.
abs
()
*
_kFlingVelocityScale
);
}
else
{
_fadePerformance
.
reverse
();
}
});
}
void
_handleSizeChanged
(
Size
newSize
)
{
...
...
@@ -206,6 +208,14 @@ class Dismissable extends StatefulComponent {
});
}
Point
get
_activeCardDragEndPoint
{
if
(!
_isActive
)
return
Point
.
origin
;
assert
(
_size
!=
null
);
double
extent
=
_directionIsYAxis
?
_size
.
height
:
_size
.
width
;
return
new
Point
(
_dragExtent
.
sign
*
extent
*
_kDismissCardThreshold
,
0.0
);
}
Widget
build
()
{
if
(
_resizePerformance
!=
null
)
{
AnimatedValue
<
double
>
squashAxisExtent
=
new
AnimatedValue
<
double
>(
...
...
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