Skip to content

Commit

Permalink
refactor: replace offline widget with error screen for no internet co…
Browse files Browse the repository at this point in the history
…nnection
  • Loading branch information
sharjeelyunus committed Feb 11, 2025
1 parent 30204d3 commit b0163a1
Showing 1 changed file with 5 additions and 24 deletions.
29 changes: 5 additions & 24 deletions modules/ensemble/lib/ensemble_app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -256,29 +256,6 @@ class EnsembleAppState extends State<EnsembleApp> with WidgetsBindingObserver {
});
}

/// “No Internet” widget.
Widget _buildOfflineWidget() {
return MaterialApp(
home: Scaffold(
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Icon(Icons.wifi_off, size: 100, color: Colors.red),
const SizedBox(height: 20),
const Text(
'No Internet Connection',
style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
),
const SizedBox(height: 10),
const Text('Please enable internet connectivity.'),
],
),
),
),
);
}

@override
Widget build(BuildContext context) {
return FutureBuilder(
Expand All @@ -287,7 +264,11 @@ class EnsembleAppState extends State<EnsembleApp> with WidgetsBindingObserver {
if (snapshot.hasError) {
if (!_hasInternet) {
// Show the no internet widget if there is an error fetching the definitions and there is no internet connection.
return _buildOfflineWidget();
return _appPlaceholderWrapper(
placeholderWidget: ErrorScreen(LanguageError(
'No Internet Connection',
detailedError:
'Please enable internet connectivity to load the app.')));
}
return _appPlaceholderWrapper(
placeholderWidget: ErrorScreen(LanguageError(
Expand Down

0 comments on commit b0163a1

Please sign in to comment.