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
a3eeb51a
Commit
a3eeb51a
authored
Nov 23, 2019
by
Takeshi Tsukamoto
Committed by
Dan Field
Nov 23, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix draggable scrollable sheet scroll notification (#45083)
parent
5fb790e6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
8 deletions
+58
-8
draggable_scrollable_sheet.dart
...s/flutter/lib/src/widgets/draggable_scrollable_sheet.dart
+2
-0
draggable_scrollable_sheet_test.dart
...flutter/test/widgets/draggable_scrollable_sheet_test.dart
+56
-8
No files found.
packages/flutter/lib/src/widgets/draggable_scrollable_sheet.dart
View file @
a3eeb51a
...
...
@@ -490,6 +490,8 @@ class _DraggableScrollableSheetScrollPosition
velocity
=
ballisticController
.
velocity
+
(
physics
.
tolerance
.
velocity
*
ballisticController
.
velocity
.
sign
);
super
.
goBallistic
(
velocity
);
ballisticController
.
stop
();
}
else
if
(
ballisticController
.
isCompleted
)
{
super
.
goBallistic
(
0
);
}
}
...
...
packages/flutter/test/widgets/draggable_scrollable_sheet_test.dart
View file @
a3eeb51a
...
...
@@ -15,6 +15,7 @@ void main() {
double
minChildSize
=
.
25
,
double
itemExtent
,
Key
containerKey
,
NotificationListenerCallback
<
ScrollNotification
>
onScrollNotification
,
})
{
return
Directionality
(
textDirection:
TextDirection
.
ltr
,
...
...
@@ -29,14 +30,17 @@ void main() {
minChildSize:
minChildSize
,
initialChildSize:
initialChildSize
,
builder:
(
BuildContext
context
,
ScrollController
scrollController
)
{
return
Container
(
key:
containerKey
,
color:
const
Color
(
0xFFABCDEF
),
child:
ListView
.
builder
(
controller:
scrollController
,
itemExtent:
itemExtent
,
itemCount:
itemCount
,
itemBuilder:
(
BuildContext
context
,
int
index
)
=>
Text
(
'Item
$index
'
),
return
NotificationListener
<
ScrollNotification
>(
onNotification:
onScrollNotification
,
child:
Container
(
key:
containerKey
,
color:
const
Color
(
0xFFABCDEF
),
child:
ListView
.
builder
(
controller:
scrollController
,
itemExtent:
itemExtent
,
itemCount:
itemCount
,
itemBuilder:
(
BuildContext
context
,
int
index
)
=>
Text
(
'Item
$index
'
),
),
),
);
},
...
...
@@ -260,5 +264,49 @@ void main() {
debugDefaultTargetPlatformOverride
=
null
;
});
testWidgets
(
'ScrollNotification correctly dispatched when flung without covering its container'
,
(
WidgetTester
tester
)
async
{
final
List
<
Type
>
notificationTypes
=
<
Type
>[];
await
tester
.
pumpWidget
(
_boilerplate
(
null
,
onScrollNotification:
(
ScrollNotification
notification
)
{
notificationTypes
.
add
(
notification
.
runtimeType
);
return
false
;
},
));
await
tester
.
fling
(
find
.
text
(
'Item 1'
),
const
Offset
(
0
,
-
200
),
200
);
await
tester
.
pumpAndSettle
();
// TODO(itome): Make sure UserScrollNotification and ScrollUpdateNotification are called correctly.
final
List
<
Type
>
types
=
<
Type
>[
ScrollStartNotification
,
ScrollEndNotification
,
];
expect
(
notificationTypes
,
equals
(
types
));
});
testWidgets
(
'ScrollNotification correctly dispatched when flung with contents scroll'
,
(
WidgetTester
tester
)
async
{
final
List
<
Type
>
notificationTypes
=
<
Type
>[];
await
tester
.
pumpWidget
(
_boilerplate
(
null
,
onScrollNotification:
(
ScrollNotification
notification
)
{
notificationTypes
.
add
(
notification
.
runtimeType
);
return
false
;
},
));
await
tester
.
flingFrom
(
const
Offset
(
0
,
325
),
const
Offset
(
0
,
-
325
),
200
);
await
tester
.
pumpAndSettle
();
final
List
<
Type
>
types
=
<
Type
>[
ScrollStartNotification
,
UserScrollNotification
,
...
List
<
Type
>.
filled
(
5
,
ScrollUpdateNotification
),
ScrollEndNotification
,
UserScrollNotification
,
];
expect
(
notificationTypes
,
types
);
});
}
}
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