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
0da8012c
Unverified
Commit
0da8012c
authored
Jun 22, 2023
by
Masatoshi Tsushima
Committed by
GitHub
Jun 22, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix: Closing bottom sheet and removing FAB cause assertion failure (#128566)
Fixes #128562
parent
2e05371c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
61 additions
and
4 deletions
+61
-4
scaffold.dart
packages/flutter/lib/src/material/scaffold.dart
+2
-4
scaffold_test.dart
packages/flutter/test/material/scaffold_test.dart
+59
-0
No files found.
packages/flutter/lib/src/material/scaffold.dart
View file @
0da8012c
...
...
@@ -1358,11 +1358,9 @@ class _FloatingActionButtonTransitionState extends State<_FloatingActionButtonTr
void
_handlePreviousAnimationStatusChanged
(
AnimationStatus
status
)
{
setState
(()
{
if
(
status
==
AnimationStatus
.
dismissed
)
{
if
(
widget
.
child
!=
null
&&
status
==
AnimationStatus
.
dismissed
)
{
assert
(
widget
.
currentController
.
status
==
AnimationStatus
.
dismissed
);
if
(
widget
.
child
!=
null
)
{
widget
.
currentController
.
forward
();
}
widget
.
currentController
.
forward
();
}
});
}
...
...
packages/flutter/test/material/scaffold_test.dart
View file @
0da8012c
...
...
@@ -2801,6 +2801,65 @@ void main() {
// The scrim should be gone.
expect
(
findModalBarrier
(),
findsNothing
);
});
testWidgets
(
"Closing bottom sheet & removing FAB at the same time doesn't throw assertion"
,
(
WidgetTester
tester
)
async
{
final
Key
bottomSheetKey
=
UniqueKey
();
PersistentBottomSheetController
<
void
>?
controller
;
bool
show
=
true
;
await
tester
.
pumpWidget
(
StatefulBuilder
(
builder:
(
_
,
StateSetter
setState
)
=>
MaterialApp
(
home:
Scaffold
(
body:
Center
(
child:
Builder
(
builder:
(
BuildContext
context
)
=>
ElevatedButton
(
onPressed:
()
{
if
(
controller
==
null
)
{
controller
=
showBottomSheet
(
context:
context
,
builder:
(
_
)
=>
Container
(
key:
bottomSheetKey
,
height:
200
,
),
);
}
else
{
controller
!.
close
();
controller
=
null
;
}
},
child:
const
Text
(
'BottomSheet'
),
)),
),
floatingActionButton:
show
?
FloatingActionButton
(
onPressed:
()
=>
setState
(()
=>
show
=
false
))
:
null
,
),
),
));
// Show bottom sheet.
await
tester
.
tap
(
find
.
byType
(
ElevatedButton
));
await
tester
.
pumpAndSettle
(
const
Duration
(
seconds:
1
));
// Bottom sheet and FAB are visible.
expect
(
find
.
byType
(
FloatingActionButton
),
findsOneWidget
);
expect
(
find
.
byKey
(
bottomSheetKey
),
findsOneWidget
);
// Close bottom sheet while removing FAB.
await
tester
.
tap
(
find
.
byType
(
FloatingActionButton
));
await
tester
.
pump
();
// start animation
await
tester
.
tap
(
find
.
byType
(
ElevatedButton
));
// Let the animation finish.
await
tester
.
pumpAndSettle
(
const
Duration
(
seconds:
1
));
// Bottom sheet and FAB are gone.
expect
(
find
.
byType
(
FloatingActionButton
),
findsNothing
);
expect
(
find
.
byKey
(
bottomSheetKey
),
findsNothing
);
// No exception is thrown.
expect
(
tester
.
takeException
(),
isNull
);
});
}
class
_GeometryListener
extends
StatefulWidget
{
...
...
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