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
12b8d9db
Unverified
Commit
12b8d9db
authored
Aug 08, 2020
by
Pascal Welsch
Committed by
GitHub
Aug 08, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reduce iOS scroll damping for lists with differently sized items (#59623)
parent
77b4505c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
4 deletions
+25
-4
scroll_physics.dart
packages/flutter/lib/src/widgets/scroll_physics.dart
+3
-4
scroll_simulation.dart
packages/flutter/lib/src/widgets/scroll_simulation.dart
+2
-0
scroll_physics_test.dart
packages/flutter/test/widgets/scroll_physics_test.dart
+20
-0
No files found.
packages/flutter/lib/src/widgets/scroll_physics.dart
View file @
12b8d9db
...
...
@@ -533,7 +533,7 @@ class BouncingScrollPhysics extends ScrollPhysics {
return
BouncingScrollSimulation
(
spring:
spring
,
position:
position
.
pixels
,
velocity:
velocity
*
0.91
,
// TODO(abarth): We should move this constant closer to the drag end.
velocity:
velocity
,
leadingExtent:
position
.
minScrollExtent
,
trailingExtent:
position
.
maxScrollExtent
,
tolerance:
tolerance
,
...
...
@@ -549,9 +549,8 @@ class BouncingScrollPhysics extends ScrollPhysics {
double
get
minFlingVelocity
=>
kMinFlingVelocity
*
2.0
;
// Methodology:
// 1- Use https://github.com/flutter/scroll_overlay to test with Flutter and
// platform scroll views superimposed.
// 2- Record incoming speed and make rapid flings in the test app.
// 1- Use https://github.com/flutter/platform_tests/tree/master/scroll_overlay to test with
// Flutter and platform scroll views superimposed.
// 3- If the scrollables stopped overlapping at any moment, adjust the desired
// output value of this function at that input speed.
// 4- Feed new input/output set into a power curve fitter. Change function
...
...
packages/flutter/lib/src/widgets/scroll_simulation.dart
View file @
12b8d9db
...
...
@@ -51,6 +51,8 @@ class BouncingScrollSimulation extends Simulation {
_springSimulation
=
_overscrollSimulation
(
position
,
velocity
);
_springTime
=
double
.
negativeInfinity
;
}
else
{
// Taken from UIScrollView.decelerationRate (.normal = 0.998)
// 0.998^1000 = ~0.135
_frictionSimulation
=
FrictionSimulation
(
0.135
,
position
,
velocity
);
final
double
finalX
=
_frictionSimulation
.
finalX
;
if
(
velocity
>
0.0
&&
finalX
>
trailingExtent
)
{
...
...
packages/flutter/test/widgets/scroll_physics_test.dart
View file @
12b8d9db
...
...
@@ -97,6 +97,26 @@ void main() {
);
});
test
(
'ScrollPhysics scrolling subclasses - Creating the simulation doesn
\'
t alter the velocity for time 0'
,
()
{
final
ScrollMetrics
position
=
FixedScrollMetrics
(
minScrollExtent:
0.0
,
maxScrollExtent:
100.0
,
pixels:
20.0
,
viewportDimension:
500.0
,
axisDirection:
AxisDirection
.
down
,
);
const
BouncingScrollPhysics
bounce
=
BouncingScrollPhysics
();
const
ClampingScrollPhysics
clamp
=
ClampingScrollPhysics
();
const
PageScrollPhysics
page
=
PageScrollPhysics
();
// Calls to createBallisticSimulation may happen on every frame (i.e. when the maxScrollExtent changes)
// Changing velocity for time 0 may cause a sudden, unwanted damping/speedup effect
expect
(
bounce
.
createBallisticSimulation
(
position
,
1000
).
dx
(
0
),
moreOrLessEquals
(
1000
));
expect
(
clamp
.
createBallisticSimulation
(
position
,
1000
).
dx
(
0
),
moreOrLessEquals
(
1000
));
expect
(
page
.
createBallisticSimulation
(
position
,
1000
).
dx
(
0
),
moreOrLessEquals
(
1000
));
});
group
(
'BouncingScrollPhysics test'
,
()
{
BouncingScrollPhysics
physicsUnderTest
;
...
...
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