Skip to content

easy_navi is a Flutter Package that makes adding navigation to your app simple. It contains code for displaying a NavigationRail and NavigationBar

License

Notifications You must be signed in to change notification settings

srivats22/easy_navi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

easy_navi is a Flutter Package that makes adding navigation to your app simple. It contains code for displaying a NavigationRail and NavigationBar

Features

easy_navi allows you to define your destinations once and then use that to render either a NavigationRail or a NavigationBar

Getting started

Import the following at the top of you file

import 'package:easy_navi/navi.dart';
import 'package:easy_navi/destination_obj.dart';
import 'package:easy_navi/navi_options/navi_rails.dart';
import 'package:easy_navi/navi_options/navi_bottom.dart';

Define your pages and destination list and current starting index as follows:

var pages = const [
  Text("Home"),
  Text("Dashboard"),
  Text("Account"),
];

var destinations = [
  DestinationObj(
    activeIcon: const Icon(Icons.home),
    unActiveIcon: const Icon(Icons.home_outlined),
    label: "Home",
  ),
  DestinationObj(
    activeIcon: const Icon(Icons.dashboard),
    unActiveIcon: const Icon(Icons.dashboard_outlined),
    label: "Dashboard",
  ),
  DestinationObj(
    activeIcon: const Icon(Icons.account_circle),
    unActiveIcon: const Icon(Icons.account_circle_outlined),
    label: "Account",
  ),
];

int currIndex = 0;

Usage

To render a bottom navigation bar use the following code:

return BottomNavi(
  currIndex: index,
  destination: destinations,
  children: pages,
);

To render a navigation rail use the following code:

return NaviRails(
  currIndex: index,
  destinations: destinations,
  children: pages,
);

Additional information

For a full working app, take a look at the examples folder of this repository

About

easy_navi is a Flutter Package that makes adding navigation to your app simple. It contains code for displaying a NavigationRail and NavigationBar

Topics

Resources

License

Stars

Watchers

Forks