TF-1915 Show toast message when connected to the internet
(cherry picked from commit a1f466725cf1896cfb43144d41c6806a074e06eb)
This commit is contained in:
@@ -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)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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'
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user