demo_simple_component.dart 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * fluro
  3. * Created by Yakka
  4. * https://theyakka.com
  5. *
  6. * Copyright (c) 2018 Yakka, LLC. All rights reserved.
  7. * See LICENSE for distribution and usage details.
  8. */
  9. import '../../helpers/color_helpers.dart';
  10. import 'package:flutter/material.dart';
  11. class DemoSimpleComponent extends StatelessWidget {
  12. DemoSimpleComponent(
  13. {String message = "Testing",
  14. Color color = const Color(0xFFFFFFFF),
  15. String result})
  16. : this.message = message,
  17. this.color = color,
  18. this.result = result;
  19. final String message;
  20. final Color color;
  21. final String result;
  22. @override
  23. Widget build(BuildContext context) {
  24. return new Material(
  25. color: color,
  26. child: new Column(
  27. mainAxisAlignment: MainAxisAlignment.center,
  28. children: [
  29. new Image(
  30. image: new AssetImage("assets/images/acc_boom.png"),
  31. color: ColorHelpers.blackOrWhiteContrastColor(color),
  32. width: 260.0,
  33. ),
  34. new Padding(
  35. padding: new EdgeInsets.only(left: 50.0, right: 50.0, top: 15.0),
  36. child: new Text(
  37. message,
  38. textAlign: TextAlign.center,
  39. style: new TextStyle(
  40. color: ColorHelpers.blackOrWhiteContrastColor(color),
  41. height: 2.0,
  42. ),
  43. ),
  44. ),
  45. new Padding(
  46. padding: new EdgeInsets.only(top: 15.0),
  47. child: new ConstrainedBox(
  48. constraints: new BoxConstraints(minHeight: 42.0),
  49. child: new FlatButton(
  50. highlightColor:
  51. ColorHelpers.blackOrWhiteContrastColor(color).withAlpha(17),
  52. splashColor:
  53. ColorHelpers.blackOrWhiteContrastColor(color).withAlpha(34),
  54. onPressed: () {
  55. if (result == null) {
  56. Navigator.pop(context);
  57. } else {
  58. Navigator.pop(context, result);
  59. }
  60. },
  61. child: new Text(
  62. "OK",
  63. style: new TextStyle(
  64. fontSize: 18.0,
  65. color: ColorHelpers.blackOrWhiteContrastColor(color),
  66. ),
  67. ),
  68. ),
  69. ),
  70. ),
  71. ],
  72. ),
  73. );
  74. }
  75. }