flutter_navigation 0.0.2

flutter-navigation #

Life is short, use Flutter Navigation

a flutter navigation solution

currently support cupertino app

First, add flutter_navigation as a dependency in your pubspec.yaml file.

Example #

    import "package:flutter_navigation/navigation.dart";
    import 'some_widget_1.dart'
    import 'some_widget_2.dart'

    final screens ={
           "SomeWidget1":(params,navigation)=>SomeWidget(params:params,navigation:navigation),
           "SomeWidget2":(params,navigation)=>SomeWidget(params:params,navigation:navigation),
    }
    final navigationOptions ={
              "SomeWidget1":NavigationOptions(title:Text('Widget Title')),
              "SomeWidget2":NavigationOptions(title:Text('Widget Title')),
    }




void main(){

    return runApp(FlutterNavigation(
            screens:screens,
            navigationOptions:navigationOptions,
            onUnknownRoute:Route (FlutterNavigator navigation){
                return SomeCupertinoPageRoute();
            },
            navigationType: FlutterNavigationTypes.IOS,
            initialRoute:"Home",
            onPush: (params) {
                print("onPush ${params}");
            },
            onPop: (params) {
                print("onPop ${params}");
            },
    ))
}
// some_widget_1.dart
import 'package:flutter/cupertino.dart';

class SomeWidget extends StatefulWidget {
  SomeWidget({this.params, this.navigation});
  final Map params;
  final navigation;
  @override
  State<StatefulWidget> createState() => SomeWidgetWithState();
}
class SomeWidgetWithState extends State<Home> {
  @override
  Widget build(BuildContext context) {
    return Column(children: <Widget>[
      CupertinoButton(
        child: Text('Go to profile'),
        onPressed: () {
          widget.navigation.push(context, "SomeWidget2", {"hello": Null});
        },
      )
    ]);
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  flutter_navigation: ^0.0.2

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

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

3. Import it

Now in your Dart code, you can use:


import 'package:flutter_navigation/constants.dart';
import 'package:flutter_navigation/page_scaffold.dart';
import 'package:flutter_navigation/app.dart';
import 'package:flutter_navigation/cupertino.dart';
import 'package:flutter_navigation/material.dart';
import 'package:flutter_navigation/navigation.dart';
import 'package:flutter_navigation/navigation_bar.dart';
import 'package:flutter_navigation/navigator.dart';
import 'package:flutter_navigation/unknown_route.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
2
Health:
Code health derived from static analysis. [more]
41
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
0
Overall:
Weighted score of the above. [more]
13
Learn more about scoring.

We analyzed this package on Jul 2, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.9+1
  • Flutter: 1.17.3

Health issues and suggestions

Fix lib/app.dart. (-58.02 points)

Analysis of lib/app.dart failed with 3 errors, 1 hint:

line 44 col 56: The named parameter 'isInitialRoute' isn't defined.

line 77 col 12: 'Page' isn't a function.

line 77 col 12: The name 'Page' is defined in the libraries 'package:flutter/src/widgets/navigator.dart (via package:flutter/widgets.dart)' and 'package:flutter_navigation/page_scaffold.dart'.

line 24 col 7: This class (or a class that this class inherits from) is marked as '@immutable', but one or more of its instance fields aren't final: FlutterNavigation.navigation

Document public APIs. (-0.30 points)

123 out of 126 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Fix lib/cupertino.dart. (-0.50 points)

Analysis of lib/cupertino.dart reported 1 hint:

line 1 col 8: Unused import: 'package:flutter/cupertino.dart'.

Fix lib/material.dart. (-0.50 points)

Analysis of lib/material.dart reported 1 hint:

line 1 col 8: Unused import: 'package:flutter/material.dart'.

Fix additional 4 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/constants.dart (Run flutter format to format lib/constants.dart.)
  • lib/navigation_bar.dart (Run flutter format to format lib/navigation_bar.dart.)
  • lib/navigator.dart (Run flutter format to format lib/navigator.dart.)
  • lib/page_scaffold.dart (Run flutter format to format lib/page_scaffold.dart.)

Maintenance issues and suggestions

No valid SDK. (-20 points)

The analysis could not detect a valid SDK that can use this package.

Provide a file named CHANGELOG.md. (-20 points)

Changelog entries help developers follow the progress of your package. See the example generated by stagehand.

Package is getting outdated. (-49.59 points)

The package was last published 78 weeks ago.

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and flutter_navigation.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Package is pre-v0.1 release. (-10 points)

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

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
cupertino_icons ^0.1.2 0.1.3
flutter 0.0.0
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8 1.2.0
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8
Dev dependencies
flutter_test