showNoInternet method
dynamic
showNoInternet()
Responsible for getting the current context from the tree and draw the custom widget
Implementation
showNoInternet() {
if (ZoConnectivityWatcher().isNoInternetWidgetVisible) {
return;
}
currentContext = _contextKey.currentContext;
if (currentContext != null) {
ZoConnectivityWatcher().isNoInternetWidgetVisible = true;
if (_connectivityStyle == NoConnectivityStyle.SNACKBAR) {
showSnackBar(currentContext!);
} else if (_connectivityStyle == NoConnectivityStyle.ALERT &&
!isAlertActive) {
showPlatformAlert();
} else if (_connectivityStyle == NoConnectivityStyle.CUSTOMALERT &&
!isAlertActive) {
showDialog(
context: currentContext!,
builder: (context) {
isAlertActive = true;
return _customAlert!;
},
);
} else {
_entry = OverlayEntry(builder: (context) {
_overlayContext.add(context);
return _userWidget ??
Container(
color: Colors.amber,
child: Text("No Internet"),
);
});
_entries.add(_entry!);
_overlayState?.insert(_entry!);
}
}
}