Style BottomNavigationBar in Flutter
Estoy probando Flutter y estoy tratando de cambiar el color delBottomNavigationBar
en la aplicación, pero todo lo que pude lograr fue cambiar el color delBottomNavigationItem
(icono y texto).
Aquí es donde declaro miBottomNavigationBar
:
class _BottomNavigationState extends State<BottomNavigationHolder>{
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: null,
body: pages(),
bottomNavigationBar:new BottomNavigationBar(
items: <BottomNavigationBarItem>[
new BottomNavigationBarItem(
icon: const Icon(Icons.home),
title: new Text("Home")
),
new BottomNavigationBarItem(
icon: const Icon(Icons.work),
title: new Text("Self Help")
),
new BottomNavigationBarItem(
icon: const Icon(Icons.face),
title: new Text("Profile")
)
],
currentIndex: index,
onTap: (int i){setState((){index = i;});},
fixedColor: Colors.white,
),
);
}
Anteriormente pensé que lo tenía resuelto editandocanvasColor
en verde en el tema principal de mi aplicación, pero estropeó todo el esquema de color de la aplicación:
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return new MaterialApp(
title: 'Flutter Demo',
theme: new ThemeData(
primarySwatch: Colors.blue,
canvasColor: Colors.green
),
home: new FirstScreen(),
);
}
}