将图标放在底部导航栏中

时间:2020-07-28 04:18:42

标签: flutter-bottomnavigation

如您所见,由于我使用的是其他图标包,因此第二个图标的位置要比其他图标高一些。有什么方法可以在第二个图标的顶部添加空间,以便可以对齐所有内容?

class RealEstateApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(
        primaryColor: Colors.blueAccent,
        fontFamily: 'Daum',
        accentColor: Colors.blue[900],
      ),
      home: MainPage(),
    );
  }
}

class MainPage extends StatefulWidget {
  @override
  _MainPageState createState() => _MainPageState();
}

class _MainPageState extends State<MainPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      bottomNavigationBar: BottomNavigationBar(
          currentIndex: 0,
          type: BottomNavigationBarType.fixed,
          items: [
            BottomNavigationBarItem(
              icon: Icon(Icons.remove_red_eye),
              title: Text('CubeNow')
            ),
            BottomNavigationBarItem(
              icon: Icon(FontAwesomeIcons.cube, size: 18.0),
              title: Text('Home',
              style: TextStyle(
                height: 1.6),
                ),
            ),
            BottomNavigationBarItem(
              icon: Icon(Icons.home),
              title: Text('Home')
            ),
            BottomNavigationBarItem(
              icon: Icon(Icons.home),
              title: Text('Home')
            ),
            BottomNavigationBarItem(
              icon: Icon(Icons.home),
              title: Text('Home')
        ),
      ]
      ),
    );
  }
}

enter image description here

0 个答案:

没有答案