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
59f3f23a
Unverified
Commit
59f3f23a
authored
Aug 25, 2021
by
nt4f04uNd
Committed by
GitHub
Aug 25, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix precision error in NestedScrollView (#87801)
parent
807ca68d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
1 deletion
+48
-1
scroll_activity.dart
packages/flutter/lib/src/widgets/scroll_activity.dart
+1
-1
nested_scroll_view_test.dart
packages/flutter/test/widgets/nested_scroll_view_test.dart
+47
-0
No files found.
packages/flutter/lib/src/widgets/scroll_activity.dart
View file @
59f3f23a
...
...
@@ -563,7 +563,7 @@ class BallisticScrollActivity extends ScrollActivity {
/// and returns true if the overflow was zero.
@protected
bool
applyMoveTo
(
double
value
)
{
return
delegate
.
setPixels
(
value
)
==
0.0
;
return
delegate
.
setPixels
(
value
)
.
abs
()
<
precisionErrorTolerance
;
}
void
_end
()
{
...
...
packages/flutter/test/widgets/nested_scroll_view_test.dart
View file @
59f3f23a
...
...
@@ -2444,6 +2444,53 @@ void main() {
await
tester
.
pumpWidget
(
buildFrame
(
physics:
const
_CustomPhysics
()));
expect
(
position
.
pixels
,
0.0
);
});
testWidgets
(
"NestedScrollView doesn't crash due to precision error"
,
(
WidgetTester
tester
)
async
{
// Regression test for https://github.com/flutter/flutter/issues/63825
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Scaffold
(
body:
NestedScrollView
(
floatHeaderSlivers:
true
,
headerSliverBuilder:
(
BuildContext
context
,
bool
innerBoxIsScrolled
)
=>
<
Widget
>[
const
SliverAppBar
(
expandedHeight:
250.0
,
),
],
body:
CustomScrollView
(
physics:
const
BouncingScrollPhysics
(),
slivers:
<
Widget
>[
SliverPadding
(
padding:
const
EdgeInsets
.
all
(
8.0
),
sliver:
SliverFixedExtentList
(
itemExtent:
48.0
,
delegate:
SliverChildBuilderDelegate
(
(
BuildContext
context
,
int
index
)
{
return
ListTile
(
title:
Text
(
'Item
$index
'
),
);
},
childCount:
30
,
),
),
),
],
),
),
),
));
// Scroll to bottom
await
tester
.
fling
(
find
.
text
(
'Item 3'
),
const
Offset
(
0.0
,
-
250.0
),
10000.0
);
await
tester
.
pumpAndSettle
();
// Fling down for AppBar to show
await
tester
.
drag
(
find
.
text
(
'Item 29'
),
const
Offset
(
0.0
,
250
-
133.7981622869321
));
// Fling up to trigger ballistic activity
await
tester
.
fling
(
find
.
text
(
'Item 25'
),
const
Offset
(
0.0
,
-
50.0
),
4000.0
);
await
tester
.
pumpAndSettle
();
});
}
class
TestHeader
extends
SliverPersistentHeaderDelegate
{
...
...
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