demo_simple_component.dart 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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: TextButton(
  51. onPressed: () {
  52. if (result == null) {
  53. /// You can use [Navigator.pop]
  54. Navigator.pop(context);
  55. } else {
  56. /// Or [FluroRouter.pop]
  57. FluroRouter.appRouter.pop(context, result);
  58. }
  59. },
  60. child: Text(
  61. "OK",
  62. style: TextStyle(
  63. fontSize: 18.0,
  64. color: ColorHelpers.blackOrWhiteContrastColor(color),
  65. ),
  66. ),
  67. ),
  68. ),
  69. ),
  70. ],
  71. ),
  72. );
  73. }
  74. }