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
e0afee5b
Unverified
Commit
e0afee5b
authored
Sep 21, 2020
by
Raouf Rahiche
Committed by
GitHub
Sep 21, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add ScrollViewKeyboardDismissBehavior to CustomScrollView constructor (#66014)
parent
36a6ef64
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
0 deletions
+41
-0
scroll_view.dart
packages/flutter/lib/src/widgets/scroll_view.dart
+2
-0
scroll_view_test.dart
packages/flutter/test/widgets/scroll_view_test.dart
+39
-0
No files found.
packages/flutter/lib/src/widgets/scroll_view.dart
View file @
e0afee5b
...
...
@@ -596,6 +596,7 @@ class CustomScrollView extends ScrollView {
this
.
slivers
=
const
<
Widget
>[],
int
?
semanticChildCount
,
DragStartBehavior
dragStartBehavior
=
DragStartBehavior
.
start
,
ScrollViewKeyboardDismissBehavior
keyboardDismissBehavior
=
ScrollViewKeyboardDismissBehavior
.
manual
,
String
?
restorationId
,
Clip
clipBehavior
=
Clip
.
hardEdge
,
})
:
super
(
...
...
@@ -611,6 +612,7 @@ class CustomScrollView extends ScrollView {
cacheExtent:
cacheExtent
,
semanticChildCount:
semanticChildCount
,
dragStartBehavior:
dragStartBehavior
,
keyboardDismissBehavior:
keyboardDismissBehavior
,
restorationId:
restorationId
,
clipBehavior:
clipBehavior
,
);
...
...
packages/flutter/test/widgets/scroll_view_test.dart
View file @
e0afee5b
...
...
@@ -799,6 +799,45 @@ void main() {
log
.
clear
();
});
testWidgets
(
'CustomScrollView dismiss keyboard onDrag test'
,
(
WidgetTester
tester
)
async
{
final
List
<
FocusNode
>
focusNodes
=
List
<
FocusNode
>.
generate
(
50
,
(
int
i
)
=>
FocusNode
());
await
tester
.
pumpWidget
(
textFieldBoilerplate
(
child:
CustomScrollView
(
dragStartBehavior:
DragStartBehavior
.
down
,
keyboardDismissBehavior:
ScrollViewKeyboardDismissBehavior
.
onDrag
,
slivers:
<
Widget
>[
SliverList
(
delegate:
SliverChildListDelegate
(
focusNodes
.
map
((
FocusNode
focusNode
)
{
return
Container
(
height:
50
,
color:
Colors
.
green
,
child:
TextField
(
focusNode:
focusNode
,
style:
const
TextStyle
(
fontSize:
24
,
fontWeight:
FontWeight
.
bold
,
)
),
);
}).
toList
(),
),
),
],
),
));
final
Finder
finder
=
find
.
byType
(
TextField
).
first
;
final
TextField
textField
=
tester
.
widget
(
finder
);
await
tester
.
showKeyboard
(
finder
);
expect
(
textField
.
focusNode
.
hasFocus
,
isTrue
);
await
tester
.
drag
(
finder
,
const
Offset
(
0.0
,
-
40.0
));
await
tester
.
pumpAndSettle
();
expect
(
textField
.
focusNode
.
hasFocus
,
isFalse
);
});
testWidgets
(
'Can jumpTo during drag'
,
(
WidgetTester
tester
)
async
{
final
List
<
Type
>
log
=
<
Type
>[];
final
ScrollController
controller
=
ScrollController
();
...
...
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