route_handlers.dart 1.7 KB

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