flutter 之BottomNavigationBar属性
参考:jianshu.com/p/22d8974c5e04
https://www.jianshu.com/p/61bb3784c6ad
return Scaffold( backgroundColor: Color(0xfff6f6f6), bottomNavigationBar: BottomNavigationBar( type: BottomNavigationBarType.fixed, onTap: _onTap,
selectedItemColor: Theme.of(context).primaryColor, // 选中的item颜色 unselectedItemColor: Color(0xff666666), // 未选中的item颜色 selectedIconTheme: IconThemeData(color: Colors.blue, size: AppConfig.screenUtil(val: 50, val2: 20)), // 选中的icon样式 unselectedIconTheme: IconThemeData(color: Colors.black, size: AppConfig.screenUtil(val: 50, val2: 20)), // 未选择的icon样式 selectedFontSize: AppConfig.screenUtil(val: 25, val2: 20), // 选择的item文字大小 unselectedFontSize: AppConfig.screenUtil(val: 25, val2: 20), // 未选择的item文字大小 currentIndex: _currentIndex,
//被选择item的颜色 items: <BottomNavigationBarItem>[ BottomNavigationBarItem(title: Text('首页', ), icon: Icon( Icons.home,)), BottomNavigationBarItem(title: Text('全部产品', ), icon: Icon( IconData(0xe7f9, fontFamily: 'iconfont'),)), BottomNavigationBarItem( title: Text('产品分类'), icon: Icon( IconData(0xe7f9, fontFamily: 'iconfont'),)), ], ),
去除点击时产生的水波纹
class MyApp extends StatelessWidget { // This widget is the root of your application. @override Widget build(BuildContext context) { return MaterialApp( title: 'WeChat', theme: ThemeData( primaryColor: Colors.greenAccent, highlightColor: Color.fromRGBO(0, 0, 0, 0), splashColor: Color.fromRGBO(0, 0, 0, 0)), home: RootPage(), ); } }