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
cd5936e4
Unverified
Commit
cd5936e4
authored
Oct 09, 2021
by
xubaolin
Committed by
GitHub
Oct 09, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix a BottomSheet nullable issue (#89362)
parent
abb7cf3d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
2 deletions
+30
-2
bottom_sheet.dart
packages/flutter/lib/src/material/bottom_sheet.dart
+10
-2
bottom_sheet_test.dart
packages/flutter/test/material/bottom_sheet_test.dart
+20
-0
No files found.
packages/flutter/lib/src/material/bottom_sheet.dart
View file @
cd5936e4
...
...
@@ -215,14 +215,22 @@ class _BottomSheetState extends State<BottomSheet> {
}
void
_handleDragUpdate
(
DragUpdateDetails
details
)
{
assert
(
widget
.
enableDrag
);
assert
(
widget
.
enableDrag
&&
widget
.
animationController
!=
null
,
"'BottomSheet.animationController' can not be null when 'BottomSheet.enableDrag' is true. "
"Use 'BottomSheet.createAnimationController' to create one, or provide another AnimationController."
,
);
if
(
_dismissUnderway
)
return
;
widget
.
animationController
!.
value
-=
details
.
primaryDelta
!
/
_childHeight
;
}
void
_handleDragEnd
(
DragEndDetails
details
)
{
assert
(
widget
.
enableDrag
);
assert
(
widget
.
enableDrag
&&
widget
.
animationController
!=
null
,
"'BottomSheet.animationController' can not be null when 'BottomSheet.enableDrag' is true. "
"Use 'BottomSheet.createAnimationController' to create one, or provide another AnimationController."
,
);
if
(
_dismissUnderway
)
return
;
bool
isClosing
=
false
;
...
...
packages/flutter/test/material/bottom_sheet_test.dart
View file @
cd5936e4
...
...
@@ -23,6 +23,26 @@ void main() {
expect
(
dyDelta1
,
isNot
(
moreOrLessEquals
(
dyDelta2
,
epsilon:
0.1
)));
}
testWidgets
(
'Throw if enable drag without an animation controller'
,
(
WidgetTester
tester
)
async
{
// Regression test for https://github.com/flutter/flutter/issues/89168
await
tester
.
pumpWidget
(
MaterialApp
(
home:
BottomSheet
(
onClosing:
()
{},
builder:
(
_
)
=>
Container
(
height:
200
,
color:
Colors
.
red
,
child:
const
Text
(
'BottomSheet'
),
),
),
),
);
await
tester
.
drag
(
find
.
text
(
'BottomSheet'
),
const
Offset
(
0.0
,
150.0
));
expect
(
tester
.
takeException
(),
isNotNull
);
});
testWidgets
(
'Tapping on a modal BottomSheet should not dismiss it'
,
(
WidgetTester
tester
)
async
{
late
BuildContext
savedContext
;
...
...
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