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
45cf2792
Unverified
Commit
45cf2792
authored
Jan 22, 2021
by
Zain Ur Rehman
Committed by
GitHub
Jan 22, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[showModalBottomSheet] fix: showModalBottomSheet does not move along keyboard (#71636)
parent
6a2dfa9f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
15 deletions
+53
-15
bottom_sheet.dart
packages/flutter/lib/src/material/bottom_sheet.dart
+18
-15
bottom_sheet_test.dart
packages/flutter/test/material/bottom_sheet_test.dart
+35
-0
No files found.
packages/flutter/lib/src/material/bottom_sheet.dart
View file @
45cf2792
...
...
@@ -375,21 +375,24 @@ class _ModalBottomSheetState<T> extends State<_ModalBottomSheet<T>> {
return
AnimatedBuilder
(
animation:
widget
.
route
!.
animation
!,
child:
BottomSheet
(
animationController:
widget
.
route
!.
_animationController
,
onClosing:
()
{
if
(
widget
.
route
!.
isCurrent
)
{
Navigator
.
pop
(
context
);
}
},
builder:
widget
.
route
!.
builder
!,
backgroundColor:
widget
.
backgroundColor
,
elevation:
widget
.
elevation
,
shape:
widget
.
shape
,
clipBehavior:
widget
.
clipBehavior
,
enableDrag:
widget
.
enableDrag
,
onDragStart:
handleDragStart
,
onDragEnd:
handleDragEnd
,
child:
Padding
(
padding:
MediaQuery
.
of
(
context
).
viewInsets
,
child:
BottomSheet
(
animationController:
widget
.
route
!.
_animationController
,
onClosing:
()
{
if
(
widget
.
route
!.
isCurrent
)
{
Navigator
.
pop
(
context
);
}
},
builder:
widget
.
route
!.
builder
!,
backgroundColor:
widget
.
backgroundColor
,
elevation:
widget
.
elevation
,
shape:
widget
.
shape
,
clipBehavior:
widget
.
clipBehavior
,
enableDrag:
widget
.
enableDrag
,
onDragStart:
handleDragStart
,
onDragEnd:
handleDragEnd
,
),
),
builder:
(
BuildContext
context
,
Widget
?
child
)
{
// Disable the initial animation when accessible navigation is on so
...
...
packages/flutter/test/material/bottom_sheet_test.dart
View file @
45cf2792
...
...
@@ -726,6 +726,41 @@ void main() {
expect
(
retrievedRouteSettings
,
routeSettings
);
});
testWidgets
(
'showModalBottomSheet should move along on-screen keyboard'
,
(
WidgetTester
tester
)
async
{
late
BuildContext
savedContext
;
// Show a keyboard (simulate by space at the bottom of the screen).
await
tester
.
pumpWidget
(
MaterialApp
(
home:
MediaQuery
(
data:
const
MediaQueryData
(
viewInsets:
EdgeInsets
.
only
(
bottom:
200
)),
child:
Builder
(
builder:
(
BuildContext
context
)
{
savedContext
=
context
;
return
Container
();
},
),
),
),
);
await
tester
.
pump
();
expect
(
find
.
text
(
'BottomSheet'
),
findsNothing
);
showModalBottomSheet
<
void
>(
context:
savedContext
,
builder:
(
BuildContext
context
)
{
return
const
Text
(
'BottomSheet'
);
},
);
await
tester
.
pumpAndSettle
();
expect
(
find
.
text
(
'BottomSheet'
),
findsOneWidget
);
expect
(
tester
.
getBottomLeft
(
find
.
text
(
'BottomSheet'
)).
dy
,
600
);
});
}
class
_TestPage
extends
StatelessWidget
{
...
...
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