demo_simple_component.dart 2.3 KB

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