route_handlers.dart 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * fluro
  3. * A Posse Production
  4. * http://goposse.com
  5. * Copyright (c) 2018 Posse Productions LLC. All rights reserved.
  6. * See LICENSE for distribution and usage details.
  7. */
  8. import '../helpers/color_helpers.dart';
  9. import '../components/demo/demo_simple_component.dart';
  10. import 'package:flutter/painting.dart';
  11. import 'package:fluro/fluro.dart';
  12. import 'package:flutter/material.dart';
  13. var demoRouteHandler = new Handler(handlerFunc: (BuildContext context, Map<String, List<String>> params) {
  14. String message = params["message"]?.first;
  15. String colorHex = params["color_hex"]?.first;
  16. String result = params["result"]?.first;
  17. Color color = new Color(0xFFFFFFFF);
  18. if (colorHex != null && colorHex.length > 0) {
  19. color = new Color(ColorHelpers.fromHexString(colorHex));
  20. }
  21. return new DemoSimpleComponent(message: message, color: color, result: result);
  22. });
  23. var demoFunctionHandler = new Handler(
  24. type: HandlerType.function,
  25. handlerFunc: (BuildContext context, Map<String, List<String>> params) {
  26. String message = params["message"]?.first;
  27. showDialog(
  28. context: context,
  29. child: new AlertDialog(
  30. title: new Text(
  31. "Hey Hey!",
  32. style: new TextStyle(
  33. color: const Color(0xFF00D6F7),
  34. fontFamily: "Lazer84",
  35. fontSize: 22.0,
  36. ),
  37. ),
  38. content: new Text("$message"),
  39. actions: <Widget>[
  40. new Padding(
  41. padding: new EdgeInsets.only(bottom: 8.0, right: 8.0),
  42. child: new FlatButton(
  43. onPressed: () {
  44. Navigator.of(context).pop(true);
  45. },
  46. child: new Text("OK"),
  47. ),
  48. ),
  49. ],
  50. ),
  51. );
  52. });
  53. var deepLinkHandler = new Handler(handlerFunc: (BuildContext context, Map<String, List<String>> params) {});