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
c68494eb
Commit
c68494eb
authored
Mar 31, 2016
by
Adam Barth
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3015 from abarth/snackbar_fade
Snackbar opacity animation shouldn't trigger on reverse
parents
11974318
da987ed2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
3 deletions
+22
-3
curves.dart
packages/flutter/lib/src/animation/curves.dart
+19
-0
dropdown.dart
packages/flutter/lib/src/material/dropdown.dart
+2
-2
snack_bar.dart
packages/flutter/lib/src/material/snack_bar.dart
+1
-1
No files found.
packages/flutter/lib/src/animation/curves.dart
View file @
c68494eb
...
...
@@ -95,6 +95,25 @@ class Interval extends Curve {
}
}
/// A curve that is 0.0 until it hits the threshold, then it jumps to 1.0.
class
Step
extends
Curve
{
const
Step
(
this
.
threshold
);
/// The value before which the curve is 0.0 and after which the curve is 1.0.
///
/// At exactly step, the curve has the value 1.0.
final
double
threshold
;
@override
double
transform
(
double
t
)
{
assert
(
threshold
>=
0.0
);
assert
(
threshold
<=
1.0
);
if
(
t
==
0.0
||
t
==
1.0
)
return
t
;
return
t
<
threshold
?
0.0
:
1.0
;
}
}
/// A cubic polynomial mapping of the unit interval.
class
Cubic
extends
Curve
{
const
Cubic
(
this
.
a
,
this
.
b
,
this
.
c
,
this
.
d
);
...
...
packages/flutter/lib/src/material/dropdown.dart
View file @
c68494eb
...
...
@@ -82,7 +82,7 @@ class _DropDownMenu<T> extends StatusTransitionWidget {
for
(
int
itemIndex
=
0
;
itemIndex
<
route
.
items
.
length
;
++
itemIndex
)
{
CurvedAnimation
opacity
;
if
(
itemIndex
==
route
.
selectedIndex
)
{
opacity
=
new
CurvedAnimation
(
parent:
route
.
animation
,
curve:
const
Interval
(
0.0
,
0.001
),
reverseCurve:
const
Interval
(
0.75
,
1.0
));
opacity
=
new
CurvedAnimation
(
parent:
route
.
animation
,
curve:
const
Step
(
0.0
),
reverseCurve:
const
Interval
(
0.75
,
1.0
));
}
else
{
final
double
start
=
(
0.5
+
(
itemIndex
+
1
)
*
unit
).
clamp
(
0.0
,
1.0
);
final
double
end
=
(
start
+
1.5
*
unit
).
clamp
(
0.0
,
1.0
);
...
...
@@ -112,7 +112,7 @@ class _DropDownMenu<T> extends StatusTransitionWidget {
final
CurvedAnimation
resize
=
new
CurvedAnimation
(
parent:
route
.
animation
,
curve:
const
Interval
(
0.25
,
0.5
),
reverseCurve:
const
Interval
(
0.0
,
0.001
)
reverseCurve:
const
Step
(
0.0
)
);
final
Tween
<
double
>
menuTop
=
new
Tween
<
double
>(
...
...
packages/flutter/lib/src/material/snack_bar.dart
View file @
c68494eb
...
...
@@ -105,7 +105,7 @@ class SnackBar extends StatelessWidget {
if
(
action
!=
null
)
children
.
add
(
action
);
CurvedAnimation
heightAnimation
=
new
CurvedAnimation
(
parent:
animation
,
curve:
_snackBarHeightCurve
);
CurvedAnimation
fadeAnimation
=
new
CurvedAnimation
(
parent:
animation
,
curve:
_snackBarFadeCurve
);
CurvedAnimation
fadeAnimation
=
new
CurvedAnimation
(
parent:
animation
,
curve:
_snackBarFadeCurve
,
reverseCurve:
const
Step
(
0.0
)
);
ThemeData
theme
=
Theme
.
of
(
context
);
return
new
ClipRect
(
child:
new
AnimatedBuilder
(
...
...
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