route_handlers.dart 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. 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, dynamic> params) {
  14. String message = params["message"];
  15. String colorHex = params["color_hex"];
  16. String result = params["result"];
  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(type: HandlerType.function,
  24. handlerFunc: (BuildContext context, Map<String, dynamic> params)
  25. {
  26. String message = params["message"];
  27. showDialog(context: context,
  28. child: new AlertDialog(
  29. title: new Text(
  30. "Hey Hey!",
  31. style: new TextStyle(
  32. color: const Color(0xFF00D6F7),
  33. fontFamily: "Lazer84",
  34. fontSize: 22.0,
  35. ),
  36. ),
  37. content: new Text("$message"),
  38. actions: <Widget>[
  39. new Padding(
  40. padding: new EdgeInsets.only(bottom: 8.0, right: 8.0),
  41. child: new FlatButton(
  42. onPressed: () {
  43. Navigator.of(context).pop(true);
  44. },
  45. child: new Text("OK"),
  46. ),
  47. ),
  48. ],
  49. ),
  50. );
  51. });
  52. var deepLinkHandler = new Handler(handlerFunc: (BuildContext context, Map<String, dynamic> params) {
  53. });