close method

Future<Null> close()

Bring the panel to PanelState.closed.

Returned future is completed when the panel is closed.

(Animates to PanelSize.closedHeight).

Implementation

Future<Null> close() async {
  if (controlling) {
    if (currentPosition == 0.0 && (panel!._metadata.closedHeight > 0.0)) {
      // if closing from dismissed, DONT notify results yet
      panel!._shouldNotifyOnClose = false;
    }

    return _setPanelPosition(panel!,
        duration: currentState == PanelState.collapsed
            ? _durationCollapsed
            : currentState == PanelState.expanded
                ? panel!.widget.duration
                : _getDuration(
                    from: currentPosition, to: panel!._metadata.closedHeight),
        to: panel!._metadata.closedHeight);
  } else {
    _printError();
  }
}