flutter tab bar bottom bar

int _selectedIndex = 0;
static const TextStyle optionStyle = TextStyle(fontSize: 30, fontWeight: FontWeight.bold);
static const List<Widget> _widgetOptions = <Widget>[
  Text(
    'Index 0: Home',
    style: optionStyle,
  ),
  Text(
    'Index 1: Business',
    style: optionStyle,
  ),
  Text(
    'Index 2: School',
    style: optionStyle,
  ),
  Text(
    'Index 3: Settings',
    style: optionStyle,
  ),
];

void _onItemTapped(int index) {
  setState(() {
    _selectedIndex = index;
  });
}

@override
Widget build(BuildContext context) {
  return Scaffold(
    appBar: AppBar(
      title: const Text('BottomNavigationBar Sample'),
    ),
    body: Center(
      child: _widgetOptions.elementAt(_selectedIndex),
    ),
    bottomNavigationBar: BottomNavigationBar(
      items: const <BottomNavigationBarItem>[
        BottomNavigationBarItem(
          icon: Icon(Icons.home),
          label: 'Home',
          backgroundColor: Colors.red,
        ),
        BottomNavigationBarItem(
          icon: Icon(Icons.business),
          label: 'Business',
          backgroundColor: Colors.green,
        ),
        BottomNavigationBarItem(
          icon: Icon(Icons.school),
          label: 'School',
          backgroundColor: Colors.purple,
        ),
        BottomNavigationBarItem(
          icon: Icon(Icons.settings),
          label: 'Settings',
          backgroundColor: Colors.pink,
        ),
      ],
      currentIndex: _selectedIndex,
      selectedItemColor: Colors.amber[800],
      onTap: _onItemTapped,
    ),
  );
}

0
5
Awgiedawgie 440220 points

                                    int _selectedIndex = 0;
static const TextStyle optionStyle = TextStyle(fontSize: 30, fontWeight: FontWeight.bold);
static const List&lt;Widget&gt; _widgetOptions = &lt;Widget&gt;[
  Text(
    'Index 0: Home',
    style: optionStyle,
  ),
  Text(
     'Index 1: Business',
     style: optionStyle,
  ),
  Text(
     'Index 2: School',
     style: optionStyle,
  ),
];

void _onItemTapped(int index) {
  setState(() {
    _selectedIndex = index;
  });
}

@override
Widget build(BuildContext context) {
  return Scaffold(
    appBar: AppBar(
      title: const Text('BottomNavigationBar Sample'),
    ),
    body: Center(
      child: _widgetOptions.elementAt(_selectedIndex),
    ),
    bottomNavigationBar: BottomNavigationBar(
      items: const &lt;BottomNavigationBarItem&gt;[
        BottomNavigationBarItem(
          icon: Icon(Icons.home),
          label: 'Home',
        ),
        BottomNavigationBarItem(
          icon: Icon(Icons.business),
          label: 'Business',
        ),
        BottomNavigationBarItem(
          icon: Icon(Icons.school),
          label: 'School',
        ),
      ],
      currentIndex: _selectedIndex,
      selectedItemColor: Colors.amber[800],
      onTap: _onItemTapped,
    ),
  );
}

0
0
Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
tabbar design in flutter bottomnavigationbar flutter bottom navigation bar tabs best tab bar for flutter use tabs bar in flutter flutter bottom TabBarView flutter tabbar bottom tabs flutter tabs on bottom Bottom tabbar in flutter example bottom tabs flutter flutter bottom tab bar stylish how to use tab bars in flutter top tab bar bottom indicator in flutter top tab bar in flutter tab bar in top with Indicator in flutter tab bar in top in flutter bottem tab bar flutter TabBar and bottom Navigation bar in flutter bottom tabbar in flutter flutter tab bar at bottom add indicator on bottom tab bar in fluttewr how to set tab bar indicator in bottom tab bar in flutter flutter bottom tab and top tab bar navigation issue flutter appbar bottom tab flutter appbar bottom tabbar exam how to apply bottom tabbar in flutter tabbar bottom line flutter sliverappbar with tab bar on bottom flutter bottom tab bar with different pages flutter flutter tab bar header flutter appbar bottom tabbar how to add indicater in bottom tab bar in flutter bottom tab navigator flutter flutter bottom appbar tab controller flutter bottom tabs how to make tab bar page in flutter flutter bottom tab navigation tabbar bottom flutter add tab bar in the bottom of the page flutter flutter bottom tab navigator flutter bottom tab bar navigation item bottom tab bar in flutter flutter bottom navigation bar tabbarview tabbar in bottomNavigation bar flutter tabbar on bottomNavigation bar flutter flutter navigation bar bottom tabbar flutter bottom tab bar navigation bottom tabs in flutter flutter bottom tab bar flutter tab bar bottom flutter style Bottom tab bar bottom tab in flutter flutter tabs bottom tab bar navigation flutter how to add a tab bar at bottom flutter bottom navigation tab bar flutter bottom tab navigation flutter tutorial bottom tab navigation flutter flutter top tab bar flutter tab navigation bar custom appbar bottom tab in flutter bottom tabbar flutter how to navigate tabs using a button in bottom bar flutter appbar tab bar overflow bottom flutter bottom tab bar flutter example bottom tab bar flutter flutter tab bar flutter tab bar bottom bar
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source