61 lines
1.6 KiB
Dart
61 lines
1.6 KiB
Dart
// screens/home_screen.dart
|
|
// Enthält die BottomNavigationBar-Logik und Navigation zwischen den Hauptscreens
|
|
import 'package:flutter/material.dart';
|
|
import 'home_tab.dart';
|
|
import 'search_tab.dart';
|
|
import 'favorites_tab.dart';
|
|
import 'calendar_tab.dart';
|
|
import 'profile_tab.dart';
|
|
|
|
class HomeScreen extends StatefulWidget {
|
|
const HomeScreen({super.key});
|
|
|
|
@override
|
|
State<HomeScreen> createState() => _HomeScreenState();
|
|
}
|
|
|
|
class _HomeScreenState extends State<HomeScreen> {
|
|
int _selectedIndex = 0;
|
|
|
|
final List<Widget> _screens = const [
|
|
HomeTab(),
|
|
SearchTab(),
|
|
FavoritesTab(),
|
|
CalendarTab(),
|
|
ProfileTab(),
|
|
];
|
|
|
|
void _onItemTapped(int index) {
|
|
setState(() {
|
|
_selectedIndex = index;
|
|
});
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
body: _screens[_selectedIndex],
|
|
bottomNavigationBar: BottomNavigationBar(
|
|
type: BottomNavigationBarType.fixed,
|
|
currentIndex: _selectedIndex,
|
|
onTap: _onItemTapped,
|
|
items: const [
|
|
BottomNavigationBarItem(icon: Icon(Icons.home), label: 'Home'),
|
|
BottomNavigationBarItem(icon: Icon(Icons.search), label: 'Suche'),
|
|
BottomNavigationBarItem(
|
|
icon: Icon(Icons.favorite_border),
|
|
label: 'Favoriten',
|
|
),
|
|
BottomNavigationBarItem(
|
|
icon: Icon(Icons.calendar_today),
|
|
label: 'Kalender',
|
|
),
|
|
BottomNavigationBarItem(
|
|
icon: Icon(Icons.person_outline),
|
|
label: 'Profil',
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
} |