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
737824db
Unverified
Commit
737824db
authored
Jan 14, 2021
by
xubaolin
Committed by
GitHub
Jan 14, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
snackBar should paint above the bottomSheet (#73558)
parent
68d8c4b3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
19 deletions
+44
-19
scaffold.dart
packages/flutter/lib/src/material/scaffold.dart
+19
-19
snack_bar_test.dart
packages/flutter/test/material/snack_bar_test.dart
+25
-0
No files found.
packages/flutter/lib/src/material/scaffold.dart
View file @
737824db
...
...
@@ -3031,6 +3031,25 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin, Resto
'the preferred API instead of the Scaffold methods.'
);
if
(
_currentBottomSheet
!=
null
||
_dismissedBottomSheets
.
isNotEmpty
)
{
final
Widget
stack
=
Stack
(
alignment:
Alignment
.
bottomCenter
,
children:
<
Widget
>[
...
_dismissedBottomSheets
,
if
(
_currentBottomSheet
!=
null
)
_currentBottomSheet
!.
_widget
,
],
);
_addIfNonNull
(
children
,
stack
,
_ScaffoldSlot
.
bottomSheet
,
removeLeftPadding:
false
,
removeTopPadding:
true
,
removeRightPadding:
false
,
removeBottomPadding:
_resizeToAvoidBottomInset
,
);
}
// SnackBar set by ScaffoldMessenger
if
(
_messengerSnackBar
!=
null
)
{
final
SnackBarBehavior
snackBarBehavior
=
_messengerSnackBar
?.
_widget
.
behavior
...
...
@@ -3110,25 +3129,6 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin, Resto
);
}
if
(
_currentBottomSheet
!=
null
||
_dismissedBottomSheets
.
isNotEmpty
)
{
final
Widget
stack
=
Stack
(
alignment:
Alignment
.
bottomCenter
,
children:
<
Widget
>[
...
_dismissedBottomSheets
,
if
(
_currentBottomSheet
!=
null
)
_currentBottomSheet
!.
_widget
,
],
);
_addIfNonNull
(
children
,
stack
,
_ScaffoldSlot
.
bottomSheet
,
removeLeftPadding:
false
,
removeTopPadding:
true
,
removeRightPadding:
false
,
removeBottomPadding:
_resizeToAvoidBottomInset
,
);
}
_addIfNonNull
(
children
,
_FloatingActionButtonTransition
(
...
...
packages/flutter/test/material/snack_bar_test.dart
View file @
737824db
...
...
@@ -2266,4 +2266,29 @@ void main() {
final
AssertionError
error
=
exceptions
.
first
as
AssertionError
;
expect
(
error
.
message
,
contains
(
'Only one API should be used to manage SnackBars.'
));
});
testWidgets
(
'SnackBars should be shown above the bottomSheet'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
const
MaterialApp
(
home:
Scaffold
(
bottomSheet:
SizedBox
(
width:
200
,
height:
50
,
child:
ColoredBox
(
color:
Colors
.
pink
,
),
),
),
));
final
ScaffoldMessengerState
scaffoldMessengerState
=
tester
.
state
(
find
.
byType
(
ScaffoldMessenger
));
scaffoldMessengerState
.
showSnackBar
(
SnackBar
(
content:
const
Text
(
'I love Flutter!'
),
duration:
const
Duration
(
seconds:
2
),
action:
SnackBarAction
(
label:
'ACTION'
,
onPressed:
()
{}),
behavior:
SnackBarBehavior
.
floating
,
));
await
tester
.
pumpAndSettle
();
// Have the SnackBar fully animate out.
await
expectLater
(
find
.
byType
(
MaterialApp
),
matchesGoldenFile
(
'snack_bar.goldenTest.workWithBottomSheet.png'
));
});
}
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