Reputation: 59
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(_pages[_selectedPageIndex]['title']),
),
drawer: MainDrawer(),
body: _pages[_selectedPageIndex]['page'],
bottomNavigationBar: BottomNavigationBar(
onTap: _selectPage,
backgroundColor: Theme.of(context).primaryColor,
unselectedItemColor: Colors.white,
selectedItemColor: Theme.of(context).accentColor,
currentIndex: _selectedPageIndex,
// type: BottomNavigationBarType.fixed,
items: [
BottomNavigationBarItem(
backgroundColor: Theme.of(context).primaryColor,
icon: Icon(Icons.category),
title: Text('Categories'),
),
BottomNavigationBarItem(
backgroundColor: Theme.of(context).primaryColor,
icon: Icon(Icons.star),
title: Text('Favorites'),
),
I'm just learning Flutter and I got such an error in
[(title: Text('Categories')& title: Text('Favorites')]
but I entered the same commands as the video I watched, what should I do?
Upvotes: 1
Views: 1758
Reputation: 676
Seems like an old video, title
is now deprecated, use label
property instead, and just give it a String property, ex: 'Categories', 'Favorites', ...
https://docs.flutter.dev/release/breaking-changes/bottom-navigation-title-to-label
Upvotes: 3