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
7992e324
Unverified
Commit
7992e324
authored
Jul 17, 2019
by
chunhtai
Committed by
GitHub
Jul 17, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix nested scroll view can rebuild if mark dirty during scheduleWarmUpFrame (#36097)
parent
5923f34c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
80 additions
and
1 deletion
+80
-1
nested_scroll_view.dart
packages/flutter/lib/src/widgets/nested_scroll_view.dart
+8
-1
nested_scroll_view_async_test.dart
...s/flutter/test/widgets/nested_scroll_view_async_test.dart
+72
-0
No files found.
packages/flutter/lib/src/widgets/nested_scroll_view.dart
View file @
7992e324
...
...
@@ -498,8 +498,15 @@ class _NestedScrollCoordinator implements ScrollActivityDelegate, ScrollHoldCont
bool
get
hasScrolledBody
{
for
(
_NestedScrollPosition
position
in
_innerPositions
)
{
if
(
position
.
pixels
>
position
.
minScrollExtent
)
// TODO(chunhtai): Replace null check with assert once
// https://github.com/flutter/flutter/issues/31195 is fixed.
if
(
position
.
minScrollExtent
!=
null
&&
position
.
pixels
!=
null
&&
position
.
pixels
>
position
.
minScrollExtent
)
{
return
true
;
}
}
return
false
;
}
...
...
packages/flutter/test/widgets/nested_scroll_view_async_test.dart
0 → 100644
View file @
7992e324
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:flutter/material.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter/gestures.dart'
show
DragStartBehavior
;
import
'package:quiver/testing/async.dart'
;
void
main
(
)
{
setUp
(()
{
WidgetsFlutterBinding
.
ensureInitialized
();
WidgetsBinding
.
instance
.
resetEpoch
();
});
test
(
'NestedScrollView can build sccessfully if mark dirty during warm up frame'
,
()
{
final
FakeAsync
fakeAsync
=
FakeAsync
();
fakeAsync
.
run
((
FakeAsync
async
)
{
runApp
(
MaterialApp
(
home:
Material
(
child:
DefaultTabController
(
length:
1
,
child:
NestedScrollView
(
dragStartBehavior:
DragStartBehavior
.
down
,
headerSliverBuilder:
(
BuildContext
context
,
bool
innerBoxIsScrolled
)
{
return
<
Widget
>[
const
SliverPersistentHeader
(
delegate:
TestHeader
(),
),
];
},
body:
SingleChildScrollView
(
dragStartBehavior:
DragStartBehavior
.
down
,
child:
Container
(
height:
1000.0
,
child:
const
Placeholder
(),
),
),
),
),
),
),
);
// Marks element as dirty right before the first draw frame is called.
// This can happen when engine flush user setting.
final
Element
element
=
find
.
byType
(
NestedScrollView
,
skipOffstage:
false
).
evaluate
().
single
;
element
.
markNeedsBuild
();
// Triggers draw frame timer scheduled in scheduleWarmUpFrame.
fakeAsync
.
flushTimers
();
});
// Make sure widget is rebuilt correctly.
expect
(
find
.
byType
(
NestedScrollView
,
skipOffstage:
false
).
evaluate
().
single
.
widget
is
NestedScrollView
,
isTrue
);
});
}
class
TestHeader
extends
SliverPersistentHeaderDelegate
{
const
TestHeader
();
@override
double
get
minExtent
=>
100.0
;
@override
double
get
maxExtent
=>
100.0
;
@override
Widget
build
(
BuildContext
context
,
double
shrinkOffset
,
bool
overlapsContent
)
{
return
const
Placeholder
();
}
@override
bool
shouldRebuild
(
TestHeader
oldDelegate
)
=>
false
;
}
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