1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Flutter] how to hide Bottom Navigation Bar on new screen in flutter?

Discussão em 'Mobile' iniciado por Stack, Outubro 1, 2024 às 11:04.

  1. Stack

    Stack Membro Participativo

    Just like here when I click on the timer, the Bottom navigation bar was disappeared. I want to implement the same thing on flutter. Whenever I click on Bottom Navigation Bar Item, for the new screen the Bottom Navigation Bar should not appear.

    [​IMG]

    Here is my code. My Bottom Navigation Bar has four items and I want to hide the bottom navigation bar when I route to a new screen.

    class MyFeedScreen extends StatefulWidget {
    @override
    _MyFeedScreenState createState() => _MyFeedScreenState();
    }

    class _MyFeedScreenState extends State<MyFeedScreen> {
    int _bottomNavIndex = 0;

    Widget pageCaller(int index) {
    switch (index) {
    case 0:
    {
    return Category();
    }
    case 1:
    {
    return Feed();
    }
    case 3:
    {
    return Settings();
    }
    }
    }

    @override
    Widget build(BuildContext context) {
    SizeConfig().init(context);
    return Scaffold(
    body: pageCaller(_bottomNavIndex),
    bottomNavigationBar: BottomNavigationBar(
    backgroundColor: klogoBlue,
    selectedItemColor: Color(0xfff5f5f5),
    unselectedItemColor: Color(0xfff5f5f5),
    selectedFontSize: 12.0,
    type: BottomNavigationBarType.fixed,
    currentIndex: _bottomNavIndex,
    onTap: (index) {
    setState(() {
    _bottomNavIndex = index;
    });
    },
    items: [
    BottomNavigationBarItem(
    icon: Padding(
    padding:
    EdgeInsets.only(top: SizeConfig.blockSizeVertical * 0.60),
    child: Icon(Icons.category),
    ),
    title: Padding(
    padding: EdgeInsets.symmetric(
    vertical: SizeConfig.blockSizeVertical * 0.60),
    child: Text('Category'),
    ),
    ),
    BottomNavigationBarItem(
    icon: Padding(
    padding:
    EdgeInsets.only(top: SizeConfig.blockSizeVertical * 0.60),
    child: Icon(FontAwesomeIcons.newspaper),
    ),
    title: Padding(
    padding: EdgeInsets.symmetric(
    vertical: SizeConfig.blockSizeVertical * 0.60),
    child: Text('My Feed'),
    ),
    ),
    BottomNavigationBarItem(
    icon: Padding(
    padding:
    EdgeInsets.only(top: SizeConfig.blockSizeVertical * 0.60),
    child: Icon(Icons.refresh),
    ),
    title: Padding(
    padding: EdgeInsets.symmetric(
    vertical: SizeConfig.blockSizeVertical * 0.60),
    child: Text('Refresh'),
    ),
    ),
    BottomNavigationBarItem(
    icon: Padding(
    padding:
    EdgeInsets.only(top: SizeConfig.blockSizeVertical * 0.60),
    child: Icon(Icons.settings),
    ),
    title: Padding(
    padding: EdgeInsets.symmetric(
    vertical: SizeConfig.blockSizeVertical * 0.60),
    child: Text('Settings'),
    ),
    ),
    ],
    ),
    );
    }
    }

    Continue reading...

Compartilhe esta Página