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-04-07 12:23:34 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
b97cbc71b3f0c80965853da5bc599628af2b179b
b97cbc71
1 parent
6b18665f
fix/will_pop_closure
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
16 deletions
lib/src/bottom_sheet.dart
lib/src/bottom_sheet.dart
View file @
b97cbc7
...
...
@@ -45,7 +45,7 @@ class ModalBottomSheet extends StatefulWidget {
required
this
.
expanded
,
required
this
.
onClosing
,
required
this
.
child
,
})
:
super
(
key:
key
);
})
:
super
(
key:
key
);
/// The closeProgressThreshold parameter
/// specifies when the bottom sheet will be dismissed when user drags it.
...
...
@@ -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