navigate 0.0.1

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • new73

demo


Example source code is here

A new Flutter package for Byutifull navigation

Why develop this package

A flutter have a package name a fluro. Fluro is a nice package and easy to use but they have some limitation. If i need to pass a parameter in Map, List type variable that not allow me. Fluro allow only string but in real time that's not good.

App development its diff from web development in web development we need to pass only small amount of data like id, slug or etc but in App development we need to pass data between screen is object , array or etc.

Getting Started

Step 1: install navigator

navigator: 0.0.1

Step 2: Create new folder lib\config
Step 3: Create file in folder lib\config\route.dart

import 'package:flutter/material.dart';
import 'package:navigate/navigate.dart';
import 'package:testpackage/main.dart';



// define your handler here or create new file for handler 

var homeHandler = Handler(
  transactionType: TransactionType.fromRight,
  pageBuilder: (BuildContext context,arg){

      //return your page from here 
      return HomePage(replaceRoute: arg["replaceRoute"],transactionType: arg["transactionType"],);
  }
);

// define your route here 
Map<String,Handler> route = {
    "home" : homeHandler
 };

Work of above code is create one route name home . Route have their own handler called homeHandler . You can define TransactionType of slide how come on screen. Its not required if it null then Defualt transaction is work.

Step 4: Register your route
It's a final step of intigration. Now you need to register your routes with package in first page of your class constructor my landing page of app is LandingPage()

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

/* your route file */ 
import 'package:testpackage/config/route.dart';

class LandingPage extends StatelessWidget {

  LandingPage(){
   // start registration of routes 
     Navigate.registerRoutes(
      routes: route,
      defualtTransactionType: TransactionType.fromRight // if not provide in handler or manually in argument of navigation
    );
    //end  registration of routes 
  }
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text("Navigator Demo"),),
      body: Center(
            child:Text("welcome")
        ),
      ),
    );
  }
}  

Now you navigate from anywhere in app

Navigate.navigate(context,
                  "home", /* route name */
                  transactionType: transactionType, /* Override handler transaction type (optional) */
                  replaceRoute: replaceRoute, // replace route after navigate or not 
                  arg: {"transactionType":transactionType,"replaceRoute":replaceRoute} // argument data receiver in handler page builder function */
                  );

[0.0.1] - TODO: Add release date.

  • TODO: Describe initial release.

example/lib/main.dart

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

import 'config/route.dart';


void main() => runApp(new MaterialApp(
      home: new LandingPage(),
    ));

class LandingPage extends StatelessWidget {

  LandingPage(){
    Navigate.registerRoutes(
      routes: route,
      defualtTransactionType: TransactionType.fromRight
    );
  }
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text("Navigator Demo"),),
      body: Center(
        child: new RaisedButton(
          child: Text("Take Demo"),
          onPressed: (){
               Navigate.navigate(context,
                  "home",
                  transactionType:TransactionType.fromBottomRight ,
                  replaceRoute: ReplaceRoute.none,
                  arg: {"transactionType":TransactionType.fromLeft,"replaceRoute":ReplaceRoute.none,"color":Colors.green}
                  );
          },

        ),
      ),
    );
  }
}    

class HomePage extends StatefulWidget {
  TransactionType transactionType;
  ReplaceRoute replaceRoute;
  Color color;

