Search code examples
flutterdartbottomnavigationview

I want to make my bottomNavBar transparent


I want to make my Bottom Nav Bar transparent, I have tried opacity with color property but it is not working. Just so you can have an idea im attaching a screenshot for better understanding

screenshot

kindly ignore the buttons on the nav bar, I just want the transparency, my code is following

return Scaffold(
  body: Column(
    .......
  bottomNavigationBar: Container(
    color: Colors.white,
    padding: EdgeInsets.all(20),
    child: Text(
      'SUIVANT',
      textAlign: TextAlign.center,
      style: TextStyle(
          fontFamily: 'Karla', fontSize: 20, fontWeight: FontWeight.bold),
    ),
  ),
);

Any help would be greatly appreciated. Thnx in advance.


Solution

  • Finally after a lot of thinking and applying odd ways I was able to do it in a very different way. I had to finish BottomNavigationBar: property since it doesnot allow to be modified. I had to wrap the main Column in Stack() widget

    return Scaffold(
      body: Stack(
        children: <Widget>[
          Column(
            children: <Widget>[
              //.......
              /*this is the Container() I had to add in stack after finishing the bottomnavbar*/
              Container(
                height: MediaQuery.of(context).size.height,
                child: Column(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  children: <Widget>[
                    Container(),
                    Container(
                      color: Colors.white.withOpacity(0.9),
                      width: MediaQuery.of(context).size.width,
                      padding: EdgeInsets.all(20),
                      child: Text(
                        'SUIVANT',
                        textAlign: TextAlign.center,
                        style: TextStyle(
                            fontFamily: 'Karla',
                            fontSize: 20,
                            fontWeight: FontWeight.bold),
                      ),
                    ),
                  ],
                ),
              ),
            ],
          ),
        ],
      ),
    );
    

    I don't know if it is a bad approach or the right one but I couldn't find a solution other than this after a lot of thought process. Do feel free to modify it according to the flutter rules if there are mistakes. Thanks everyone for contributing.

    This is how the result looks