flutter_redux_navigation 0.3.0

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

Flutter Navigation for redux

Build Status codecov

Navigation Middleware for Flutter's redux library.

Basic classes that enables page navigation through by utilizing Redux Store middleware facility.

This package is built to work with Redux.dart 3.0.0+.

Redux Middleware

  • NavigationMiddleware<T> - The Middleware that reacts to NavigateToActions.

Examples

Take a look in the examples directory.

How to setup navigation

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

class AppState {
  final String name;
  
  const AppState(this.name);
  
  factory AppState.initial() => AppState(null);
  factory AppState.changeName(String name) => AppState(name);
}

class AppNameChangedAction {
  final String name;

  AppNameChangedAction(this.name);
}

AppState _onAppNameChanged(AppState state, AppNameChangedAction action) =>
    state.changeName(action.name);

final appReducer = combineReducers<AppState>([
  TypedReducer<AppState, AppNameChangedAction>(_onAppNameChanged),
]);


final store = new Store<AppState>(combineReducers<AppState>([appReducer]),
    initialState: AppState.initial(),
    middleware: [
      NavigationMiddleware<AppState>(),
    ]);

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return StoreProvider<AppState>(
        store: store,
        child: MaterialApp(
          title: 'My App',
          navigatorKey: NavigatorHolder.navigatorKey,
        )
    );
  }
}

void main() => runApp(MyApp());

How to navigate

Let's say you wish to navigate from a LoginPage to some dashboard page, you only need to dispatch a NavigateToAction.replace action with the appropriate path, which is registered to the dashboard page.

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

class LoginPage extends StatefulWidget {
  @override
  State<StatefulWidget> createState() => LoginPageState();
}

class LoginPageState extends State<LoginPage> {
  @override
  Widget build(BuildContext context) {
    return StoreConnector<AppState, AuthBloc>(
      converter: (store) {
        return store;
      },
      builder: (BuildContext context, Store<AppState> store) {
        return Scaffold(body: Builder(
          builder: (BuildContext context) {
            return Column(
              mainAxisAlignment: MainAxisAlignment.center,
              children: <Widget>[
                RaisedButton(
                onPressed: () {
                  store.dispatch(NavigateToAction.replace('/dashboard'));
                },
                child: Text('Login'),
              )
              ],
            );
          },
        ));
      },
    );
  }
}

Change Log

0.3.0 (2019-01-06)

Full Changelog

0.2.0 (2019-01-04)

Full Changelog

0.1.1 (2018-12-28)

Full Changelog

0.1.0 (2018-12-28)

Full Changelog

0.0.3 (2018-12-28)

Full Changelog

0.0.2 (2018-12-28)

Full Changelog

0.0.1 (2018-12-28)

* This Change Log was automatically generated by github_changelog_generator

example/README.md

Examples

  • Simple Login Example - A simple example to demonstrate the replacement navigation through NavigationToActions.

Use this package as a library

1. Depend on it

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


dependencies:
  flutter_redux_navigation: ^0.3.0

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:flutter_redux_navigation/flutter_redux_navigation.dart';
  
Version Uploaded Documentation Archive
0.3.0 Jan 6, 2019 Go to the documentation of flutter_redux_navigation 0.3.0 Download flutter_redux_navigation 0.3.0 archive
0.2.0 Jan 4, 2019 Go to the documentation of flutter_redux_navigation 0.2.0 Download flutter_redux_navigation 0.2.0 archive
0.1.1 Dec 28, 2018 Go to the documentation of flutter_redux_navigation 0.1.1 Download flutter_redux_navigation 0.1.1 archive
0.1.0 Dec 28, 2018 Go to the documentation of flutter_redux_navigation 0.1.0 Download flutter_redux_navigation 0.1.0 archive
0.0.3 Dec 28, 2018 Go to the documentation of flutter_redux_navigation 0.0.3 Download flutter_redux_navigation 0.0.3 archive
0.0.2 Dec 28, 2018 Go to the documentation of flutter_redux_navigation 0.0.2 Download flutter_redux_navigation 0.0.2 archive
0.0.1 Dec 28, 2018 Go to the documentation of flutter_redux_navigation 0.0.1 Download flutter_redux_navigation 0.0.1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
36
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
68
Learn more about scoring.

We analyzed this package on Jan 15, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.1.0
  • pana: 0.12.10
  • Flutter: 1.1.7

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
flutter 0.0.0
redux ^3.0.0 3.0.0
Transitive dependencies
collection 1.14.11
meta 1.1.6 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test