Giter Site home page Giter Site logo

nav's Introduction

Welcome to Nav ๐Ÿ‘‹

Version License: Apache 2.0

Provide an easy way to navigate. Includes lots of routers. Available On Android & iOS

Install

Add nav dependency on your pubspec.yaml file

nav: ^{latest version}

Usage

  1. Add mixin "Nav" on your App State
import 'package:nav/nav.dart';

class _MyAppState extends State<MyApp> with Nav 
  1. Overide "get navigatorKey method" and provide key which you use in MaterialApp.navigatorKey
class MyApp extends StatefulWidget {
  static GlobalKey<NavigatorState> navigatorKey = GlobalKey();
  // This widget is the root of your application.

  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> with Nav {
  @override
  GlobalKey<NavigatorState> get navigatorKey => MyApp.navigatorKey;

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      navigatorKey: navigatorKey,
...
  1. Use push methods
//dynamic
Nav.push(Widget, navAni: NavAni.Blink);

//or
Nav.pushFromRight(Widget);
Nav.pushReplacement(Widget);
Nav.pushWithRippleEffect(Widget, centerAlignment : Alignment.bottomRight, centerOffset : Offset(10, 10));
Nav.clearAllAndPush(Widget);

enum NavAni { Left, Right, Top, Bottom, Fade, Ripple, Blink }
  1. All methods can return value
//from bottom screen
final result = await Nav.pushFromRight( TopScreen ) //you can get result from TopWidget

//from top screen
Nav.pop(context, result: {"key": "value", "key2": 2})
  1. Can define Type with NavScreen & pushResult method
TopScreen extends StatelessWidget with NavScreen<String> 

or

TopScreen extends StatefulWidget with NavScreen<String>


///from bottom screen
final result = await Nav.pushResult( TopScreen()); ///result type will be String? 

///from top screen
///return Type will be fixed by Generic NavScreen<Result>
popResult(context, result: 'Data to return'); ///from Widget

widget.popResult(context, result: 'Data to return'); ///from State

Author

๐Ÿ‘ค Bansook Nam

๐Ÿค Contributing

Contributions, issues and feature requests are welcome!

Feel free to check issues page. You can also take a look at the [contributing guide](Contributions, issues and feature requests are welcome.).

Show your support

Give a โญ๏ธ if this project helped you!

๐Ÿ“ License

Copyright ยฉ 2020 Bansook Nam.

This project is Apache 2.0 licensed.


This README was generated with โค๏ธ by readme-md-generator

nav's People

Contributors

bansooknam avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

bangslosan

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.