Fancy Bottom Bar In Flutter

Fancy Bottom Bar In Flutter :

Screenshot :

Fancy Bottom Bar In Flutter

main.dart

import 'package:fancy_bottom_navigation/fancy_bottom_navigation.dart';
import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Tutorial',
      theme: ThemeData(
        brightness: Brightness.light
      ),
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int currentPage = 0;

  GlobalKey bottomNavigationKey = GlobalKey();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Container(
        decoration: BoxDecoration(color: Colors.white),
        child: Center(
          child: _getPage(currentPage),
        ),
      ),
      bottomNavigationBar: FancyBottomNavigation(
         inactiveIconColor: Colors.grey,
         activeIconColor: Colors.redAccent,
         circleColor: Colors.white,
         textColor: Colors.redAccent,
        tabs: [
          TabData(
            iconData: Icons.home,
            title: "Home",
          ),
          TabData(
            iconData: Icons.whatshot,
            title: "Comptetion",
          ),
          TabData(iconData: Icons.wb_incandescent, title: "Table"),
          TabData(iconData: Icons.shopping_cart, title: "My Favourite")
        ],
        initialSelection: 0,
        key: bottomNavigationKey,
        onTabChangedListener: (position) {
          setState(() {
            currentPage = position;
          });
        },
      ),
      drawer: Drawer(
        child: ListView(
          children: <Widget>[Text("Hello"), Text("Nikhil")],
        ),
      ),
    );
  }

  _getPage(int page) {
    switch (page) {
      case 0:
        return Column(
          mainAxisSize: MainAxisSize.min,
          children: <Widget>[
            Text("This is empty page"),
          ],
        );
      case 1:
        return Column(
          mainAxisSize: MainAxisSize.min,
          children: <Widget>[
            Text("This is empty page"),
          ],
        );
        case 2:
        //return Total();
      case 3:
        return Column(
          mainAxisSize: MainAxisSize.min,
          children: <Widget>[
            Text("This is empty page"),
          ],
        );
      default:
        return Column(
          mainAxisSize: MainAxisSize.min,
          children: <Widget>[
            Text("This is empty page"),
          ],
        );
    }
  }
}

pubspec.yaml

name: fluttertutorial
description: A new Flutter project.
version: 1.0.0+1

environment:
sdk: “>=2.1.0 <3.0.0”

dependencies:
flutter:
sdk: flutter

cupertino_icons: ^0.1.2
fancy_bottom_navigation:

dev_dependencies:
flutter_test:
sdk: flutter

flutter:
uses-material-design: true

The flutter tutorial  is a website that bring you the latest and amazing resources of code. All the languages codes are included in this website. The languages like flutter, android, java,kotlin etc.with the help of this languages any user can develop the beautiful application

For more information about Flutter. visit www.fluttertutorial.in