Compare commits
2 Commits
master
...
lukepighet
Author | SHA1 | Date |
---|---|---|
Luke Freeman | 3b41de247c | |
Luke Pighetti | 47e623613c |
|
@ -11,6 +11,3 @@ coverage
|
|||
__temp_coverage*
|
||||
.dart_tool/
|
||||
build/
|
||||
|
||||
# iOS
|
||||
**/flutter_export_environment.sh
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
#!/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 "OTHER_LDFLAGS=$(inherited) -framework Flutter"
|
||||
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"
|
|
@ -35,7 +35,6 @@ class AppComponentState extends State<AppComponent> {
|
|||
primarySwatch: Colors.blue,
|
||||
),
|
||||
onGenerateRoute: Application.router.generator,
|
||||
navigatorKey: Application.routerKey,
|
||||
);
|
||||
// print("initial route = ${app.initialRoute}");
|
||||
return app;
|
||||
|
|
|
@ -232,10 +232,10 @@ class HomeComponentState extends State<HomeComponent> {
|
|||
}
|
||||
|
||||
Application.router
|
||||
.navigateTo(Application.routerKey, route, transition: transitionType)
|
||||
.navigateTo(context, route, transition: transitionType)
|
||||
.then((result) {
|
||||
if (key == "pop-result") {
|
||||
Application.router.navigateTo(Application.routerKey, "/demo/func?message=$result");
|
||||
Application.router.navigateTo(context, "/demo/func?message=$result");
|
||||
}
|
||||
});
|
||||
} else if (key == "custom") {
|
||||
|
@ -253,7 +253,7 @@ class HomeComponentState extends State<HomeComponent> {
|
|||
);
|
||||
};
|
||||
Application.router.navigateTo(
|
||||
Application.routerKey,
|
||||
context,
|
||||
"/demo?message=$message&color_hex=$hexCode",
|
||||
transition: TransitionType.custom,
|
||||
transitionBuilder: transition,
|
||||
|
@ -261,10 +261,10 @@ class HomeComponentState extends State<HomeComponent> {
|
|||
);
|
||||
} else if (key == "fixed-trans") {
|
||||
Application.router.navigateTo(
|
||||
Application.routerKey, "/demo/fixedtrans?message=Hello!&color_hex=#f4424b");
|
||||
context, "/demo/fixedtrans?message=Hello!&color_hex=#f4424b");
|
||||
} else {
|
||||
message = "You tapped the function button!";
|
||||
Application.router.navigateTo(Application.routerKey, "/demo/func?message=$message");
|
||||
Application.router.navigateTo(context, "/demo/func?message=$message");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,10 +7,7 @@
|
|||
* See LICENSE for distribution and usage details.
|
||||
*/
|
||||
import 'package:fluro/fluro.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class Application {
|
||||
static Router router;
|
||||
|
||||
static GlobalKey<NavigatorState> routerKey = GlobalKey<NavigatorState>();
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ enum HandlerType {
|
|||
|
||||
///
|
||||
class Handler {
|
||||
const Handler({this.type = HandlerType.route, this.handlerFunc});
|
||||
Handler({this.type = HandlerType.route, this.handlerFunc});
|
||||
final HandlerType type;
|
||||
final HandlerFunc handlerFunc;
|
||||
}
|
||||
|
|
|
@ -38,16 +38,16 @@ class Router {
|
|||
return _routeTree.matchRoute(path);
|
||||
}
|
||||
|
||||
void pop(GlobalKey<NavigatorState> key) => key.currentState.pop();
|
||||
void pop(BuildContext context) => Navigator.pop(context);
|
||||
|
||||
///
|
||||
Future navigateTo(GlobalKey<NavigatorState> key, String path,
|
||||
Future navigateTo(BuildContext context, String path,
|
||||
{bool replace = false,
|
||||
bool clearStack = false,
|
||||
TransitionType transition,
|
||||
Duration transitionDuration = const Duration(milliseconds: 250),
|
||||
RouteTransitionsBuilder transitionBuilder}) {
|
||||
RouteMatch routeMatch = matchRoute(key.currentContext, path,
|
||||
RouteMatch routeMatch = matchRoute(context, path,
|
||||
transitionType: transition,
|
||||
transitionsBuilder: transitionBuilder,
|
||||
transitionDuration: transitionDuration);
|
||||
|
@ -58,16 +58,16 @@ class Router {
|
|||
completer.complete("Non visual route type.");
|
||||
} else {
|
||||
if (route == null && notFoundHandler != null) {
|
||||
route = _notFoundRoute(path);
|
||||
route = _notFoundRoute(context, path);
|
||||
}
|
||||
if (route != null) {
|
||||
if (clearStack) {
|
||||
future =
|
||||
key.currentState.pushAndRemoveUntil(route, (check) => false);
|
||||
Navigator.pushAndRemoveUntil(context, route, (check) => false);
|
||||
} else {
|
||||
future = replace
|
||||
? key.currentState.pushReplacement(route)
|
||||
: key.currentState.push(route);
|
||||
? Navigator.pushReplacement(context, route)
|
||||
: Navigator.push(context, route);
|
||||
}
|
||||
completer.complete();
|
||||
} else {
|
||||
|
@ -81,7 +81,7 @@ class Router {
|
|||
}
|
||||
|
||||
///
|
||||
Route<Null> _notFoundRoute(String path) {
|
||||
Route<Null> _notFoundRoute(BuildContext context, String path) {
|
||||
RouteCreator<Null> creator =
|
||||
(RouteSettings routeSettings, Map<String, List<String>> parameters) {
|
||||
return MaterialPageRoute<Null>(
|
||||
|
|
Loading…
Reference in New Issue