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
9e51cc3e
Unverified
Commit
9e51cc3e
authored
Oct 09, 2018
by
Jonah Williams
Committed by
GitHub
Oct 09, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add assert for null duration on snackbar (#22746)
parent
8d545e93
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
0 deletions
+29
-0
snack_bar.dart
packages/flutter/lib/src/material/snack_bar.dart
+1
-0
snack_bar_test.dart
packages/flutter/test/material/snack_bar_test.dart
+28
-0
No files found.
packages/flutter/lib/src/material/snack_bar.dart
View file @
9e51cc3e
...
...
@@ -155,6 +155,7 @@ class SnackBar extends StatelessWidget {
this
.
duration
=
_kSnackBarDisplayDuration
,
this
.
animation
,
})
:
assert
(
content
!=
null
),
assert
(
duration
!=
null
),
super
(
key:
key
);
/// The primary content of the snack bar.
...
...
packages/flutter/test/material/snack_bar_test.dart
View file @
9e51cc3e
...
...
@@ -662,4 +662,32 @@ void main() {
expect
(
find
.
text
(
'test'
),
findsNothing
);
});
testWidgets
(
'Snackbar asserts if passed a null duration'
,
(
WidgetTester
tester
)
async
{
const
Key
tapTarget
=
Key
(
'tap-target'
);
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Scaffold
(
body:
Builder
(
builder:
(
BuildContext
context
)
{
return
GestureDetector
(
onTap:
()
{
Scaffold
.
of
(
context
).
showSnackBar
(
SnackBar
(
content:
Text
(
nonconst
(
'hello'
)),
duration:
null
,
));
},
behavior:
HitTestBehavior
.
opaque
,
child:
Container
(
height:
100.0
,
width:
100.0
,
key:
tapTarget
),
);
},
),
),
));
await
tester
.
tap
(
find
.
byKey
(
tapTarget
));
expect
(
tester
.
takeException
(),
isNotNull
);
});
}
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