  HomePage({this.transactionType, this.replaceRoute,this.color});
  @override
  _HomePageState createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  TransactionType transactionType;
  ReplaceRoute replaceRoute;
  Color color;
  Color currentColor;
  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    transactionType = widget.transactionType;
    print(transactionType);
    replaceRoute = widget.replaceRoute;
    currentColor = widget.color;
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("Navigator Demo"),
      ),
      body: Container(
        color: currentColor,
        child: Center(
          child: new Column(
            mainAxisSize: MainAxisSize.min,
            mainAxisAlignment: MainAxisAlignment.center,
            crossAxisAlignment: CrossAxisAlignment.center,
            children: <Widget>[
              new DropdownButton(
                onChanged: (TransactionType type) {
                  setState(() {
                    transactionType = type;
                  });
                },
                value: transactionType,
                items: [
                  DropdownMenuItem(
                    child: Text("Come  from Left"),
                    value: TransactionType.fromLeft,
                  ),
                  DropdownMenuItem(
                    child: Text("Come  from Right"),
                    value: TransactionType.fromRight,
                  ),
                  DropdownMenuItem(
                    child: Text("Come  from Top"),
                    value: TransactionType.fromTop,
                  ),
                  DropdownMenuItem(
                    child: Text("Come  from Bottom"),
                    value: TransactionType.fromBottom,
                  ),
                 DropdownMenuItem(
                    child: Text("Come  from Bottom Center"),
                    value: TransactionType.fromBottomCenter,
                  ),
                  DropdownMenuItem(
                    child: Text("Come  from Bottom Left"),
                    value: TransactionType.fromBottomLeft,
                  ),
                  DropdownMenuItem(
                    child: Text("Come  from Bottom Right"),
                    value: TransactionType.fromBottomRight,
                  ),
                  DropdownMenuItem(
                    child: Text("Come  from Fade in"),
                    value: TransactionType.fadeIn,
                  ),
                ],
              ),
               new DropdownButton(
                onChanged: (ReplaceRoute type) {
                  setState(() {
                       replaceRoute = type;
                  });
                },
                value: replaceRoute,
                items: [
                  DropdownMenuItem(
                    child: Text("Replace none"),
                    value: ReplaceRoute.none,
                  ),
                  DropdownMenuItem(
                    child: Text("Replace itSelf"),
                    value: ReplaceRoute.thisOne,
                  ),
                  DropdownMenuItem(
                    child: Text("Replace all"),
                    value: ReplaceRoute.all,
                  ),
               ],
              ),
                new DropdownButton(
                onChanged: (Color type) {
                  setState(() {
                       color = type;
                  });
                },
                value: color,
                items: [
                  DropdownMenuItem(
                    child: Text("red"),
                    value: Colors.red,
                  ),
                  DropdownMenuItem(
                    child: Text("yellow"),
                    value: Colors.yellow,
                  ),
                  DropdownMenuItem(
                    child: Text("pink"),
                    value: Colors.pink,
                  ),
                   DropdownMenuItem(
                    child: Text("green"),
                    value: Colors.green,
                  ),
               ],
              ),
              RaisedButton(
                child: Text("Navigate route"),
                onPressed: () {
                  Navigate.navigate(context,
                  "home",
                  transactionType: transactionType,
                  replaceRoute: replaceRoute,
                  arg: {"transactionType":transactionType,"replaceRoute":replaceRoute,"color":color}
                  );
                },
              )
            ],
          ),
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  navigate: ^0.0.1

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter packages get

Alternatively, your editor might support flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:navigate/navigate.dart';
  
Version Uploaded Documentation Archive
0.0.1 Aug 25, 2018 Go to the documentation of navigate 0.0.1 Download navigate 0.0.1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
64
Health:
Code health derived from static analysis. [more]
77
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
73
Learn more about scoring.

We analyzed this package on Sep 18, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0
  • pana: 0.12.3
  • Flutter: 0.8.4

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Issues and suggestions

Fix lib/navigate.dart.

Analysis of lib/navigate.dart reported 5 warnings:

line 90 col 7: Missing case clause for 'custom'.

line 90 col 7: Missing case clause for 'fadeIn'.

line 90 col 7: Missing case clause for 'fromBottomCenter'.

line 90 col 7: Missing case clause for 'fromBottomLeft'.

line 90 col 7: Missing case clause for 'fromBottomRight'.

Package is pre-v0.1 release.

While there is nothing inherently wrong with versions of 0.0.*, it usually means that the author is still experimenting with the general direction of the API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.24.3 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11
meta 1.1.6
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test