hacktons / convex_bottom_bar

A Flutter package which implements a ConvexAppBar to show a convex tab in the bottom bar. Theming supported.
https://bar.hacktons.cn
Apache License 2.0
791 stars 147 forks source link

How can I add IconButton to TabItem #204

Closed sedsax closed 9 months ago

sedsax commented 11 months ago

Previously, the notification icon was in the appbar. There I wrapped the iconButton with Badge and Obx and I could see the number of notifications received. Now I added the notification to the bottomnavbar and the notification numbers are not visible. TabItem(icon: Icons.add, title: "Notification"). I tried to add the same Badge and spiral structure into the TabItem here, but it didn't work.

sedsax commented 10 months ago

Okay I found, I should have examined the document better. Thank you

ConvexAppBar _homeBottomNavigation(BuildContext context) { return ConvexAppBar.badge( { 4: '7', // add badge(7) to 4. tab }, items: const [ TabItem(icon: Icons.home, title: "A"), TabItem(icon: Icons.people, title: "S"), TabItem(icon: Icons.add, title: "Y"), TabItem(icon: Icons.business_center, title: "C"), TabItem(icon: Icons.notifications, title: "B"), ], onTap: (index) { null, }, ); }