let AI comment everything because well... yeah...

This commit is contained in:
Nico
2025-06-06 21:00:32 +02:00
parent 9c84d0c375
commit cc110ac104
44 changed files with 1230 additions and 646 deletions

View File

@@ -13,22 +13,36 @@ import 'package:shared_preferences/shared_preferences.dart';
import 'home.dart';
import 'l10n/l10n.dart';
// * Main entry point of the LUPUS app
// * Configures the app's:
// * - Theme and appearance
// * - Localization
// * - Navigation routes
// * - Initial settings
/// Initialize the app and configure default settings
void main() async {
WidgetsFlutterBinding.ensureInitialized();
// Set default values (Propably there is a better way to do this)
// Initialize SharedPreferences for app settings
SharedPreferences prefs = await SharedPreferences.getInstance();
// isFirstLaunch decides whether the intro screen is shown or not
// Check if this is the first app launch
bool isFirstLaunch = prefs.getBool('isFirstLaunch') ?? true;
// Set default control periods if not already configured
if (prefs.getString("kTage1")?.isEmpty ?? true) await prefs.setString('kTage1', "28");
if (prefs.getString("kTage2")?.isEmpty ?? true) await prefs.setString('kTage2', "48");
// Commented out API addresses for testing purposes
// if (prefs.getString("fotofallenApiAddress")?.isEmpty ?? true) await prefs.setString('fotofallenApiAddress', 'http://192.168.1.170/www.dbb-wolf.de/data/app24.php');
// if (prefs.getString("exkursionenApiAddress")?.isEmpty ?? true) await prefs.setString('exkursionenApiAddress', 'http://192.168.1.170/www.dbb-wolf.de/data/api_exkursion.php');
runApp(MyApp(isFirstLaunch: isFirstLaunch));
}
/// Main app widget that configures the app's theme and routing
class MyApp extends StatelessWidget {
final bool isFirstLaunch;
const MyApp({super.key, required this.isFirstLaunch});
@@ -36,13 +50,16 @@ class MyApp extends StatelessWidget {
Widget build(BuildContext context) {
return MaterialApp(
title: 'LUPUS',
// Configure light theme with gold color scheme
theme: FlexThemeData.light(scheme: FlexScheme.gold, useMaterial3: true),
darkTheme:
FlexThemeData.dark(scheme: FlexScheme.greenM3, useMaterial3: true),
themeMode: ThemeMode.system,
// here the isFirstLaunch comes into play
// Configure dark theme with green M3 color scheme
darkTheme: FlexThemeData.dark(scheme: FlexScheme.greenM3, useMaterial3: true),
themeMode: ThemeMode.system, // Use system theme preference
// Show intro screen on first launch, otherwise go to home
initialRoute: isFirstLaunch ? '/introScreen' : '/home',
// Localization settings
// Configure localization support
supportedLocales: L10n.all,
localizationsDelegates: const [
AppLocalizations.delegate,
@@ -50,6 +67,8 @@ class MyApp extends StatelessWidget {
GlobalCupertinoLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
],
// Define app navigation routes
routes: {
'/home': (context) => const HomePage(),
'/addCamMain': (context) => const AddCamMain(),