TF-1915 Show toast message when connected to the internet

(cherry picked from commit a1f466725cf1896cfb43144d41c6806a074e06eb)
This commit is contained in:
dab246
2023-06-08 16:54:12 +07:00
committed by Dat Vu
parent 3100e00c9e
commit 9b5f533579
7 changed files with 117 additions and 87 deletions
@@ -58,6 +58,8 @@ class NetworkConnectionController extends BaseController {
_setNetworkConnectivityState(result);
if (_isEnableShowToastDisconnection && !isNetworkConnectionAvailable()) {
_showToastLostConnection();
} else if (isNetworkConnectionAvailable()) {
_showToastConnectedToTheNetwork();
} else {
ToastView.dismiss();
}
@@ -94,4 +96,18 @@ class NetworkConnectionController extends BaseController {
);
}
}
void _showToastConnectedToTheNetwork() {
if (currentContext != null && currentOverlayContext != null) {
_appToast.showToastMessage(
currentOverlayContext!,
AppLocalizations.of(currentContext!).connectedToTheInternet,
leadingSVGIcon: _imagePaths.icConnectedInternet,
backgroundColor: AppColor.primaryColor,
textColor: Colors.white,
padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 12),
duration: const Duration(seconds: 5)
);
}
}
}