open method
Future<void>
open({
- ActionPosition position = ActionPosition.pre,
- Curve curve = Curves.easeInOut,
- Duration duration = const Duration(milliseconds: 300),
- VoidCallback? onOpened,
open the SlidablePanel to the position
it will make the actions of SlideActionPanel visible at the position
onOpened
would be called when the SlideActionPanel at position
is opened if provided
if there are no actions to show at position
, it would have no effect
if the position
has been visible/opened, it would have no effect
Implementation
Future<void> open({
ActionPosition position = ActionPosition.pre,
Curve curve = Curves.easeInOut,
Duration duration = const Duration(milliseconds: 300),
VoidCallback? onOpened,
}) async {
final target = layoutSize!.getOpenTarget(position);
if (target != null && ratio != target) {
await _animationController.animateTo(
target,
curve: curve,
duration: duration,
);
_resetDrag();
final shouldInvoke =
(position == ActionPosition.pre && ratio == _lowerBound) ||
(position == ActionPosition.post && ratio == _upperBound);
if (shouldInvoke) {
onOpened?.call();
}
}
}