2022-12-15 11:00:28 +00:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/services.dart';
|
|
|
|
import 'package:flutter_localizations/flutter_localizations.dart';
|
2023-02-11 19:19:18 +00:00
|
|
|
import 'package:lightmeter/data/models/supported_locale.dart';
|
2023-05-11 13:30:18 +00:00
|
|
|
import 'package:lightmeter/generated/l10n.dart';
|
2024-01-13 17:20:58 +00:00
|
|
|
import 'package:lightmeter/platform_config.dart';
|
2023-08-14 10:25:37 +00:00
|
|
|
import 'package:lightmeter/providers/user_preferences_provider.dart';
|
2024-07-23 19:37:17 +00:00
|
|
|
import 'package:lightmeter/screens/lightmeter_pro/screen_lightmeter_pro.dart';
|
2023-05-11 13:30:18 +00:00
|
|
|
import 'package:lightmeter/screens/metering/flow_metering.dart';
|
|
|
|
import 'package:lightmeter/screens/settings/flow_settings.dart';
|
2024-05-22 20:50:47 +00:00
|
|
|
import 'package:lightmeter/screens/shared/release_notes_dialog/flow_dialog_release_notes.dart';
|
2024-05-07 17:24:51 +00:00
|
|
|
import 'package:lightmeter/screens/timer/flow_timer.dart';
|
2022-12-15 11:00:28 +00:00
|
|
|
|
2023-01-07 09:14:18 +00:00
|
|
|
class Application extends StatelessWidget {
|
2023-09-28 21:29:33 +00:00
|
|
|
const Application({super.key});
|
2022-12-15 11:00:28 +00:00
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2023-09-28 21:29:33 +00:00
|
|
|
final theme = UserPreferencesProvider.themeOf(context);
|
|
|
|
final systemIconsBrightness = ThemeData.estimateBrightnessForColor(theme.colorScheme.onSurface);
|
|
|
|
return AnnotatedRegion(
|
|
|
|
value: SystemUiOverlayStyle(
|
|
|
|
statusBarColor: Colors.transparent,
|
2024-01-13 17:20:58 +00:00
|
|
|
statusBarBrightness: systemIconsBrightness == Brightness.light ? Brightness.dark : Brightness.light,
|
2023-09-28 21:29:33 +00:00
|
|
|
statusBarIconBrightness: systemIconsBrightness,
|
|
|
|
systemNavigationBarColor: Colors.transparent,
|
|
|
|
systemNavigationBarIconBrightness: systemIconsBrightness,
|
|
|
|
),
|
|
|
|
child: MaterialApp(
|
2024-01-13 17:20:58 +00:00
|
|
|
debugShowCheckedModeBanner: !PlatformConfig.isTest,
|
2023-09-28 21:29:33 +00:00
|
|
|
theme: theme,
|
|
|
|
locale: Locale(UserPreferencesProvider.localeOf(context).intlName),
|
|
|
|
localizationsDelegates: const [
|
|
|
|
S.delegate,
|
|
|
|
GlobalMaterialLocalizations.delegate,
|
|
|
|
GlobalWidgetsLocalizations.delegate,
|
|
|
|
GlobalCupertinoLocalizations.delegate,
|
|
|
|
],
|
|
|
|
supportedLocales: S.delegate.supportedLocales,
|
|
|
|
builder: (context, child) => MediaQuery(
|
|
|
|
data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0),
|
|
|
|
child: child!,
|
|
|
|
),
|
|
|
|
initialRoute: "metering",
|
|
|
|
routes: {
|
2024-05-22 20:50:47 +00:00
|
|
|
"metering": (_) => const ReleaseNotesFlow(child: MeteringFlow()),
|
2024-05-07 17:24:51 +00:00
|
|
|
"settings": (_) => const SettingsFlow(),
|
2024-07-23 19:37:17 +00:00
|
|
|
"lightmeterPro": (_) => LightmeterProScreen(),
|
2024-05-07 17:24:51 +00:00
|
|
|
"timer": (context) => TimerFlow(args: ModalRoute.of(context)!.settings.arguments! as TimerFlowArgs),
|
2023-09-28 21:29:33 +00:00
|
|
|
},
|
|
|
|
),
|
2023-02-11 19:19:18 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|