85 lines
2.2 KiB
Dart
85 lines
2.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'contact_screen.dart';
|
|
import 'info_screen.dart';
|
|
import 'post_list_screen.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> _pages = const [
|
|
PostListScreen(
|
|
collectionName: 'News',
|
|
title: 'Bürgerforum Aktuelles',
|
|
),
|
|
PostListScreen(
|
|
collectionName: 'Issues',
|
|
title: 'Mängel & Anliegen',
|
|
),
|
|
PostListScreen(
|
|
collectionName: 'CitizensForum',
|
|
title: 'Ideen für Oggau',
|
|
),
|
|
ContactScreen(),
|
|
InfoScreen(),
|
|
];
|
|
|
|
void _onItemTapped(int index) {
|
|
setState(() {
|
|
_selectedIndex = index;
|
|
});
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
body: IndexedStack(
|
|
index: _selectedIndex,
|
|
children: _pages,
|
|
),
|
|
bottomNavigationBar: BottomNavigationBar(
|
|
type: BottomNavigationBarType.fixed,
|
|
selectedItemColor: Colors.blue.shade800,
|
|
unselectedItemColor: Colors.grey.shade600,
|
|
selectedFontSize: 11,
|
|
unselectedFontSize: 11,
|
|
currentIndex: _selectedIndex,
|
|
onTap: _onItemTapped,
|
|
items: const [
|
|
BottomNavigationBarItem(
|
|
icon: Icon(Icons.newspaper_outlined),
|
|
activeIcon: Icon(Icons.newspaper),
|
|
label: 'Nachrichten',
|
|
),
|
|
BottomNavigationBarItem(
|
|
icon: Icon(Icons.report_problem_outlined),
|
|
activeIcon: Icon(Icons.report_problem),
|
|
label: 'Mängel',
|
|
),
|
|
BottomNavigationBarItem(
|
|
icon: Icon(Icons.lightbulb_outline),
|
|
activeIcon: Icon(Icons.lightbulb),
|
|
label: 'Ideen',
|
|
),
|
|
BottomNavigationBarItem(
|
|
icon: Icon(Icons.mail_outline),
|
|
activeIcon: Icon(Icons.mail),
|
|
label: 'Kontakt',
|
|
),
|
|
BottomNavigationBarItem(
|
|
icon: Icon(Icons.info_outline),
|
|
activeIcon: Icon(Icons.info),
|
|
label: 'Bürgerforum',
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|