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
364d73c7
Unverified
Commit
364d73c7
authored
Apr 15, 2019
by
xster
Committed by
GitHub
Apr 15, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make CupertinoNavigationBarBackButton correctly return an assert error (#30815)
parent
d6285371
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
1 deletion
+23
-1
nav_bar.dart
packages/flutter/lib/src/cupertino/nav_bar.dart
+1
-1
nav_bar_test.dart
packages/flutter/test/cupertino/nav_bar_test.dart
+22
-0
No files found.
packages/flutter/lib/src/cupertino/nav_bar.dart
View file @
364d73c7
...
...
@@ -1231,7 +1231,7 @@ class CupertinoNavigationBarBackButton extends StatelessWidget {
Widget
build
(
BuildContext
context
)
{
final
ModalRoute
<
dynamic
>
currentRoute
=
ModalRoute
.
of
(
context
);
assert
(
currentRoute
.
canPop
,
currentRoute
?.
canPop
==
true
,
'CupertinoNavigationBarBackButton should only be used in routes that can be popped'
,
);
...
...
packages/flutter/test/cupertino/nav_bar_test.dart
View file @
364d73c7
...
...
@@ -883,6 +883,28 @@ void main() {
);
expect
(
SystemChrome
.
latestStyle
,
SystemUiOverlayStyle
.
dark
);
});
testWidgets
(
'CupertinoNavigationBarBackButton shows an error when manually added outside a route'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
const
CupertinoNavigationBarBackButton
()
);
final
dynamic
exception
=
tester
.
takeException
();
expect
(
exception
,
isAssertionError
);
expect
(
exception
.
toString
(),
contains
(
'CupertinoNavigationBarBackButton should only be used in routes that can be popped'
));
});
testWidgets
(
'CupertinoNavigationBarBackButton shows an error when placed in a route that cannot be popped'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
const
CupertinoApp
(
home:
CupertinoNavigationBarBackButton
(),
),
);
final
dynamic
exception
=
tester
.
takeException
();
expect
(
exception
,
isAssertionError
);
expect
(
exception
.
toString
(),
contains
(
'CupertinoNavigationBarBackButton should only be used in routes that can be popped'
));
});
}
class
_ExpectStyles
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