demo_simple_component.dart 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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 'package:flutter/material.dart';
  10. class DemoSimpleComponent extends StatelessWidget {
  11. DemoSimpleComponent({String message = "Testing", Color color = const Color(0xFFFFFFFF), String result})
  12. : this.message = message,
  13. this.color = color,
  14. this.result = result;
  15. final String message;
  16. final Color color;
  17. final String result;
  18. @override
  19. Widget build(BuildContext context) {
  20. return new Material(
  21. color: color,
  22. child: new Column(
  23. mainAxisAlignment: MainAxisAlignment.center,
  24. children: [
  25. new Image(
  26. image: new AssetImage("assets/images/acc_boom.png"),
  27. color: ColorHelpers.blackOrWhiteContrastColor(color),
  28. width: 260.0,
  29. ),
  30. new Padding(
  31. padding: new EdgeInsets.only(left: 50.0, right: 50.0, top: 15.0),
  32. child: new Text(
  33. message,
  34. textAlign: TextAlign.center,
  35. style: new TextStyle(
  36. color: ColorHelpers.blackOrWhiteContrastColor(color),
  37. height: 2.0,
  38. ),
  39. ),
  40. ),
  41. new Padding(
  42. padding: new EdgeInsets.only(top: 15.0),
  43. child: new ConstrainedBox(
  44. constraints: new BoxConstraints(minHeight: 42.0),
  45. child: new FlatButton(
  46. highlightColor: ColorHelpers.blackOrWhiteContrastColor(color).withAlpha(17),
  47. splashColor: ColorHelpers.blackOrWhiteContrastColor(color).withAlpha(34),
  48. onPressed: () {
  49. if (result == null) {
  50. Navigator.pop(context);
  51. } else {
  52. Navigator.pop(context, result);
  53. }
  54. },
  55. child: new Text(
  56. "OK",
  57. style: new TextStyle(
  58. fontSize: 18.0,
  59. color: ColorHelpers.blackOrWhiteContrastColor(color),
  60. ),
  61. ),
  62. ),
  63. ),
  64. ),
  65. ],
  66. ),
  67. );
  68. }
  69. }