todos-contra-el-fuego-mobile/lib/firesApp.dart
vjrj a7f3ab6974 Fix remaining compilation errors: null-safety, removed packages, and nullable handling
- Fix AppState: remove removed connectivity package, fix imports (latlong2), make nullable fields optional
- Fix User model: use const empty strings in const constructor instead of null
- Fix model builders: add required ObjectId parameters to YourLocation and FireNotification
- Implement Comparable instead of extending it for BasicLocation
- Fix nullable callback handling in appActions and middleware (Completer<Null>?)
- Add null checks for BuildContext in dialogs (fireAlert, homePage, etc.)
- Fix nullable scaffold state access using ?. operator (activeFires, fireNotificationList)
- Handle nullable FireNotification and YourLocation in genericMapBottom
- Fix list type casting for widgets that can be null (<Widget?> with filtering)
- Add ObjectId imports where needed for model creation
- Fix Key? nullable parameter in introPage
- Add required parameters to markdownPage and slider constructors
- Remove connectivity-related code and imports (package removed)
- Handle nullable Completer in fetchDataMiddleware

All 104 errors resolved. 0 errors, 61 warnings/info remaining.
2026-03-05 02:50:32 +01:00

80 lines
2.8 KiB
Dart

import 'package:comunes_flutter/comunes_flutter.dart';
import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:flutter_redux/flutter_redux.dart';
import 'package:redux/redux.dart';
import 'activeFires.dart';
import 'fireAlert.dart';
import 'fireNotificationList.dart';
import 'generated/i18n.dart';
import 'globals.dart';
import 'homePage.dart';
import 'introPage.dart';
import 'models/appState.dart';
import 'monitoredAreas.dart';
import 'privacyPage.dart';
import 'sandbox.dart';
import 'supportPage.dart';
import 'theme.dart';
import 'themeDev.dart';
class FiresApp extends StatefulWidget {
FiresApp(this.store);
final Store<AppState> store;
@override
_FiresAppState createState() => _FiresAppState(store);
}
class _FiresAppState extends State<FiresApp> {
final GlobalKey<NavigatorState> navigatorKey =
new GlobalKey<NavigatorState>();
static final WidgetBuilder introWidget = (context) => new IntroPage();
static final WidgetBuilder continueWidget = (context) => new HomePage();
final Map<String, WidgetBuilder> routes = <String, WidgetBuilder>{
IntroPage.routeName: introWidget,
HomePage.routeName: continueWidget,
PrivacyPage.routeName: (BuildContext context) => new PrivacyPage(context),
ActiveFiresPage.routeName: (BuildContext context) => new ActiveFiresPage(),
Sandbox.routeName: (BuildContext context) => new Sandbox(),
FireAlert.routeName: (BuildContext context) => new FireAlert(),
SupportPage.routeName: (BuildContext context) => new SupportPage(),
FireNotificationList.routeName: (BuildContext context) =>
new FireNotificationList(),
MonitoredAreasPage.routeName: (BuildContext context) =>
new MonitoredAreasPage()
};
final Store<AppState> store;
// globals.getIt.registerSingleton
_FiresAppState(this.store);
@override
Widget build(BuildContext context) {
StatefulWidget home = new MaterialAppWithIntroHome(
introWidget, continueWidget, 'showInitialWizard-2018-06-27-01');
return new StoreProvider<AppState>(
store: this.store,
child: new MaterialApp(
navigatorKey: navigatorKey,
localizationsDelegates: [
S.delegate,
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
],
supportedLocales: S.delegate.supportedLocales,
localeResolutionCallback:
S.delegate.resolution(fallback: new Locale("en", "")),
home: home,
onGenerateTitle: (context) {
print('MaterialApp onGenerateTitle');
return S.of(context).appName;
},
theme: isDevelopment ? devFiresTheme : firesTheme,
routes: routes));
}
}