showOverlayWhenUnavailableNetwork method

Future<bool> showOverlayWhenUnavailableNetwork(
  1. UnavailableNetworkAlertBuilder alertUnavailableNetwork, {
  2. bool willPop = true,
})

网络不可用 时 弹出 Overlay 禁止操作

Implementation

Future<bool> showOverlayWhenUnavailableNetwork(
    UnavailableNetworkAlertBuilder alertUnavailableNetwork,
    {bool willPop = true}) async {
  if (!networkAvailability) {
    if (isAndroid && willPop) GlobalOptions().isWillPop = false;
    _connectivityOverlay ??=
        alertUnavailableNetwork(networkAvailability, _currentStatus);
  } else {
    if (isAndroid && willPop) GlobalOptions().isWillPop = true;
    _connectivityOverlay?.removeEntry();
    _connectivityOverlay = null;
  }
  return true;
}