Refactor architecture, fix all linter issues, and implement specification features (5 tabs, issue dropdowns, contact, info, search, pdf)
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
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: 'Nachrichten & Aktuelles',
|
||||
),
|
||||
PostListScreen(
|
||||
collectionName: 'Issues',
|
||||
title: 'Mängel & Bürgeranliegen',
|
||||
),
|
||||
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: 'Informationen',
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user