Site icon Mobile App Development Services

Basics and Implementation of BottomNavigationBar Widget in Flutter

Basics and Implementation of BottomNavigationBar Widget in Flutter

In our last blog, we talk about what Flutter is and why there is so much talk about it. We also talked about how to set up and start working with it. In this blog, we will be discussing the basics of Flutter and we will see the implementation of a Material Widget.

Reader: Finally some action in the blog, hopefully, less talk this time.

Me: You started again! Don’t make me lose my tempo, by Interrupting me.

Reader: Okiii!!

We’ll start by creating a new project.

So here we have created a new project with ‘flutter create’ command. This will result in a started project which Flutter team was generous enough to make for us. It will look something like this.

Lets jump into the code now,

Let’s talk about first section,

Reader: Are you going to code something or just talk about already written code?

Me (Sarcastically):  Talk! Why code when its already done.

Me: I will code, i mean copy paste from somewhere don’t worry.

Let’s remove the MyHomePage widget code and write our own to implement a bottom navigation bar.

Let’s jump into this section,

Reader: Hey!, wait a second I recognize this code.

Reader: You copy pasted this code from Flutter widget docs….

Me (stammering): Uh, umm, err…

Me: So what, why would i reinvent the wheel. I tempered it a little.

Reader: Ohh! Come on….

Me: Hey you! Susssh! Let me complete.

Now we will add some widgets to our widgets array.

Me (proudly): Look I changed the names of components because that’s all I needed.

Reader (sarcastically): OMG! such a professional work.

Me (with a smirk): Always complaining..!

We just added some Text Widgets to demonstrate how the change is happening. In a real application, these will be more complex widgets or widget trees.

Peace out..!