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
3ae0345e
Commit
3ae0345e
authored
Jan 24, 2020
by
齐翊
Committed by
Flutter GitHub Bot
Jan 24, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[bugfix] SliverGeometry is not valid: The "layoutExtent" is negative (#48947)
parent
ed32b0a5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
64 additions
and
1 deletion
+64
-1
nested_scroll_view.dart
packages/flutter/lib/src/widgets/nested_scroll_view.dart
+1
-1
nested_scroll_view_test.dart
packages/flutter/test/widgets/nested_scroll_view_test.dart
+63
-0
No files found.
packages/flutter/lib/src/widgets/nested_scroll_view.dart
View file @
3ae0345e
...
...
@@ -1445,7 +1445,7 @@ class RenderSliverOverlapAbsorber extends RenderSliver with RenderObjectWithChil
scrollExtent:
childLayoutGeometry
.
scrollExtent
-
childLayoutGeometry
.
maxScrollObstructionExtent
,
paintExtent:
childLayoutGeometry
.
paintExtent
,
paintOrigin:
childLayoutGeometry
.
paintOrigin
,
layoutExtent:
childLayoutGeometry
.
paintExtent
-
childLayoutGeometry
.
maxScrollObstructionExtent
,
layoutExtent:
math
.
max
(
0
,
childLayoutGeometry
.
paintExtent
-
childLayoutGeometry
.
maxScrollObstructionExtent
)
,
maxPaintExtent:
childLayoutGeometry
.
maxPaintExtent
,
maxScrollObstructionExtent:
childLayoutGeometry
.
maxScrollObstructionExtent
,
hitTestExtent:
childLayoutGeometry
.
hitTestExtent
,
...
...
packages/flutter/test/widgets/nested_scroll_view_test.dart
View file @
3ae0345e
...
...
@@ -676,6 +676,12 @@ void main() {
await
gesture
.
up
();
debugDefaultTargetPlatformOverride
=
null
;
});
// Regression test for https://github.com/flutter/flutter/issues/39963.
testWidgets
(
'NestedScrollView with SliverOverlapAbsorber in or out of the first screen'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
const
_TestLayoutExtentIsNegative
(
1
));
await
tester
.
pumpWidget
(
const
_TestLayoutExtentIsNegative
(
10
));
});
}
class
TestHeader
extends
SliverPersistentHeaderDelegate
{
...
...
@@ -692,3 +698,60 @@ class TestHeader extends SliverPersistentHeaderDelegate {
@override
bool
shouldRebuild
(
TestHeader
oldDelegate
)
=>
false
;
}
class
_TestLayoutExtentIsNegative
extends
StatelessWidget
{
const
_TestLayoutExtentIsNegative
(
this
.
widgetCountBeforeSliverOverlapAbsorber
);
final
int
widgetCountBeforeSliverOverlapAbsorber
;
@override
Widget
build
(
BuildContext
context
)
{
return
MaterialApp
(
home:
Scaffold
(
appBar:
AppBar
(
title:
const
Text
(
'Test'
),
),
body:
NestedScrollView
(
headerSliverBuilder:
(
BuildContext
context
,
bool
innerBoxIsScrolled
)
{
return
<
Widget
>[
...
List
<
Widget
>.
generate
(
widgetCountBeforeSliverOverlapAbsorber
,
(
_
)
{
return
SliverToBoxAdapter
(
child:
Container
(
color:
Colors
.
red
,
height:
200
,
margin:
const
EdgeInsets
.
all
(
20
),
),
);
},),
SliverOverlapAbsorber
(
handle:
NestedScrollView
.
sliverOverlapAbsorberHandleFor
(
context
),
sliver:
SliverAppBar
(
pinned:
true
,
forceElevated:
innerBoxIsScrolled
,
backgroundColor:
Colors
.
blue
[
300
],
title:
Container
(
height:
50
,
child:
const
Center
(
child:
Text
(
'Sticky Header'
),
),
),
),
)
];
},
body:
Container
(
height:
2000
,
margin:
const
EdgeInsets
.
only
(
top:
50
),
child:
ListView
(
children:
List
<
Widget
>.
generate
(
3
,
(
_
)
{
return
Container
(
color:
Colors
.
green
[
200
],
height:
200
,
margin:
const
EdgeInsets
.
all
(
20
),
);
},),
),
),
),
),
);
}
}
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