creating bottom navigation bar in flutter

 import 'package:flutter/material.dart';

import 'package:techrype/account.dart';
import 'package:techrype/jiocinema.dart';
import 'package:techrype/search_box.dart';

import 'camera.dart';

class NavigationBaar extends StatefulWidget {
const NavigationBaar({Key? key}) : super(key: key);

@override
State<NavigationBaar> createState() => _NavigationBaarState();
}

int _currentIndex = 0;
final _tabs = [
JioCinema(),
const SearchBox(),
const Camera(),
const loginPage(),
];

class _NavigationBaarState extends State<NavigationBaar> {
@override
Widget build(BuildContext context) {
return Scaffold(
body:_tabs[_currentIndex],
bottomNavigationBar: BottomNavigationBar(
type: BottomNavigationBarType.fixed,
//backgroundColor: Colors.white,
selectedFontSize: 16,
unselectedFontSize: 14,
iconSize: 29,

currentIndex: _currentIndex,
items: const [
BottomNavigationBarItem(
icon: Icon(Icons.home),
label: "Home",
// backgroundColor: Colors.deepPurpleAccent,
),
BottomNavigationBarItem(
icon: Icon(Icons.search),
label: "Search",
// backgroundColor: Colors.deepPurpleAccent
),
BottomNavigationBarItem(
icon: Icon(Icons.camera_alt),
label: "Camera",
//backgroundColor: Colors.deepPurpleAccent
),
BottomNavigationBarItem(
icon: Icon(Icons.account_circle_outlined),
label: "Account",
//backgroundColor: Colors.deepPurpleAccent
)
],
onTap: (index){
setState(() {
_currentIndex = index;
});
},
),
);
}
}

Comments

Popular posts from this blog

swapping the alternate values in given array's element ! 17/11/2022

Learning stage | c++ programs

c++ basic question