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
2e7b4587
Unverified
Commit
2e7b4587
authored
Mar 08, 2023
by
Callum Moffat
Committed by
GitHub
Mar 08, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
No friction factor on macOS overscroll ease (#122143)
No friction factor on macOS overscroll ease
parent
ac76dabe
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
19 deletions
+44
-19
scroll_physics.dart
packages/flutter/lib/src/widgets/scroll_physics.dart
+3
-0
refresh_test.dart
packages/flutter/test/cupertino/refresh_test.dart
+21
-19
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 @
2e7b4587
...
...
@@ -707,6 +707,9 @@ class BouncingScrollPhysics extends ScrollPhysics {
:
frictionFactor
(
overscrollPast
/
position
.
viewportDimension
);
final
double
direction
=
offset
.
sign
;
if
(
easing
&&
decelerationRate
==
ScrollDecelerationRate
.
fast
)
{
return
direction
*
offset
.
abs
();
}
return
direction
*
_applyFriction
(
overscrollPast
,
offset
.
abs
(),
friction
);
}
...
...
packages/flutter/test/cupertino/refresh_test.dart
View file @
2e7b4587
...
...
@@ -211,10 +211,15 @@ void main() {
final
TestGesture
gesture
=
await
tester
.
startGesture
(
Offset
.
zero
);
await
gesture
.
moveBy
(
const
Offset
(
0.0
,
99.0
));
await
tester
.
pump
();
await
gesture
.
moveBy
(
const
Offset
(
0.0
,
-
30.0
));
if
(
debugDefaultTargetPlatformOverride
==
TargetPlatform
.
macOS
)
{
await
gesture
.
moveBy
(
const
Offset
(
0.0
,
-
3.0
));
}
else
{
await
gesture
.
moveBy
(
const
Offset
(
0.0
,
-
30.0
));
}
await
tester
.
pump
();
if
(
debugDefaultTargetPlatformOverride
==
TargetPlatform
.
macOS
)
{
await
gesture
.
moveBy
(
const
Offset
(
0.0
,
7
0.0
));
await
gesture
.
moveBy
(
const
Offset
(
0.0
,
9
0.0
));
}
else
{
await
gesture
.
moveBy
(
const
Offset
(
0.0
,
50.0
));
...
...
@@ -230,7 +235,7 @@ void main() {
),
if
(
debugDefaultTargetPlatformOverride
==
TargetPlatform
.
macOS
)
matchesBuilder
(
refreshState:
RefreshIndicatorMode
.
drag
,
pulledExtent:
moreOrLessEquals
(
9
7.3552275
),
pulledExtent:
moreOrLessEquals
(
9
6
),
refreshTriggerPullDistance:
100
,
// default value.
refreshIndicatorExtent:
60
,
// default value.
)
...
...
@@ -242,7 +247,7 @@ void main() {
),
if
(
debugDefaultTargetPlatformOverride
==
TargetPlatform
.
macOS
)
matchesBuilder
(
refreshState:
RefreshIndicatorMode
.
armed
,
pulledExtent:
moreOrLessEquals
(
100.
79409877743257
),
pulledExtent:
moreOrLessEquals
(
100.
44528
),
refreshTriggerPullDistance:
100
,
// default value.
refreshIndicatorExtent:
60
,
// default value.
)
...
...
@@ -460,7 +465,7 @@ void main() {
);
if
(
debugDefaultTargetPlatformOverride
==
TargetPlatform
.
macOS
)
{
await
tester
.
drag
(
find
.
text
(
'0'
),
const
Offset
(
0.0
,
-
60
0.0
),
touchSlopY:
0
,
warnIfMissed:
false
);
// hits the list
await
tester
.
drag
(
find
.
text
(
'0'
),
const
Offset
(
0.0
,
-
13
0.0
),
touchSlopY:
0
,
warnIfMissed:
false
);
// hits the list
}
else
{
await
tester
.
drag
(
find
.
text
(
'0'
),
const
Offset
(
0.0
,
-
300.0
),
touchSlopY:
0
,
warnIfMissed:
false
);
// hits the list
...
...
@@ -479,15 +484,15 @@ void main() {
if
(
debugDefaultTargetPlatformOverride
==
TargetPlatform
.
macOS
)
{
expect
(
tester
.
getTopLeft
(
find
.
widgetWithText
(
Center
,
'-1'
,
skipOffstage:
false
)).
dy
,
moreOrLessEquals
(-
38.625
),
moreOrLessEquals
(-
40
),
);
expect
(
tester
.
getBottomLeft
(
find
.
widgetWithText
(
Center
,
'-1'
,
skipOffstage:
false
)).
dy
,
moreOrLessEquals
(
2
1.375
),
moreOrLessEquals
(
2
0
),
);
expect
(
tester
.
getTopLeft
(
find
.
widgetWithText
(
Center
,
'0'
)).
dy
,
moreOrLessEquals
(
2
1.375
),
moreOrLessEquals
(
2
0
),
);
}
else
{
...
...
@@ -1195,7 +1200,7 @@ void main() {
);
if
(
debugDefaultTargetPlatformOverride
==
TargetPlatform
.
macOS
)
{
await
gesture
.
moveBy
(
const
Offset
(
0.0
,
-
310
.0
));
// Overscrolling, need to move more than -40.
await
gesture
.
moveBy
(
const
Offset
(
0.0
,
-
41
.0
));
// Overscrolling, need to move more than -40.
}
else
{
await
gesture
.
moveBy
(
const
Offset
(
0.0
,
-
80.0
));
// Overscrolling, need to move more than -40.
...
...
@@ -1204,7 +1209,7 @@ void main() {
if
(
debugDefaultTargetPlatformOverride
==
TargetPlatform
.
macOS
)
{
expect
(
tester
.
getTopLeft
(
find
.
widgetWithText
(
SizedBox
,
'0'
)).
dy
,
moreOrLessEquals
(
49
.469222222222214
),
// Below 50 now.
moreOrLessEquals
(
49
),
// Below 50 now.
);
}
else
{
...
...
@@ -1303,7 +1308,7 @@ void main() {
// Now back in overscroll mode.
if
(
debugDefaultTargetPlatformOverride
==
TargetPlatform
.
macOS
)
{
await
gesture
.
moveBy
(
const
Offset
(
0.0
,
-
590
.0
));
await
gesture
.
moveBy
(
const
Offset
(
0.0
,
-
125
.0
));
}
else
{
await
gesture
.
moveBy
(
const
Offset
(
0.0
,
-
200.0
));
...
...
@@ -1312,7 +1317,7 @@ void main() {
if
(
debugDefaultTargetPlatformOverride
==
TargetPlatform
.
macOS
)
{
expect
(
tester
.
getTopLeft
(
find
.
widgetWithText
(
SizedBox
,
'0'
)).
dy
,
moreOrLessEquals
(
25
.916444444444423
),
moreOrLessEquals
(
25
),
);
}
else
{
...
...
@@ -1328,7 +1333,7 @@ void main() {
);
if
(
debugDefaultTargetPlatformOverride
==
TargetPlatform
.
macOS
)
{
await
gesture
.
moveBy
(
const
Offset
(
0.0
,
-
1
60
.0
));
await
gesture
.
moveBy
(
const
Offset
(
0.0
,
-
1
5
.0
));
}
else
{
await
gesture
.
moveBy
(
const
Offset
(
0.0
,
-
35.0
));
...
...
@@ -1337,7 +1342,7 @@ void main() {
if
(
debugDefaultTargetPlatformOverride
==
TargetPlatform
.
macOS
)
{
expect
(
tester
.
getTopLeft
(
find
.
widgetWithText
(
SizedBox
,
'0'
)).
dy
,
moreOrLessEquals
(
9.15133037440173
),
moreOrLessEquals
(
10
),
);
}
else
{
...
...
@@ -1380,13 +1385,10 @@ void main() {
);
await
tester
.
pump
();
// Sliver scroll offset correction is applied one frame later.
await
gesture
.
moveBy
(
const
Offset
(
0.0
,
-
300.0
));
double
indicatorDestinationPosition
=
-
145.0332383665717
;
if
(
debugDefaultTargetPlatformOverride
==
TargetPlatform
.
macOS
)
{
await
gesture
.
moveBy
(
const
Offset
(
0.0
,
-
600.0
));
indicatorDestinationPosition
=
-
164.33475946989466
;
}
else
{
await
gesture
.
moveBy
(
const
Offset
(
0.0
,
-
300.0
));
indicatorDestinationPosition
=
-
150.0
;
}
await
tester
.
pump
();
// The refresh indicator is offscreen now.
...
...
packages/flutter/test/widgets/scroll_physics_test.dart
View file @
2e7b4587
...
...
@@ -221,6 +221,26 @@ void main() {
expect
(
easingApplied
.
abs
(),
greaterThan
(
tensioningApplied
.
abs
()));
});
test
(
'no easing resistance for ScrollDecelerationRate.fast'
,
()
{
const
BouncingScrollPhysics
desktop
=
BouncingScrollPhysics
(
decelerationRate:
ScrollDecelerationRate
.
fast
);
final
ScrollMetrics
overscrolledPosition
=
FixedScrollMetrics
(
minScrollExtent:
0.0
,
maxScrollExtent:
1000.0
,
pixels:
-
20.0
,
viewportDimension:
100.0
,
axisDirection:
AxisDirection
.
down
,
devicePixelRatio:
3.0
,
);
final
double
easingApplied
=
desktop
.
applyPhysicsToUserOffset
(
overscrolledPosition
,
-
10.0
);
final
double
tensioningApplied
=
desktop
.
applyPhysicsToUserOffset
(
overscrolledPosition
,
10.0
);
expect
(
tensioningApplied
.
abs
(),
lessThan
(
easingApplied
.
abs
()));
expect
(
easingApplied
,
-
10
);
});
test
(
'overscroll a small list and a big list works the same way'
,
()
{
final
ScrollMetrics
smallListOverscrolledPosition
=
FixedScrollMetrics
(
minScrollExtent:
0.0
,
...
...
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