common.dart 1006 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * fluro
  3. * A Posse Production
  4. * http://goposse.com
  5. * Copyright (c) 2017 Posse Productions LLC. All rights reserved.
  6. * See LICENSE for distribution and usage details.
  7. */
  8. part of fluro;
  9. ///
  10. enum HandlerType {
  11. route,
  12. function,
  13. }
  14. ///
  15. class Handler {
  16. Handler({this.type = HandlerType.route, this.handlerFunc});
  17. final HandlerType type;
  18. final HandlerFunc handlerFunc;
  19. }
  20. ///
  21. typedef Route<Null> RouteCreator(RouteSettings route, Map<String, dynamic> parameters);
  22. ///
  23. typedef Widget HandlerFunc(BuildContext context, Map<String, dynamic> parameters);
  24. ///
  25. class AppRoute {
  26. String route;
  27. dynamic handler;
  28. AppRoute(this.route, this.handler);
  29. }
  30. enum RouteMatchType {
  31. visual,
  32. nonVisual,
  33. noMatch,
  34. }
  35. ///
  36. class RouteMatch {
  37. RouteMatch({
  38. @required this.matchType = RouteMatchType.noMatch,
  39. this.route = null,
  40. this.errorMessage = "Unable to match route. Please check the logs."
  41. });
  42. final Route<Null> route;
  43. final RouteMatchType matchType;
  44. final String errorMessage;
  45. }