Compare commits

...

11 Commits

Author SHA1 Message Date
Michael Pfaff 9956b24eb2 Take GlobalKey<NavigatorState> instead of BuildContext 2020-04-24 14:16:22 -04:00
Michael Pfaff 45949890cc Make route handler constant 2020-04-20 16:59:39 -04:00
Michael Pfaff 8e99c535bd Remove file that should not be checked into version control 2020-04-20 16:59:23 -04:00
Luke 30ae4378df
Remove upper bounds on pubspec (#163)
* remove upper constraint for flutter environment
* update docs
Co-authored-by: Luke Pighetti <lukepighetti@gmail.com>
2020-04-07 10:46:20 -07:00
Luke Freeman 937afe9757 update docs 2020-03-28 14:37:43 -07:00
Luke Pighetti aca29a1e34
Allow Flutter <1.17.0 (#153)
- Support dev version
2020-03-22 14:56:55 -07:00
Luke Freeman 337d864b62 bump version 2020-03-08 19:54:50 -07:00
Luke Freeman 3a1a20e03b update CHANGLOG and README 2020-03-08 19:54:38 -07:00
Luke Freeman 53e1c97960 downgrade Flutter required version 2020-03-08 19:53:28 -07:00
Luke Freeman 16b09f760c bump version 2020-03-08 19:42:31 -07:00
Luke Freeman 624626c85d update README and CHANGELOG 2020-03-08 19:39:52 -07:00
10 changed files with 38 additions and 29 deletions

3
.gitignore vendored
View File

@ -11,3 +11,6 @@ coverage
__temp_coverage* __temp_coverage*
.dart_tool/ .dart_tool/
build/ build/
# iOS
**/flutter_export_environment.sh

View File

@ -1,5 +1,15 @@
# 1.6.3
- Remove upper bounds on Flutter SDK checks because Flutter releases are a ridiculous mess
# 1.6.2
- Support for Flutter `>=1.12 <=1.17`
# 1.6.1
- Support for Flutter `1.12+`
# 1.6.0 # 1.6.0
- Flutter `>= 1.13.0` is required due to Flutter compatibility issues - No changes other than fixes for non-backwards compatible Flutter changes
- Flutter `>= 1.12.0` is required due to Flutter compatibility issues
- Dart `>= 2.6.0` is required - Dart `>= 2.6.0` is required
# 1.5.2 # 1.5.2

View File

@ -3,10 +3,12 @@
The brightest, hippest, coolest router for Flutter. The brightest, hippest, coolest router for Flutter.
[![Version](https://img.shields.io/badge/version-1.6.0-blue.svg)](https://pub.dartlang.org/packages/fluro) [![Version](https://img.shields.io/badge/version-1.6.3-blue.svg)](https://pub.dartlang.org/packages/fluro)
[![Build Status](https://travis-ci.org/theyakka/fluro.svg?branch=master)](https://travis-ci.org/theyakka/fluro) [![Build Status](https://travis-ci.org/theyakka/fluro.svg?branch=master)](https://travis-ci.org/theyakka/fluro)
[![Coverage](https://codecov.io/gh/theyakka/fluro/branch/master/graph/badge.svg)](https://codecov.io/gh/theyakka/fluro) [![Coverage](https://codecov.io/gh/theyakka/fluro/branch/master/graph/badge.svg)](https://codecov.io/gh/theyakka/fluro)
Version `1.6.0` (and higher) requires Flutter `>= 1.12.0` and Dart `>= 2.6.0`. If you're running an older version of Flutter, use a version `< 1.6.0`.
## Features ## Features
- Simple route navigation - Simple route navigation
@ -25,7 +27,7 @@ See CHANGELOG for all breaking (and non-breaking) changes.
You should ensure that you add the router as a dependency in your flutter project. You should ensure that you add the router as a dependency in your flutter project.
```yaml ```yaml
dependencies: dependencies:
fluro: "^1.6.0" fluro: "^1.6.3"
``` ```
You can also reference the git repo directly if you want: You can also reference the git repo directly if you want:

View File

@ -1,10 +0,0 @@
#!/bin/sh
# This is a generated file; do not edit or check into version control.
export "FLUTTER_ROOT=/home/luke/Development/.sdks/flutter"
export "FLUTTER_APPLICATION_PATH=/home/luke/Development/yakka/fluro/fluro-flutter/example"
export "FLUTTER_TARGET=lib/main.dart"
export "FLUTTER_BUILD_DIR=build"
export "SYMROOT=${SOURCE_ROOT}/../build/ios"
export "FLUTTER_FRAMEWORK_DIR=/home/luke/Development/.sdks/flutter/bin/cache/artifacts/engine/ios"
export "FLUTTER_BUILD_NAME=1.0.0"
export "FLUTTER_BUILD_NUMBER=1"

View File

@ -35,6 +35,7 @@ class AppComponentState extends State<AppComponent> {
primarySwatch: Colors.blue, primarySwatch: Colors.blue,
), ),
onGenerateRoute: Application.router.generator, onGenerateRoute: Application.router.generator,
navigatorKey: Application.routerKey,
); );
// print("initial route = ${app.initialRoute}"); // print("initial route = ${app.initialRoute}");
return app; return app;

View File

@ -232,10 +232,10 @@ class HomeComponentState extends State<HomeComponent> {
} }
Application.router Application.router
.navigateTo(context, route, transition: transitionType) .navigateTo(Application.routerKey, route, transition: transitionType)
.then((result) { .then((result) {
if (key == "pop-result") { if (key == "pop-result") {
Application.router.navigateTo(context, "/demo/func?message=$result"); Application.router.navigateTo(Application.routerKey, "/demo/func?message=$result");
} }
}); });
} else if (key == "custom") { } else if (key == "custom") {
@ -253,7 +253,7 @@ class HomeComponentState extends State<HomeComponent> {
); );
}; };
Application.router.navigateTo( Application.router.navigateTo(
context, Application.routerKey,
"/demo?message=$message&color_hex=$hexCode", "/demo?message=$message&color_hex=$hexCode",
transition: TransitionType.custom, transition: TransitionType.custom,
transitionBuilder: transition, transitionBuilder: transition,
@ -261,10 +261,10 @@ class HomeComponentState extends State<HomeComponent> {
); );
} else if (key == "fixed-trans") { } else if (key == "fixed-trans") {
Application.router.navigateTo( Application.router.navigateTo(
context, "/demo/fixedtrans?message=Hello!&color_hex=#f4424b"); Application.routerKey, "/demo/fixedtrans?message=Hello!&color_hex=#f4424b");
} else { } else {
message = "You tapped the function button!"; message = "You tapped the function button!";
Application.router.navigateTo(context, "/demo/func?message=$message"); Application.router.navigateTo(Application.routerKey, "/demo/func?message=$message");
} }
} }
} }

