easy_navi 0.0.1 copy "easy_navi: ^0.0.1" to clipboard
easy_navi: ^0.0.1 copied to clipboard

A new package that aims to make it easier to render a navigation widget

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

3
likes
140
points
16
downloads

Publisher

verified publishersrivats.dev

Weekly Downloads

A new package that aims to make it easier to render a navigation widget

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on easy_navi