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
c1872c32
Unverified
Commit
c1872c32
authored
Dec 08, 2021
by
Markus Aksli
Committed by
GitHub
Dec 08, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bottom sheet assertion on switching with multiple controllers (#93922)
parent
7638cd52
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
1 deletion
+53
-1
scaffold.dart
packages/flutter/lib/src/material/scaffold.dart
+1
-1
bottom_sheet_test.dart
packages/flutter/test/material/bottom_sheet_test.dart
+52
-0
No files found.
packages/flutter/lib/src/material/scaffold.dart
View file @
c1872c32
...
@@ -2360,7 +2360,7 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin, Resto
...
@@ -2360,7 +2360,7 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin, Resto
final
LocalHistoryEntry
?
entry
=
isPersistent
final
LocalHistoryEntry
?
entry
=
isPersistent
?
null
?
null
:
LocalHistoryEntry
(
onRemove:
()
{
:
LocalHistoryEntry
(
onRemove:
()
{
if
(!
removedEntry
)
{
if
(!
removedEntry
&&
_currentBottomSheet
?.
_widget
==
bottomSheet
)
{
_removeCurrentBottomSheet
();
_removeCurrentBottomSheet
();
}
}
});
});
...
...
packages/flutter/test/material/bottom_sheet_test.dart
View file @
c1872c32
...
@@ -1204,6 +1204,58 @@ void main() {
...
@@ -1204,6 +1204,58 @@ void main() {
expect
(
tester
.
takeException
(),
isNull
);
expect
(
tester
.
takeException
(),
isNull
);
});
});
testWidgets
(
'Calling PersistentBottomSheetController.close does not crash when it is not the current bottom sheet'
,
(
WidgetTester
tester
)
async
{
// Regression test for https://github.com/flutter/flutter/issues/93717
PersistentBottomSheetController
<
void
>?
sheetController1
;
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Scaffold
(
body:
Builder
(
builder:
(
BuildContext
context
)
{
return
SafeArea
(
child:
Column
(
children:
<
Widget
>[
ElevatedButton
(
child:
const
Text
(
'show 1'
),
onPressed:
()
{
sheetController1
=
Scaffold
.
of
(
context
).
showBottomSheet
<
void
>(
(
BuildContext
context
)
=>
const
Text
(
'BottomSheet 1'
),
);
},
),
ElevatedButton
(
child:
const
Text
(
'show 2'
),
onPressed:
()
{
Scaffold
.
of
(
context
).
showBottomSheet
<
void
>(
(
BuildContext
context
)
=>
const
Text
(
'BottomSheet 2'
),
);
},
),
ElevatedButton
(
child:
const
Text
(
'close 1'
),
onPressed:
(){
sheetController1
!.
close
();
},
),
],
),
);
}),
),
));
await
tester
.
tap
(
find
.
text
(
'show 1'
));
await
tester
.
pumpAndSettle
();
expect
(
find
.
text
(
'BottomSheet 1'
),
findsOneWidget
);
await
tester
.
tap
(
find
.
text
(
'show 2'
));
await
tester
.
pumpAndSettle
();
expect
(
find
.
text
(
'BottomSheet 2'
),
findsOneWidget
);
// This will throw an assertion if regressed
await
tester
.
tap
(
find
.
text
(
'close 1'
));
await
tester
.
pumpAndSettle
();
expect
(
find
.
text
(
'BottomSheet 2'
),
findsOneWidget
);
});
group
(
'constraints'
,
()
{
group
(
'constraints'
,
()
{
testWidgets
(
'No constraints by default for bottomSheet property'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'No constraints by default for bottomSheet property'
,
(
WidgetTester
tester
)
async
{
...
...
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