简体   繁体   English

Flutter 的 Cupertino 标签栏小部件中没有标题的图标按钮

[英]Icon Buttons without Titles in Flutter's Cupertino Tab bar Widget

Would anyone be in a position to know how to make Cupertino Bottom tab bar views with icon buttons only and NO titles in Flutter?有没有人知道如何在 Flutter 中制作只有图标按钮且没有标题的 Cupertino 底部标签栏视图? Like the way the Facebook and Twitter bottom bar apps on iOS are they only have icons no title below the icons in the bottom bar.就像 iOS 上的 Facebook 和 Twitter 底部栏应用程序一样,它们只有在底部栏中的图标下方没有标题的图标。 In flutter using Cupertino Tab bar we are forced to always put a title in the BottomNavigationBar items.在使用 Cupertino Tab bar 的 flutter 中,我们被迫总是在 BottomNavigationBar 项目中放置一个标题。 Is there a work around to only have icons/icon buttons without titles?是否有一种解决方法,即只有没有标题的图标/图标按钮?

Sorry I'm on mobile.对不起,我在移动。 You can do like this.你可以这样做。

BottomNavigationBarItem(
     icon: Icon(Icons.home),
     title: Container(),
)

Here is a complete example of how you can do this这是一个完整的示例,说明如何执行此操作

  bottomNavigationBar: CupertinoTabBar(
    currentIndex: _page,
    items: <BottomNavigationBarItem> [
      BottomNavigationBarItem(
          icon: Icon(Icons.people_outline, size: 30, color: Colors.grey),
          activeIcon: Icon(Icons.people_outline, color: appThemeColor, size: 30)),
      BottomNavigationBarItem(
          icon: Icon(Icons.local_car_wash, size: 30, color: Colors.grey),
          activeIcon: Icon(Icons.local_car_wash, color: appThemeColor, size: 30)),
      BottomNavigationBarItem(
          icon: Icon(Icons.mail_outline, size: 30, color: Colors.grey),
          activeIcon: Icon(Icons.mail_outline, color: appThemeColor, size: 30))
    ],
    onTap: onTabTapped,
    backgroundColor: Colors.white,
  )

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM