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
2366cf73
Commit
2366cf73
authored
Apr 19, 2017
by
Hans Muller
Committed by
GitHub
Apr 19, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Dimissing the system keyboard shouldn't defeat scrolling (#9470)
parent
02526228
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
76 additions
and
1 deletion
+76
-1
scroll_position.dart
packages/flutter/lib/src/widgets/scroll_position.dart
+1
-1
list_view_misc_test.dart
packages/flutter/test/widgets/list_view_misc_test.dart
+75
-0
No files found.
packages/flutter/lib/src/widgets/scroll_position.dart
View file @
2366cf73
...
...
@@ -59,7 +59,7 @@ abstract class ScrollPhysics {
/// there is actually content outside the viewport to reveal.
bool
shouldAcceptUserOffset
(
ScrollPosition
position
)
{
if
(
parent
==
null
)
return
position
.
minScrollExtent
!=
position
.
maxScrollExtent
;
return
position
.
pixels
!=
0.0
||
position
.
minScrollExtent
!=
position
.
maxScrollExtent
;
return
parent
.
shouldAcceptUserOffset
(
position
);
}
...
...
packages/flutter/test/widgets/list_view_misc_test.dart
View file @
2366cf73
...
...
@@ -148,4 +148,79 @@ void main() {
);
expect
(
maxScrollOffset
,
equals
(
26.0
));
});
testWidgets
(
'Resizing a ListView child restores scroll offset'
,
(
WidgetTester
tester
)
async
{
// Regression test for https://github.com/flutter/flutter/issues/9221
final
AnimationController
controller
=
new
AnimationController
(
vsync:
const
TestVSync
(),
duration:
const
Duration
(
milliseconds:
200
),
);
// The overall height of the frame is (as ever) 600
Widget
buildFrame
()
{
return
new
Column
(
children:
<
Widget
>[
new
Flexible
(
// The overall height of the ListView's contents is 500
child:
new
ListView
(
children:
<
Widget
>[
const
SizedBox
(
height:
150.0
,
child:
const
Center
(
child:
const
Text
(
'top'
)
),
),
const
SizedBox
(
height:
200.0
,
child:
const
Center
(
child:
const
Text
(
'middle'
)
),
),
const
SizedBox
(
height:
150.0
,
child:
const
Center
(
child:
const
Text
(
'bottom'
)
),
),
],
),
),
// If this widget's height is > 100 the ListView can scroll.
new
SizeTransition
(
sizeFactor:
controller
.
view
,
child:
const
SizedBox
(
height:
300.0
,
child:
const
Text
(
'keyboard'
),
),
),
],
);
}
await
tester
.
pumpWidget
(
buildFrame
());
expect
(
find
.
text
(
'top'
),
findsOneWidget
);
final
ScrollPosition
position
=
Scrollable
.
of
(
tester
.
element
(
find
.
text
(
'middle'
))).
position
;
expect
(
position
.
viewportDimension
,
600.0
);
expect
(
position
.
pixels
,
0.0
);
// Animate the 'keyboard' height from 0 to 300
controller
.
forward
();
await
tester
.
pumpAndSettle
();
expect
(
position
.
viewportDimension
,
300.0
);
// Scroll the ListView upwards
position
.
jumpTo
(
200.0
);
await
tester
.
pumpAndSettle
();
expect
(
position
.
pixels
,
200.0
);
expect
(
find
.
text
(
'top'
),
findsNothing
);
// Animate the 'keyboard' height back to 0. This causes the scroll
// offset to return to 0.0
controller
.
reverse
();
await
tester
.
pumpAndSettle
();
expect
(
position
.
viewportDimension
,
600.0
);
expect
(
position
.
pixels
,
0.0
);
expect
(
find
.
text
(
'top'
),
findsOneWidget
);
});
}
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