mt-akar / bottom_nav_layout

A quick and powerful Flutter layout with a bottom navbar.
https://pub.dev/packages/bottom_nav_layout
MIT License
35 stars 11 forks source link

Is it possible to incorporate a FAB using this package? #6

Closed nazrinharris closed 3 years ago

nazrinharris commented 3 years ago

As of now, I couldn't find any way to do this directly from scaffold. I'll try doing it with Stack and all but I'd like to know if there is an easier way to do so.

mt-akar commented 3 years ago

This seems a weird question to me. If you know how to create a FAB, it is not much different with or without this package.

I assume that you think the BottomNavigationView and FloatingActionButton should be in the same scaffold. However, it doesn't have to be. You can add your own scaffold to a page.

Example code:

pages: [
  (_) => Scaffold(
      floatingActionButton: FloatingActionButton(
        onPressed: () {},
      ),
      body: Center(child: Text("Welcome to bottom_nav_layout"))),
  (_) => SliderPage(),
  (_) => Center(
        child: TextField(decoration: InputDecoration(hintText: 'Go..')),
      ),
],
nazrinharris commented 3 years ago

I see, somehow I didn't think of doing like that.

Your assumption was correct, I did think that it needs to be in the same scaffold.

Now, I'm doing it a bit differently, by using a stack and putting the fab on top of the whole view. It works fine for now but thanks for helping me (✿◡‿◡)

mt-akar commented 2 years ago

For what you are trying to achieve, the stack approach seems inappropriate to me. I would advise against it. It would still work but you do not need a stack for a FAB.

But still, I do not know the context of your situation. Might be good.