Extract settings and harden geofence automation
This commit is contained in:
@@ -1,45 +1,38 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'app/app_bootstrap.dart';
|
||||
import 'features/settings/providers/settings_providers.dart';
|
||||
import 'features/shared/providers/core_providers.dart';
|
||||
import 'screens/homes_screen.dart';
|
||||
import 'screens/remote_screen.dart';
|
||||
import 'services/settings_service.dart';
|
||||
|
||||
Future<void> main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
runApp(const ProviderScope(child: IgnisApp()));
|
||||
final settingsService = SettingsService();
|
||||
final initialTheme = await settingsService.getAppThemePreset();
|
||||
|
||||
runApp(
|
||||
ProviderScope(
|
||||
overrides: [
|
||||
settingsServiceProvider.overrideWithValue(settingsService),
|
||||
initialAppThemePresetProvider.overrideWithValue(initialTheme),
|
||||
],
|
||||
child: const IgnisApp(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
class IgnisApp extends StatelessWidget {
|
||||
class IgnisApp extends ConsumerWidget {
|
||||
const IgnisApp({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final themePreset = ref.watch(appThemeProvider);
|
||||
return MaterialApp(
|
||||
title: 'Ignis',
|
||||
debugShowCheckedModeBanner: false,
|
||||
theme: ThemeData.dark(useMaterial3: true).copyWith(
|
||||
scaffoldBackgroundColor: const Color(0xFF0E0E0E),
|
||||
colorScheme: ColorScheme.fromSeed(
|
||||
seedColor: Colors.deepOrange,
|
||||
brightness: Brightness.dark,
|
||||
),
|
||||
appBarTheme: const AppBarTheme(
|
||||
backgroundColor: Color(0xFF1A1A1A),
|
||||
elevation: 0,
|
||||
centerTitle: true,
|
||||
),
|
||||
cardTheme: CardThemeData(
|
||||
color: const Color(0xFF1E1E1E),
|
||||
elevation: 2,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
),
|
||||
sliderTheme: const SliderThemeData(
|
||||
trackHeight: 4,
|
||||
thumbShape: RoundSliderThumbShape(enabledThumbRadius: 8),
|
||||
),
|
||||
),
|
||||
theme: themePreset.themeData,
|
||||
home: const MainGate(),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user