Navbar Anpassen #9
@@ -82,8 +82,12 @@ class _CustomNavigationBarState extends State<CustomNavigationBar>
|
|||||||
Widget _buildNavItem(IconData icon, String label, int index) {
|
Widget _buildNavItem(IconData icon, String label, int index) {
|
||||||
|
flixcoo marked this conversation as resolved
Outdated
|
|||||||
final isSelected = currentIndex == index;
|
final isSelected = currentIndex == index;
|
||||||
|
|
||||||
return GestureDetector(
|
return Expanded( // makes each nav item occupy equal width = large horizontal hitbox
|
||||||
|
gelbeinhalb marked this conversation as resolved
Outdated
flixcoo
commented
Chat GPT kommentare? Chat GPT kommentare?
|
|||||||
|
child: GestureDetector(
|
||||||
onTap: () => onTabTapped(index),
|
onTap: () => onTabTapped(index),
|
||||||
|
behavior: HitTestBehavior.opaque, // ensures the entire area is tappable
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 5.0), // adds comfortable tap height
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
@@ -103,8 +107,10 @@ class _CustomNavigationBarState extends State<CustomNavigationBar>
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void onTabTapped(int index) {
|
void onTabTapped(int index) {
|
||||||
setState(() {
|
setState(() {
|
||||||
|
|||||||
Reference in New Issue
Block a user
Ich würde das Widget entweder Auslagern (als
nav_item.dartimwidgetsOrdner) oder dasExpandedWidget 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.