60 lines
1.6 KiB
Dart
60 lines
1.6 KiB
Dart
import 'package:flutter/material.dart';
|
|||
|
|
import 'features/calendar/calendar_screen.dart';
|
||
|
|
import 'features/insights/insights_screen.dart';
|
||
|
|
import 'features/log_mood/log_mood_screen.dart';
|
||
|
|
import 'features/settings/settings_screen.dart';
|
||
|
|
|
||
|
|
class AppShell extends StatefulWidget {
|
||
|
|
const AppShell({super.key});
|
||
|
|
|
||
|
|
@override
|
||
|
|
State<AppShell> createState() => _AppShellState();
|
||
|
|
}
|
||
|
|
|
||
|
|
class _AppShellState extends State<AppShell> {
|
||
|
|
int _index = 0;
|
||
|
|
|
||
|
|
static const _screens = [
|
||
|
|
LogMoodScreen(),
|
||
|
|
CalendarScreen(),
|
||
|
|
InsightsScreen(),
|
||
|
|
SettingsScreen(),
|
||
|
|
];
|
||
|
|
|
||
|
|
@override
|
||
|
|
Widget build(BuildContext context) {
|
||
|
|
return Scaffold(
|
||
|
|
body: IndexedStack(
|
||
|
|
index: _index,
|
||
|
|
children: _screens,
|
||
|
|
),
|
||
|
|
bottomNavigationBar: NavigationBar(
|
||
|
|
selectedIndex: _index,
|
||
|
|
onDestinationSelected: (i) => setState(() => _index = i),
|
||
|
|
destinations: const [
|
||
|
|
NavigationDestination(
|
||
|
|
icon: Icon(Icons.mood_outlined),
|
||
|
|
selectedIcon: Icon(Icons.mood),
|
||
|
|
label: 'Today',
|
||
|
|
),
|
||
|
|
NavigationDestination(
|
||
|
|
icon: Icon(Icons.calendar_month_outlined),
|
||
|
|
selectedIcon: Icon(Icons.calendar_month),
|
||
|
|
label: 'History',
|
||
|
|
),
|
||
|
|
NavigationDestination(
|
||
|
|
icon: Icon(Icons.auto_awesome_outlined),
|
||
|
|
selectedIcon: Icon(Icons.auto_awesome),
|
||
|
|
label: 'Insights',
|
||
|
|
),
|
||
|
|
NavigationDestination(
|
||
|
|
icon: Icon(Icons.settings_outlined),
|
||
|
|
selectedIcon: Icon(Icons.settings),
|
||
|
|
label: 'Settings',
|
||
|
|
),
|
||
|
|
],
|
||
|
|
),
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|