demo_simple_component.dart 2.4 KB

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