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
2fc4f207
Commit
2fc4f207
authored
Mar 21, 2016
by
Adam Barth
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2818 from abarth/scroll_tolerance
Scrollable sometimes pushes frames forever
parents
33d7d6dc
5a5fcb95
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
4 deletions
+6
-4
scrollable.dart
packages/flutter/lib/src/widgets/scrollable.dart
+1
-1
friction_simulation.dart
packages/newton/lib/src/friction_simulation.dart
+1
-1
utils.dart
packages/newton/lib/src/utils.dart
+4
-2
No files found.
packages/flutter/lib/src/widgets/scrollable.dart
View file @
2fc4f207
...
...
@@ -444,7 +444,7 @@ abstract class ScrollableState<T extends Scrollable> extends State<T> {
Simulation
_createFlingSimulation
(
double
scrollVelocity
)
{
final
Simulation
simulation
=
scrollBehavior
.
createScrollSimulation
(
scrollOffset
,
scrollVelocity
);
if
(
simulation
!=
null
)
{
final
double
endVelocity
=
pixelOffsetToScrollOffset
(
kPixelScrollTolerance
.
velocity
).
abs
()
*
(
scrollVelocity
<
0.0
?
-
1.0
:
1.0
)
;
final
double
endVelocity
=
pixelOffsetToScrollOffset
(
kPixelScrollTolerance
.
velocity
).
abs
();
final
double
endDistance
=
pixelOffsetToScrollOffset
(
kPixelScrollTolerance
.
distance
).
abs
();
simulation
.
tolerance
=
new
Tolerance
(
velocity:
endVelocity
,
distance:
endDistance
);
}
...
...
packages/newton/lib/src/friction_simulation.dart
View file @
2fc4f207
...
...
@@ -47,7 +47,7 @@ class FrictionSimulation extends Simulation {
double
dx
(
double
time
)
=>
_v
*
math
.
pow
(
_drag
,
time
);
@override
bool
isDone
(
double
time
)
=>
dx
(
time
).
abs
()
<
t
his
.
t
olerance
.
velocity
;
bool
isDone
(
double
time
)
=>
dx
(
time
).
abs
()
<
tolerance
.
velocity
;
}
class
BoundedFrictionSimulation
extends
FrictionSimulation
{
...
...
packages/newton/lib/src/utils.dart
View file @
2fc4f207
...
...
@@ -2,7 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
bool
nearEqual
(
double
a
,
double
b
,
double
epsilon
)
=>
(
a
>
(
b
-
epsilon
))
&&
(
a
<
(
b
+
epsilon
));
bool
nearEqual
(
double
a
,
double
b
,
double
epsilon
)
{
assert
(
epsilon
>=
0.0
);
return
(
a
>
(
b
-
epsilon
))
&&
(
a
<
(
b
+
epsilon
));
}
bool
nearZero
(
double
a
,
double
epsilon
)
=>
nearEqual
(
a
,
0.0
,
epsilon
);
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