'The named parameter 'title' isn't defined.Try correcting the name with the name 'title'.dart
@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?
Solution 1:[1]
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
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Abdallah Abdel Aziz |
