Navbar Anpassen #9

Merged
gelbeinhalb merged 11 commits from enhancement/8-tabbar-angleichen into development 2025-11-09 19:59:56 +00:00
Showing only changes of commit 0895f6df0a - Show all commits

View File

@@ -63,40 +63,45 @@ class _CustomNavigationBarState extends State<CustomNavigationBar>
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
IconButton(
icon: Icon(
Icons.home,
color: currentIndex == 0 ? Colors.white : Colors.black,
),
onPressed: () => onTabTapped(0),
),
IconButton(
icon: Icon(
Icons.history,
color: currentIndex == 1 ? Colors.white : Colors.black,
),
onPressed: () => onTabTapped(1),
),
IconButton(
icon: Icon(
Icons.groups,
color: currentIndex == 2 ? Colors.white : Colors.black,
),
onPressed: () => onTabTapped(2),
),
IconButton(
icon: Icon(
Icons.bar_chart,
color: currentIndex == 3 ? Colors.white : Colors.black,
),
onPressed: () => onTabTapped(3),
),
const SizedBox(width: 0),
_buildNavItem(Icons.home, 'Home', 0),
_buildNavItem(Icons.history, 'History', 1),
_buildNavItem(Icons.groups, 'Groups', 2),
_buildNavItem(Icons.bar_chart, 'Stats', 3),
const SizedBox(width: 0),
],
),
),
);
}
Widget _buildNavItem(IconData icon, String label, int index) {
final isSelected = currentIndex == index;
return GestureDetector(
onTap: () => onTabTapped(index),
flixcoo marked this conversation as resolved Outdated

Ich würde das Widget entweder Auslagern (als nav_item.dart im widgets Ordner) oder das Expanded Widget direkt in die Row setzen (nicht so geil). Wenn du das Auslagerst sparst du dir ganz viel Code hier und übergibst die Parameter einfach direkt in das Widget.

Ich würde das Widget entweder Auslagern (als `nav_item.dart` im `widgets` Ordner) oder das `Expanded` Widget direkt in die Row setzen (nicht so geil). Wenn du das Auslagerst sparst du dir ganz viel Code hier und übergibst die Parameter einfach direkt in das Widget.

Ja stimmt.
Ich lager das dann aus.

Ja stimmt. Ich lager das dann aus.
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
gelbeinhalb marked this conversation as resolved Outdated

Chat GPT kommentare?

Chat GPT kommentare?
children: [
Icon(
icon,
color: isSelected ? Colors.white : Colors.black,
),
const SizedBox(height: 4),
Text(
label,
style: TextStyle(
color: isSelected ? Colors.white : Colors.black,
fontSize: 12,
fontWeight: isSelected ? FontWeight.bold : FontWeight.normal,
),
),
],
),
);
}
void onTabTapped(int index) {
setState(() {
currentIndex = index;