import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; // Import for SystemChrome import 'package:intl/date_symbol_data_local.dart'; import 'screens/home_screen.dart'; import 'services/notification_service.dart'; import 'services/app_settings.dart'; import 'theme/app_theme.dart'; void main() async { WidgetsFlutterBinding.ensureInitialized(); await AppSettings.instance.load(); await initializeDateFormatting(); // Slovenian month/day names for every screen try { await NotificationService().initialize(); } catch (_) {} // Refresh reminders in the background so they don't depend on opening the calendar NotificationService().rescheduleFromCalendar(); // Lock orientation to portrait only await SystemChrome.setPreferredOrientations([ DeviceOrientation.portraitUp, DeviceOrientation.portraitDown, ]); // Set system UI overlay style globally for the app SystemChrome.setSystemUIOverlayStyle( SystemUiOverlayStyle( statusBarColor: Colors.grey[900], systemNavigationBarColor: Colors.grey[900], systemNavigationBarIconBrightness: Brightness.light, // No grey scrim behind 3-button navigation; we paint the strip ourselves systemNavigationBarContrastEnforced: false, ), ); runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( title: 'SD Kovinar', debugShowCheckedModeBanner: false, theme: AppTheme.light(), darkTheme: AppTheme.dark(), builder: (context, child) { final originalTextScaler = MediaQuery.of(context).textScaler; final clampedScale = originalTextScaler.clamp(minScaleFactor: 0.8, maxScaleFactor: 1.2); // Edge-to-edge (Android 15+) ignores the navigation bar color, so paint // the system bar strip ourselves on every screen, matching our bars. final systemBar = MediaQuery.viewPaddingOf(context).bottom; return MediaQuery( data: MediaQuery.of(context).copyWith( textScaler: clampedScale, ), child: Stack( children: [ child!, Positioned( left: 0, right: 0, bottom: 0, height: systemBar, child: IgnorePointer(child: ColoredBox(color: AppTheme.bar)), ), ], ), ); }, home: const HomeScreen(), ); } }