Toggle navigation
Toggle navigation
This project
Loading...
Sign in
flutter_package
/
modal_bottom_sheet
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Jaime Blasco
2022-06-25 14:05:31 +0200
Browse Files
Options
Browse Files
Download
Plain Diff
Committed by
GitHub
2022-06-25 14:05:31 +0200
Commit
6d8272bffed52dfc08a77d01a5d08ea7099f1910
6d8272bf
2 parents
8f426e62
b97cbc71
Merge pull request #250 from jamesblasco/fix/will_pop_close
fix/will_pop_closure
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
15 deletions
lib/src/bottom_sheet.dart
lib/src/bottom_sheet.dart
View file @
6d8272b
...
...
@@ -224,24 +224,27 @@ class _ModalBottomSheetState extends State<ModalBottomSheet>
// ignore: unawaited_futures
_bounceDragController
.
reverse
();
var
canClose
=
true
;
if
(
widget
.
shouldClose
!=
null
)
{
_cancelClose
();
canClose
=
await
shouldClose
();
}
if
(
canClose
)
{
// If speed is bigger than _minFlingVelocity try to close it
if
(
velocity
>
_minFlingVelocity
)
{
_close
();
}
else
if
(
hasReachedCloseThreshold
)
{
if
(
widget
.
animationController
.
value
>
0.0
)
{
// ignore: unawaited_futures
widget
.
animationController
.
fling
(
velocity:
-
1.0
);
Future
<
void
>
tryClose
()
async
{
if
(
widget
.
shouldClose
!=
null
)
{
_cancelClose
();
bool
canClose
=
await
shouldClose
();
if
(
canClose
)
{
_close
();
}
_close
();
}
else
{
_cancelClose
();
_close
();
}
}
// If speed is bigger than _minFlingVelocity try to close it
if
(
velocity
>
_minFlingVelocity
)
{
tryClose
();
}
else
if
(
hasReachedCloseThreshold
)
{
if
(
widget
.
animationController
.
value
>
0.0
)
{
// ignore: unawaited_futures
widget
.
animationController
.
fling
(
velocity:
-
1.0
);
}
tryClose
();
}
else
{
_cancelClose
();
}
...
...
Please
register
or
login
to post a comment