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
38fe53b6
Unverified
Commit
38fe53b6
authored
May 05, 2022
by
Kate Lovett
Committed by
GitHub
May 05, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Add assertion that snackbars have a place to go" (#103138)
parent
f771c9fe
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
33 deletions
+0
-33
scaffold.dart
packages/flutter/lib/src/material/scaffold.dart
+0
-5
snack_bar_test.dart
packages/flutter/test/material/snack_bar_test.dart
+0
-28
No files found.
packages/flutter/lib/src/material/scaffold.dart
View file @
38fe53b6
...
...
@@ -265,11 +265,6 @@ class ScaffoldMessengerState extends State<ScaffoldMessenger> with TickerProvide
/// ** See code in examples/api/lib/material/scaffold/scaffold_messenger_state.show_snack_bar.0.dart **
/// {@end-tool}
ScaffoldFeatureController
<
SnackBar
,
SnackBarClosedReason
>
showSnackBar
(
SnackBar
snackBar
)
{
assert
(
_scaffolds
.
isNotEmpty
,
'ScaffoldMessenger.showSnackBar was called, but there are currently no '
'descendant Scaffolds to present to.'
,
);
_snackBarController
??=
SnackBar
.
createAnimationController
(
vsync:
this
)
..
addStatusListener
(
_handleSnackBarStatusChanged
);
if
(
_snackBars
.
isEmpty
)
{
...
...
packages/flutter/test/material/snack_bar_test.dart
View file @
38fe53b6
...
...
@@ -2090,34 +2090,6 @@ void main() {
await
tester
.
pump
(
const
Duration
(
milliseconds:
750
));
await
expectLater
(
find
.
byType
(
MaterialApp
),
matchesGoldenFile
(
'snack_bar.goldenTest.backdropFilter.png'
));
});
testWidgets
(
'ScaffoldMessenger will alert for snackbars that cannot be presented'
,
(
WidgetTester
tester
)
async
{
// Regression test for https://github.com/flutter/flutter/issues/103004
await
tester
.
pumpWidget
(
const
MaterialApp
(
home:
Center
(),
));
final
ScaffoldMessengerState
scaffoldMessengerState
=
tester
.
state
<
ScaffoldMessengerState
>(
find
.
byType
(
ScaffoldMessenger
),
);
expect
(
()
{
scaffoldMessengerState
.
showSnackBar
(
const
SnackBar
(
content:
Text
(
'I am a snack bar.'
),
));
},
throwsA
(
isA
<
AssertionError
>().
having
(
(
AssertionError
error
)
=>
error
.
toString
(),
'description'
,
contains
(
'ScaffoldMessenger.showSnackBar was called, but there are currently '
'no descendant Scaffolds to present to.'
)
),
),
);
});
}
/// Start test for "SnackBar dismiss test".
...
...
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