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
6efdf0ae
Unverified
Commit
6efdf0ae
authored
May 25, 2022
by
xubaolin
Committed by
GitHub
May 25, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix a _DraggableScrollableSheetScrollPosition update bug (#103328)
parent
9f856ac1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
0 deletions
+63
-0
draggable_scrollable_sheet.dart
...s/flutter/lib/src/widgets/draggable_scrollable_sheet.dart
+15
-0
draggable_scrollable_sheet_test.dart
...flutter/test/widgets/draggable_scrollable_sheet_test.dart
+48
-0
No files found.
packages/flutter/lib/src/widgets/draggable_scrollable_sheet.dart
View file @
6efdf0ae
...
...
@@ -810,6 +810,21 @@ class _DraggableScrollableSheetScrollPosition extends ScrollPositionWithSingleCo
_DraggableSheetExtent
get
extent
=>
getExtent
();
@override
void
absorb
(
ScrollPosition
other
)
{
super
.
absorb
(
other
);
assert
(
_dragCancelCallback
==
null
);
if
(
other
is
!
_DraggableScrollableSheetScrollPosition
)
{
return
;
}
if
(
other
.
_dragCancelCallback
!=
null
)
{
_dragCancelCallback
=
other
.
_dragCancelCallback
;
other
.
_dragCancelCallback
=
null
;
}
}
@override
void
beginActivity
(
ScrollActivity
?
newActivity
)
{
// Cancel the running ballistic simulations
...
...
packages/flutter/test/widgets/draggable_scrollable_sheet_test.dart
View file @
6efdf0ae
...
...
@@ -63,6 +63,54 @@ void main() {
);
}
testWidgets
(
'Do not crash when replacing scroll position during the drag'
,
(
WidgetTester
tester
)
async
{
// Regression test for https://github.com/flutter/flutter/issues/89681
bool
showScrollbars
=
false
;
await
tester
.
pumpWidget
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
MediaQuery
(
data:
const
MediaQueryData
(),
child:
Align
(
alignment:
Alignment
.
bottomCenter
,
child:
DraggableScrollableSheet
(
initialChildSize:
0.7
,
minChildSize:
0.2
,
maxChildSize:
0.9
,
expand:
false
,
builder:
(
BuildContext
context
,
ScrollController
scrollController
)
{
showScrollbars
=
!
showScrollbars
;
// Change the scroll behavior will trigger scroll position replace.
final
ScrollBehavior
behavior
=
const
ScrollBehavior
().
copyWith
(
scrollbars:
showScrollbars
);
return
ScrollConfiguration
(
behavior:
behavior
,
child:
ListView
.
separated
(
physics:
const
BouncingScrollPhysics
(),
controller:
scrollController
,
separatorBuilder:
(
_
,
__
)
=>
const
Divider
(),
itemCount:
100
,
itemBuilder:
(
_
,
int
index
)
=>
SizedBox
(
height:
100
,
child:
ColoredBox
(
color:
Colors
.
primaries
[
index
%
Colors
.
primaries
.
length
],
child:
Text
(
'Item
$index
'
),
),
),
),
);
},
),
),
),
),
);
await
tester
.
fling
(
find
.
text
(
'Item 1'
),
const
Offset
(
0
,
200
),
350
);
await
tester
.
pumpAndSettle
();
// Go without throw.
});
testWidgets
(
'Scrolls correct amount when maxChildSize < 1.0'
,
(
WidgetTester
tester
)
async
{
const
Key
key
=
ValueKey
<
String
>(
'container'
);
await
tester
.
pumpWidget
(
boilerplateWidget
(
...
...
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