class BottomNavScreen extends StatefulWidget {
@override _BottomNavScreenState createState() => _BottomNavScreenState();
}
class _BottomNavScreenState extends State<BottomNavScreen> {
final List _screens = [
CurryHomeScreen(),
HiStoryScreen(),
ShtrafScreen(),
SecurityPage(),
Profile(),
];
int _currentIndex = 0;
@override Widget build(BuildContext context) {
return Scaffold(
body: _screens[_currentIndex],
bottomNavigationBar: BottomNavigationBar(
currentIndex: _currentIndex,
onTap: (index) => setState(() => _currentIndex = index),
type: BottomNavigationBarType.fixed,
backgroundColor: Colors.white,
showSelectedLabels: false,
showUnselectedLabels: false,
selectedItemColor: Hexcolor('#2447BA'),
unselectedItemColor: Colors.grey,
elevation: 0.0,
items: [
//Icon(FlatIcons.home),
IconData(0xe900, fontFamily: 'MyFont'),
IconData(0xe901, fontFamily: 'MyFont'),
IconData(0xe904, fontFamily: 'MyFont',),
IconData(0xe902, fontFamily: 'MyFont'),
IconData(0xe903, fontFamily: 'MyFont'),
]
.asMap()
.map((key, value) => MapEntry(
key,
// ignore: missing_required_param
BottomNavigationBarItem(
title: Text(''),
icon:Container(
padding: const EdgeInsets.symmetric(
vertical: 6.0,
horizontal: 16.0,
),
decoration: BoxDecoration(
color: _currentIndex == key && _currentIndex != 2
? Colors.white
: Colors.transparent,
borderRadius: BorderRadius.circular(30.0),
),
child: key == 2 ?
Container(
height: 45.0,
width: 60.0,
padding: const EdgeInsets.symmetric(
//vertical: 20.0,
horizontal:7.0,
),
decoration: BoxDecoration(
//Rshape: BoxShape.rectangle,
gradient: LinearGradient(
begin: Alignment.bottomCenter,
end: Alignment.topCenter,
colors: [ Hexcolor('#2447BA'),Hexcolor('#1580CA'),]
),
borderRadius: BorderRadius.circular(200.0),
),
child:
Icon(
value,size: 22.0,
color: Colors.white,
),
) : Icon(value),
),
),
))
.values
.toList(),
),
);
}
}