Flutter BottomNavigationBarItem accepts only Icon and no other widgets? I did notice however, in items: const
And lastly, you need to add a tab builder to CupertinoTabScaffold this basically returns what’s displayed above the bottom navigation bar.
Your final code then looks like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | return CupertinoTabScaffold( tabBuilder: (BuildContext context, int i) { return CupertinoActivityIndicator(); }, tabBar: CupertinoTabBar( items: <BottomNavigationBarItem>[ BottomNavigationBarItem( icon: Badge( badgeContent: Text('3'), child: Icon(Icons.settings), ), title: Text('Kühlschrank'), ), BottomNavigationBarItem( icon: Icon(CupertinoIcons.profile_circled), title: Text('Konto'), ), BottomNavigationBarItem( icon: Icon(CupertinoIcons.shopping_cart), title: Text('Warenkorb'), ), ], ), ); |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.