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
e10310d2
Unverified
Commit
e10310d2
authored
Jun 30, 2022
by
xubaolin
Committed by
GitHub
Jun 30, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reland "fix a Scaffold.bottomSheet update bug" (#106775)
parent
cf6b91d0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
0 deletions
+29
-0
scaffold.dart
packages/flutter/lib/src/material/scaffold.dart
+11
-0
persistent_bottom_sheet_test.dart
...s/flutter/test/material/persistent_bottom_sheet_test.dart
+18
-0
No files found.
packages/flutter/lib/src/material/scaffold.dart
View file @
e10310d2
...
...
@@ -2124,6 +2124,17 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin, Resto
return
false
;
}
// Stop the animation and unmount the dismissed sheets from the tree immediately,
// otherwise may cause duplicate GlobalKey assertion if the sheet sub-tree contains
// GlobalKey widgets.
if
(
_dismissedBottomSheets
.
isNotEmpty
)
{
final
List
<
_StandardBottomSheet
>
sheets
=
List
<
_StandardBottomSheet
>.
of
(
_dismissedBottomSheets
,
growable:
false
);
for
(
final
_StandardBottomSheet
sheet
in
sheets
)
{
sheet
.
animationController
.
reset
();
}
assert
(
_dismissedBottomSheets
.
isEmpty
);
}
_currentBottomSheet
=
_buildBottomSheet
<
void
>(
(
BuildContext
context
)
{
return
NotificationListener
<
DraggableScrollableNotification
>(
...
...
packages/flutter/test/material/persistent_bottom_sheet_test.dart
View file @
e10310d2
...
...
@@ -22,6 +22,24 @@ void main() {
expect
(
dyDelta1
,
isNot
(
moreOrLessEquals
(
dyDelta2
,
epsilon:
0.1
)));
}
// Regression test for https://github.com/flutter/flutter/issues/83668
testWidgets
(
'Scaffold.bottomSheet update test'
,
(
WidgetTester
tester
)
async
{
Widget
buildFrame
(
Widget
?
bottomSheet
)
{
return
MaterialApp
(
home:
Scaffold
(
body:
const
Placeholder
(),
bottomSheet:
bottomSheet
,
),
);
}
await
tester
.
pumpWidget
(
buildFrame
(
const
Text
(
'I love Flutter!'
)));
await
tester
.
pumpWidget
(
buildFrame
(
null
));
// The disappearing animation has not yet been completed.
await
tester
.
pumpWidget
(
buildFrame
(
const
Text
(
'I love Flutter!'
)));
});
testWidgets
(
'Verify that a BottomSheet can be rebuilt with ScaffoldFeatureController.setState()'
,
(
WidgetTester
tester
)
async
{
final
GlobalKey
<
ScaffoldState
>
scaffoldKey
=
GlobalKey
<
ScaffoldState
>();
int
buildCount
=
0
;
...
...
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