- Fix deprecated @ignore in json_serializable models (appState, yourLocation) - Fix empty catch blocks in compassMapPlugin, globalFiresBottomStats, locationUtils - Fix no_logic_in_create_state in firesApp, markdownPage, slider - Fix use_build_context_synchronously in fireAlert - Fix only_throw_errors in firesApi (8 instances) - Exclude generated .g.dart files from analysis - Update deprecated nullable: false to @JsonSerializable() Build: APK generated successfully, 0 errors, 0 warnings
83 lines
2.8 KiB
Dart
83 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 {
|
|
const FiresApp(this.store, {super.key});
|
|
|
|
final Store<AppState> store;
|
|
|
|
@override
|
|
_FiresAppState createState() => _FiresAppState();
|
|
}
|
|
|
|
class _FiresAppState extends State<FiresApp> {
|
|
// globals.getIt.registerSingleton
|
|
_FiresAppState();
|
|
late final Store<AppState> store;
|
|
final GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>();
|
|
static Widget introWidget(BuildContext context) => IntroPage();
|
|
static Widget continueWidget(BuildContext context) => const HomePage();
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
store = widget.store;
|
|
}
|
|
|
|
final Map<String, WidgetBuilder> routes = <String, WidgetBuilder>{
|
|
IntroPage.routeName: introWidget,
|
|
HomePage.routeName: continueWidget,
|
|
PrivacyPage.routeName: (BuildContext context) => PrivacyPage(context),
|
|
ActiveFiresPage.routeName: (BuildContext context) =>
|
|
const ActiveFiresPage(),
|
|
Sandbox.routeName: (BuildContext context) => const Sandbox(),
|
|
FireAlert.routeName: (BuildContext context) => const FireAlert(),
|
|
SupportPage.routeName: (BuildContext context) => const SupportPage(),
|
|
FireNotificationList.routeName: (BuildContext context) =>
|
|
const FireNotificationList(),
|
|
MonitoredAreasPage.routeName: (BuildContext context) =>
|
|
const MonitoredAreasPage()
|
|
};
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final StatefulWidget home = MaterialAppWithIntroHome(
|
|
introWidget, continueWidget, 'showInitialWizard-2018-06-27-01');
|
|
return StoreProvider<AppState>(
|
|
store: store,
|
|
child: MaterialApp(
|
|
navigatorKey: navigatorKey,
|
|
localizationsDelegates: const <LocalizationsDelegate<dynamic>>[
|
|
S.delegate,
|
|
GlobalMaterialLocalizations.delegate,
|
|
GlobalWidgetsLocalizations.delegate,
|
|
],
|
|
supportedLocales: S.delegate.supportedLocales,
|
|
localeResolutionCallback:
|
|
S.delegate.resolution(fallback: const Locale('en', '')),
|
|
home: home,
|
|
onGenerateTitle: (BuildContext context) {
|
|
return S.of(context).appName;
|
|
},
|
|
theme: isDevelopment ? devFiresTheme : firesTheme,
|
|
routes: routes));
|
|
}
|
|
}
|