View File

@ -7,7 +7,10 @@
* See LICENSE for distribution and usage details. * See LICENSE for distribution and usage details.
*/ */
import 'package:fluro/fluro.dart'; import 'package:fluro/fluro.dart';
import 'package:flutter/material.dart';
class Application { class Application {
static Router router; static Router router;
static GlobalKey<NavigatorState> routerKey = GlobalKey<NavigatorState>();
} }

View File

@ -17,7 +17,7 @@ enum HandlerType {
/// ///
class Handler { class Handler {
Handler({this.type = HandlerType.route, this.handlerFunc}); const Handler({this.type = HandlerType.route, this.handlerFunc});
final HandlerType type; final HandlerType type;
final HandlerFunc handlerFunc; final HandlerFunc handlerFunc;
} }

View File

@ -38,16 +38,16 @@ class Router {
return _routeTree.matchRoute(path); return _routeTree.matchRoute(path);
} }
void pop(BuildContext context) => Navigator.pop(context); void pop(GlobalKey<NavigatorState> key) => key.currentState.pop();
/// ///
Future navigateTo(BuildContext context, String path, Future navigateTo(GlobalKey<NavigatorState> key, String path,
{bool replace = false, {bool replace = false,
bool clearStack = false, bool clearStack = false,
TransitionType transition, TransitionType transition,
Duration transitionDuration = const Duration(milliseconds: 250), Duration transitionDuration = const Duration(milliseconds: 250),
RouteTransitionsBuilder transitionBuilder}) { RouteTransitionsBuilder transitionBuilder}) {
RouteMatch routeMatch = matchRoute(context, path, RouteMatch routeMatch = matchRoute(key.currentContext, path,
transitionType: transition, transitionType: transition,
transitionsBuilder: transitionBuilder, transitionsBuilder: transitionBuilder,
transitionDuration: transitionDuration); transitionDuration: transitionDuration);
@ -58,16 +58,16 @@ class Router {
completer.complete("Non visual route type."); completer.complete("Non visual route type.");
} else { } else {
if (route == null && notFoundHandler != null) { if (route == null && notFoundHandler != null) {
route = _notFoundRoute(context, path); route = _notFoundRoute(path);
} }
if (route != null) { if (route != null) {
if (clearStack) { if (clearStack) {
future = future =
Navigator.pushAndRemoveUntil(context, route, (check) => false); key.currentState.pushAndRemoveUntil(route, (check) => false);
} else { } else {
future = replace future = replace
? Navigator.pushReplacement(context, route) ? key.currentState.pushReplacement(route)
: Navigator.push(context, route); : key.currentState.push(route);
} }
completer.complete(); completer.complete();
} else { } else {
@ -81,7 +81,7 @@ class Router {
} }
/// ///
Route<Null> _notFoundRoute(BuildContext context, String path) { Route<Null> _notFoundRoute(String path) {
RouteCreator<Null> creator = RouteCreator<Null> creator =
(RouteSettings routeSettings, Map<String, List<String>> parameters) { (RouteSettings routeSettings, Map<String, List<String>> parameters) {
return MaterialPageRoute<Null>( return MaterialPageRoute<Null>(

View File

@ -2,12 +2,12 @@ name: fluro
description: > description: >
Fluro is a Flutter routing library that adds flexible routing options like wildcards, named Fluro is a Flutter routing library that adds flexible routing options like wildcards, named
parameters and clear route definitions. parameters and clear route definitions.
version: 1.6.0-dev version: 1.6.3
homepage: https://github.com/theyakka/fluro homepage: https://github.com/theyakka/fluro
environment: environment:
sdk: ">=2.6.0 <3.0.0" sdk: ">=2.6.0 <3.0.0"
flutter: ">=1.13.0 <1.16.0" flutter: ">=1.12.0"
dependencies: dependencies:
flutter: flutter: