close method

void close([
  1. BuildContext? context
])

Implementation

void close([BuildContext? context]) {
  if (isOpen) {
    isOpen = false;
    final scaffold = Scaffold.of(context ?? this.context!);
    // Usually close only should set the isOpen variable, but if we have a
    // mobile sized device OR the fold policy is set to always, we close the
    // drawer (if its open) because this is how the actual libadwaita behaves
    if ((isModal || _policy == FoldPolicy.always) &&
        (scaffold.isDrawerOpen || scaffold.isEndDrawerOpen)) {
      Navigator.of(context ?? this.context!).pop();
    }
    notifyListeners();
  }
}