I've been trying to build a bottom navigation bar when I came across this error. Here's the code
import 'package:flutter/material.dart';
class NavPage extends StatefulWidget {
const NavPage({Key? key}) : super(key: key);
@override
State<NavPage> createState() => _NavPageState();
}
class _NavPageState extends State<NavPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
bottomNavigationBar: BottomNavigationBar(
items: [
BottomNavigationBarItem(icon: Icons(Icons.local_movies),
activeIcon: const Icon(Icons.local_movies),
label: 'Movies'
),
],
),
);
}
}
CodePudding user response:
You are doing a typing mistake here use Icon()
to get the constructor.
BottomNavigationBarItem(icon: Icon(Icons.local_movies),
CodePudding user response:
change it to:
BottomNavigationBarItem(icon: Icon(Icons.local_movies),