feat: add bottom navigation shell with four tabs
Introduces AppShell with an IndexedStack-backed NavigationBar (Today, History, Insights, Settings). Stub screens added for Calendar, Insights, and Settings; app.dart now routes to AppShell instead of LogMoodScreen directly.
This commit is contained in:
+3
-3
@@ -1,7 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'core/providers/settings_provider.dart';
|
import 'core/providers/settings_provider.dart';
|
||||||
import 'features/log_mood/log_mood_screen.dart';
|
import 'shell.dart';
|
||||||
|
|
||||||
class App extends ConsumerWidget {
|
class App extends ConsumerWidget {
|
||||||
const App({super.key});
|
const App({super.key});
|
||||||
@@ -17,11 +17,11 @@ class App extends ConsumerWidget {
|
|||||||
darkTheme: _darkTheme(),
|
darkTheme: _darkTheme(),
|
||||||
themeMode: ThemeMode.system,
|
themeMode: ThemeMode.system,
|
||||||
home: onboardingAsync.when(
|
home: onboardingAsync.when(
|
||||||
data: (complete) => const LogMoodScreen(),
|
data: (complete) => const AppShell(),
|
||||||
loading: () => const Scaffold(
|
loading: () => const Scaffold(
|
||||||
body: Center(child: CircularProgressIndicator()),
|
body: Center(child: CircularProgressIndicator()),
|
||||||
),
|
),
|
||||||
error: (e, _) => const LogMoodScreen(),
|
error: (e, _) => const AppShell(),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class CalendarScreen extends StatelessWidget {
|
||||||
|
const CalendarScreen({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return const Scaffold(
|
||||||
|
body: Center(child: Text('History coming soon')),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class InsightsScreen extends StatelessWidget {
|
||||||
|
const InsightsScreen({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return const Scaffold(
|
||||||
|
body: Center(child: Text('Insights coming soon')),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class SettingsScreen extends StatelessWidget {
|
||||||
|
const SettingsScreen({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return const Scaffold(
|
||||||
|
body: Center(child: Text('Settings coming soon')),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
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',
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user