isShowingModalBottomSheet method

bool isShowingModalBottomSheet(
  1. BuildContext? context
)

检测是否打开了 showModalBottomSheet 或 Dialog

Implementation

bool isShowingModalBottomSheet(BuildContext? context) {
  if (context == null) {
    return false;
  }
  return ModalRoute.of(context)?.isCurrent ?? false;
}