2017-05-04 15:33:40 -04:00
|
|
|
/*
|
2017-05-14 01:01:02 -04:00
|
|
|
* fluro
|
2017-05-04 15:33:40 -04:00
|
|
|
* A Posse Production
|
|
|
|
* http://goposse.com
|
|
|
|
* Copyright (c) 2017 Posse Productions LLC. All rights reserved.
|
|
|
|
* See LICENSE for distribution and usage details.
|
|
|
|
*/
|
2017-05-14 00:28:28 -04:00
|
|
|
part of fluro;
|
2017-04-25 03:24:14 -04:00
|
|
|
|
|
|
|
///
|
2017-05-28 13:13:36 -04:00
|
|
|
enum HandlerType {
|
|
|
|
route,
|
|
|
|
function,
|
|
|
|
}
|
2017-04-25 03:24:14 -04:00
|
|
|
|
|
|
|
///
|
2017-05-28 13:13:36 -04:00
|
|
|
class Handler {
|
|
|
|
Handler({this.type = HandlerType.route, this.handlerFunc});
|
|
|
|
final HandlerType type;
|
|
|
|
final HandlerFunc handlerFunc;
|
|
|
|
}
|
|
|
|
|
|
|
|
///
|
|
|
|
typedef Route<Null> RouteCreator(RouteSettings route, Map<String, dynamic> parameters);
|
|
|
|
|
|
|
|
///
|
|
|
|
typedef Widget HandlerFunc(BuildContext context, Map<String, dynamic> parameters);
|
2017-04-25 03:24:14 -04:00
|
|
|
|
|
|
|
///
|
|
|
|
class AppRoute {
|
|
|
|
String route;
|
2017-05-28 13:13:36 -04:00
|
|
|
dynamic handler;
|
2017-05-04 15:27:32 -04:00
|
|
|
AppRoute(this.route, this.handler);
|
2017-05-28 13:13:36 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
enum RouteMatchType {
|
|
|
|
visual,
|
|
|
|
nonVisual,
|
|
|
|
noMatch,
|
|
|
|
}
|
|
|
|
|
|
|
|
///
|
|
|
|
class RouteMatch {
|
|
|
|
RouteMatch({
|
|
|
|
@required this.matchType = RouteMatchType.noMatch,
|
|
|
|
this.route = null,
|
|
|
|
this.errorMessage = "Unable to match route. Please check the logs."
|
|
|
|
});
|
|
|
|
final Route<Null> route;
|
|
|
|
final RouteMatchType matchType;
|
|
|
|
final String errorMessage;
|
2017-04-25 03:24:14 -04:00
|
|
|
}
|