Implement initial features for husband's companion app, including mock data service and husband notes screen. Refactor scripture and cycle services for improved stability and testability. Address iOS Safari web app startup issue by removing deprecated initialization. - Implemented MockDataService and HusbandNotesScreen. - Converted _DashboardTab and DevotionalScreen to StatefulWidgets for robust scripture provider initialization. - Refactored CycleService to use immutable CycleInfo class, reducing UI rebuilds. - Removed deprecated window.flutterConfiguration from index.html, resolving Flutter web app startup failure on iOS Safari. - Updated and fixed related tests.
56 lines
1.7 KiB
Dart
56 lines
1.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
import 'package:hive_flutter/hive_flutter.dart';
|
|
import 'package:google_fonts/google_fonts.dart';
|
|
|
|
import 'models/scripture.dart';
|
|
import 'theme/app_theme.dart';
|
|
import 'screens/splash_screen.dart';
|
|
import 'models/user_profile.dart';
|
|
import 'models/cycle_entry.dart';
|
|
|
|
void main() async {
|
|
WidgetsFlutterBinding.ensureInitialized();
|
|
|
|
// Initialize Hive for local storage
|
|
await Hive.initFlutter();
|
|
|
|
// Register Hive adapters
|
|
Hive.registerAdapter(UserProfileAdapter());
|
|
Hive.registerAdapter(CycleEntryAdapter());
|
|
Hive.registerAdapter(RelationshipStatusAdapter());
|
|
Hive.registerAdapter(FertilityGoalAdapter());
|
|
Hive.registerAdapter(MoodLevelAdapter());
|
|
Hive.registerAdapter(FlowIntensityAdapter());
|
|
Hive.registerAdapter(CervicalMucusTypeAdapter());
|
|
Hive.registerAdapter(CyclePhaseAdapter());
|
|
Hive.registerAdapter(UserRoleAdapter());
|
|
Hive.registerAdapter(BibleTranslationAdapter());
|
|
Hive.registerAdapter(ScriptureAdapter()); // Register Scripture adapter
|
|
|
|
// Open boxes and load scriptures in parallel
|
|
await Future.wait([
|
|
Hive.openBox<UserProfile>('user_profile'),
|
|
Hive.openBox<CycleEntry>('cycle_entries'),
|
|
ScriptureDatabase().loadScriptures(),
|
|
]);
|
|
|
|
runApp(const ProviderScope(child: ChristianPeriodTrackerApp()));
|
|
}
|
|
|
|
class ChristianPeriodTrackerApp extends StatelessWidget {
|
|
const ChristianPeriodTrackerApp({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return MaterialApp(
|
|
title: 'Christian Period Tracker',
|
|
debugShowCheckedModeBanner: false,
|
|
theme: AppTheme.lightTheme,
|
|
darkTheme: AppTheme.darkTheme,
|
|
themeMode: ThemeMode.system,
|
|
home: const SplashScreen(),
|
|
);
|
|
}
|
|
}
|