import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; import 'package:provider/provider.dart'; class BottomNavigationBarLnt extends StatefulWidget { const BottomNavigationBarLnt({super.key}); @override State createState() => _BottomNavigationBarLntState(); } class _BottomNavigationBarLntState extends State{ int _cuurentIndex = 0; @override Widget build(BuildContext context) { final List chiledList = [Center(child: const Text("dddddsaaaafdajl",style: TextStyle(color: Colors.red),),),const Text("aaa"),const Text("eeee"),const Text("rrrr")]; final List listItem = [ const BottomNavigationBarItem( icon: Icon(Icons.home), label: "Home" ), const BottomNavigationBarItem( icon: Icon(Icons.book), label: "Collection" ), const BottomNavigationBarItem( icon: Icon(Icons.music_video), label: "My" ), const BottomNavigationBarItem( icon: Icon(Icons.movie), label: "Setting" ), ]; return MaterialApp( home: Scaffold( bottomNavigationBar: BottomNavigationBar( items: listItem, // fixedColor: Colors.blue, unselectedItemColor:Colors.grey, selectedItemColor: Colors.orange, type: BottomNavigationBarType.fixed, selectedFontSize: 14, unselectedFontSize: 14, currentIndex: _cuurentIndex, onTap: _onItemTapped, ), body: chiledList[_cuurentIndex], ), ); } void _onItemTapped(int index) { setState(() { _cuurentIndex = index; }); } }