recipe-manager/mobile/lib/features/navigation/main_navigation_shell.dart

66 lines
2 KiB
Dart

import 'package:flutter/material.dart';
import '../../core/constants/app_theme.dart';
import '../library/recipes_screen.dart';
import '../scanner/scanner_screen.dart';
import '../shopping/shopping_lists_screen.dart';
class MainNavigationShell extends StatefulWidget {
const MainNavigationShell({super.key});
@override
State<MainNavigationShell> createState() => _MainNavigationShellState();
}
class _MainNavigationShellState extends State<MainNavigationShell> {
int _currentIndex = 0;
final List<Widget> _screens = const [
RecipesScreen(),
ShoppingListsScreen(),
ScannerScreen(),
];
@override
Widget build(BuildContext context) {
return Scaffold(
body: IndexedStack(
index: _currentIndex,
children: _screens,
),
bottomNavigationBar: Container(
decoration: const BoxDecoration(
border: Border(
top: BorderSide(color: AppTheme.border, width: 1),
),
),
child: NavigationBar(
selectedIndex: _currentIndex,
backgroundColor: AppTheme.surface,
indicatorColor: AppTheme.primary.withOpacity(0.2),
onDestinationSelected: (idx) {
setState(() {
_currentIndex = idx;
});
},
destinations: const [
NavigationDestination(
icon: Icon(Icons.menu_book_outlined),
selectedIcon: Icon(Icons.menu_book, color: AppTheme.primary),
label: 'Cookbook',
),
NavigationDestination(
icon: Icon(Icons.shopping_cart_outlined),
selectedIcon: Icon(Icons.shopping_cart, color: AppTheme.primary),
label: 'Shopping',
),
NavigationDestination(
icon: Icon(Icons.document_scanner_outlined),
selectedIcon: Icon(Icons.document_scanner, color: AppTheme.primary),
label: 'Scanner',
),
],
),
),
);
}
}