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)
);
}
}
}
+7 -1
View File
@@ -1,5 +1,5 @@
{
"@@last_modified": "2023-06-08T15:15:04.969556",
"@@last_modified": "2023-06-08T16:53:26.593398",
"initializing_data": "Initializing data...",
"@initializing_data": {
"type": "text",
@@ -2899,5 +2899,11 @@
"type": "text",
"placeholders_order": [],
"placeholders": {}
},
"connectedToTheInternet": "Connected to the internet",
"@connectedToTheInternet": {
"type": "text",
"placeholders_order": [],
"placeholders": {}
}
}
@@ -2988,4 +2988,11 @@ class AppLocalizations {
name: 'error',
);
}
String get connectedToTheInternet {
return Intl.message(
'Connected to the internet',
name: 'connectedToTheInternet'
);
}
}