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
1c964797
Unverified
Commit
1c964797
authored
Jul 14, 2020
by
Fabusuyi Ayodeji
Committed by
GitHub
Jul 14, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
expose route settings for showModalBottomSheet (#60640)
parent
bb328088
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
0 deletions
+38
-0
bottom_sheet.dart
packages/flutter/lib/src/material/bottom_sheet.dart
+6
-0
bottom_sheet_test.dart
packages/flutter/test/material/bottom_sheet_test.dart
+32
-0
No files found.
packages/flutter/lib/src/material/bottom_sheet.dart
View file @
1c964797
...
...
@@ -583,6 +583,10 @@ class _BottomSheetSuspendedCurve extends ParametricCurve<double> {
/// parameters can be passed in to customize the appearance and behavior of
/// modal bottom sheets.
///
/// The optional `routeSettings` parameter sets the [RouteSettings] of the modal bottom sheet
/// sheet. This is particularly useful in the case that a user wants to observe
/// [PopupRoute]s within a [NavigatorObserver].
///
/// Returns a `Future` that resolves to the value (if any) that was passed to
/// [Navigator.pop] when the modal bottom sheet was closed.
///
...
...
@@ -648,6 +652,7 @@ Future<T> showModalBottomSheet<T>({
bool
useRootNavigator
=
false
,
bool
isDismissible
=
true
,
bool
enableDrag
=
true
,
RouteSettings
routeSettings
,
})
{
assert
(
context
!=
null
);
assert
(
builder
!=
null
);
...
...
@@ -670,6 +675,7 @@ Future<T> showModalBottomSheet<T>({
isDismissible:
isDismissible
,
modalBarrierColor:
barrierColor
,
enableDrag:
enableDrag
,
settings:
routeSettings
,
));
}
...
...
packages/flutter/test/material/bottom_sheet_test.dart
View file @
1c964797
...
...
@@ -696,6 +696,38 @@ void main() {
// the BottomNavigationBar.
expect
(
tester
.
getBottomLeft
(
find
.
byType
(
BottomSheet
)).
dy
,
600.0
);
});
testWidgets
(
'Verify that route settings can be set in the showModalBottomSheet'
,
(
WidgetTester
tester
)
async
{
final
GlobalKey
<
ScaffoldState
>
scaffoldKey
=
GlobalKey
<
ScaffoldState
>();
const
RouteSettings
routeSettings
=
RouteSettings
(
name:
'route_name'
,
arguments:
'route_argument'
);
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Scaffold
(
key:
scaffoldKey
,
body:
const
Center
(
child:
Text
(
'body'
)),
),
));
RouteSettings
retrievedRouteSettings
;
showModalBottomSheet
<
void
>(
context:
scaffoldKey
.
currentContext
,
routeSettings:
routeSettings
,
builder:
(
BuildContext
context
)
{
retrievedRouteSettings
=
ModalRoute
.
of
(
context
).
settings
;
return
Container
(
child:
const
Text
(
'BottomSheet'
),
);
},
);
await
tester
.
pump
();
await
tester
.
pump
(
const
Duration
(
seconds:
1
));
expect
(
retrievedRouteSettings
,
routeSettings
);
});
}
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