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
1aaa455f
Unverified
Commit
1aaa455f
authored
Oct 13, 2020
by
Miguel Beltran
Committed by
GitHub
Oct 13, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for "Pass RouteSettings to the internal Route in showCupertinoModalPopup" (#67990)
parent
49825559
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
0 deletions
+49
-0
route.dart
packages/flutter/lib/src/cupertino/route.dart
+5
-0
route_test.dart
packages/flutter/test/cupertino/route_test.dart
+44
-0
No files found.
packages/flutter/lib/src/cupertino/route.dart
View file @
1aaa455f
...
...
@@ -1031,6 +1031,9 @@ class _CupertinoModalPopupRoute<T> extends PopupRoute<T> {
/// The `semanticsDismissible` argument is used to determine whether the
/// semantics of the modal barrier are included in the semantics tree.
///
/// The `routeSettings` argument is used to provide [RouteSettings] to the
/// created Route.
///
/// The `builder` argument typically builds a [CupertinoActionSheet] widget.
/// Content below the widget is dimmed with a [ModalBarrier]. The widget built
/// by the `builder` does not share a context with the location that
...
...
@@ -1054,6 +1057,7 @@ Future<T> showCupertinoModalPopup<T>({
bool
barrierDismissible
=
true
,
bool
useRootNavigator
=
true
,
bool
?
semanticsDismissible
,
RouteSettings
?
routeSettings
,
})
{
assert
(
useRootNavigator
!=
null
);
return
Navigator
.
of
(
context
,
rootNavigator:
useRootNavigator
)!.
push
(
...
...
@@ -1064,6 +1068,7 @@ Future<T> showCupertinoModalPopup<T>({
builder:
builder
,
filter:
filter
,
semanticsDismissible:
semanticsDismissible
,
settings:
routeSettings
,
),
);
}
...
...
packages/flutter/test/cupertino/route_test.dart
View file @
1aaa455f
...
...
@@ -1345,6 +1345,38 @@ void main() {
debugDefaultTargetPlatformOverride
=
null
;
});
testWidgets
(
'showCupertinoModalPopup passes RouteSettings to PopupRoute'
,
(
WidgetTester
tester
)
async
{
final
RouteSettingsObserver
routeSettingsObserver
=
RouteSettingsObserver
();
await
tester
.
pumpWidget
(
CupertinoApp
(
navigatorObservers:
<
NavigatorObserver
>[
routeSettingsObserver
],
home:
Navigator
(
onGenerateRoute:
(
RouteSettings
settings
)
{
return
PageRouteBuilder
<
dynamic
>(
pageBuilder:
(
BuildContext
context
,
Animation
<
double
>
_
,
Animation
<
double
>
__
)
{
return
GestureDetector
(
onTap:
()
async
{
await
showCupertinoModalPopup
<
void
>(
context:
context
,
builder:
(
BuildContext
context
)
=>
const
SizedBox
(),
routeSettings:
const
RouteSettings
(
name:
'/modal'
),
);
},
child:
const
Text
(
'tap'
),
);
},
);
},
),
));
// Open the dialog.
await
tester
.
tap
(
find
.
text
(
'tap'
));
expect
(
routeSettingsObserver
.
routeName
,
'/modal'
);
});
testWidgets
(
'showCupertinoModalPopup transparent barrier color is transparent'
,
(
WidgetTester
tester
)
async
{
const
Color
_kTransparentColor
=
Color
(
0x00000000
);
...
...
@@ -1657,6 +1689,18 @@ class DialogObserver extends NavigatorObserver {
}
}
class
RouteSettingsObserver
extends
NavigatorObserver
{
String
?
routeName
;
@override
void
didPush
(
Route
<
dynamic
>
route
,
Route
<
dynamic
>?
previousRoute
)
{
if
(
route
.
toString
().
contains
(
'_CupertinoModalPopupRoute'
))
{
routeName
=
route
.
settings
.
name
;
}
super
.
didPush
(
route
,
previousRoute
);
}
}
class
TransitionDetector
extends
DefaultTransitionDelegate
<
void
>
{
bool
hasTransition
=
false
;
@override
...
...
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