105 lines
2.6 KiB
Dart
105 lines
2.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
import 'screens/dashboard/dashboard_screen.dart';
|
|
import 'screens/routines/routines_screen.dart';
|
|
import 'screens/calendar/calendar_screen.dart';
|
|
import 'screens/stats/stats_screen.dart';
|
|
import 'screens/settings/settings_screen.dart';
|
|
import 'theme/app_theme.dart';
|
|
|
|
void main() async {
|
|
WidgetsFlutterBinding.ensureInitialized();
|
|
|
|
// Initialize Hive (local database)
|
|
// await Hive.initFlutter();
|
|
// _registerAdapters();
|
|
|
|
runApp(
|
|
const ProviderScope(
|
|
child: LifeFlowApp(),
|
|
),
|
|
);
|
|
}
|
|
|
|
class LifeFlowApp extends StatelessWidget {
|
|
const LifeFlowApp({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return MaterialApp(
|
|
title: 'LifeFlow',
|
|
debugShowCheckedModeBanner: false,
|
|
theme: AppTheme.lightTheme,
|
|
darkTheme: AppTheme.darkTheme,
|
|
themeMode: ThemeMode.system,
|
|
home: const MainNavigationScreen(),
|
|
);
|
|
}
|
|
}
|
|
|
|
class MainNavigationScreen extends StatefulWidget {
|
|
const MainNavigationScreen({super.key});
|
|
|
|
@override
|
|
State<MainNavigationScreen> createState() => _MainNavigationScreenState();
|
|
}
|
|
|
|
class _MainNavigationScreenState extends State<MainNavigationScreen> {
|
|
int _currentIndex = 0;
|
|
|
|
final _screens = const [
|
|
DashboardScreen(),
|
|
RoutinesScreen(),
|
|
CalendarScreen(),
|
|
StatsScreen(),
|
|
SettingsScreen(),
|
|
];
|
|
|
|
final _destinations = const [
|
|
NavigationDestination(
|
|
icon: Icon(Icons.dashboard_outlined),
|
|
selectedIcon: Icon(Icons.dashboard),
|
|
label: 'Home',
|
|
),
|
|
NavigationDestination(
|
|
icon: Icon(Icons.checklist_outlined),
|
|
selectedIcon: Icon(Icons.checklist),
|
|
label: 'Routines',
|
|
),
|
|
NavigationDestination(
|
|
icon: Icon(Icons.calendar_today_outlined),
|
|
selectedIcon: Icon(Icons.calendar_today),
|
|
label: 'Calendar',
|
|
),
|
|
NavigationDestination(
|
|
icon: Icon(Icons.insights_outlined),
|
|
selectedIcon: Icon(Icons.insights),
|
|
label: 'Stats',
|
|
),
|
|
NavigationDestination(
|
|
icon: Icon(Icons.settings_outlined),
|
|
selectedIcon: Icon(Icons.settings),
|
|
label: 'Settings',
|
|
),
|
|
];
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
body: AnimatedSwitcher(
|
|
duration: const Duration(milliseconds: 300),
|
|
child: _screens[_currentIndex],
|
|
),
|
|
bottomNavigationBar: NavigationBar(
|
|
selectedIndex: _currentIndex,
|
|
onDestinationSelected: (index) {
|
|
setState(() {
|
|
_currentIndex = index;
|
|
});
|
|
},
|
|
destinations: _destinations,
|
|
),
|
|
);
|
|
}
|
|
}
|