pay_result.dart 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. import 'package:fast/constants.dart';
  2. import 'package:fast/utils/size_fit.dart';
  3. import 'package:flutter/material.dart';
  4. import 'package:get/get.dart';
  5. import 'component/navi_bar.dart';
  6. class PayResult extends StatefulWidget {
  7. bool success;
  8. PayResult({Key? key, required this.success}) : super(key: key);
  9. @override
  10. State<PayResult> createState() => _PayResultState();
  11. }
  12. class _PayResultState extends State<PayResult> {
  13. void tapDone() {
  14. if (widget.success) {
  15. Get.close(2);
  16. } else {
  17. Get.back();
  18. }
  19. }
  20. @override
  21. Widget build(BuildContext context) {
  22. SizeFit.initialize(context);
  23. return Material(
  24. color: kBgColor,
  25. child: Column(
  26. children: [
  27. NaviBar(
  28. title: '充值',
  29. closeCallback: () {
  30. Get.back();
  31. }),
  32. SizedBox(
  33. height: 64.px,
  34. ),
  35. Image.asset(
  36. widget.success
  37. ? 'assets/images/pay_success.png'
  38. : 'assets/images/pay_fail.png',
  39. width: 96.px,
  40. height: 96.px,
  41. ),
  42. SizedBox(
  43. height: 20.px,
  44. ),
  45. Text(
  46. widget.success ? '充值成功' : '充值失败',
  47. style: TextStyle(
  48. color: Colors.white,
  49. fontSize: 24.px,
  50. fontWeight: FontWeight.bold),
  51. ),
  52. SizedBox(
  53. height: 64.px,
  54. ),
  55. GestureDetector(
  56. onTap: () {
  57. tapDone();
  58. },
  59. child: Container(
  60. alignment: Alignment.center,
  61. width: 160.px,
  62. height: 48.px,
  63. decoration: BoxDecoration(
  64. border: Border.all(color: kThemeColor, width: 2.px),
  65. borderRadius: BorderRadius.all(Radius.circular(24.px))),
  66. child: Text(
  67. widget.success ? '完成' : '返回重试',
  68. style: TextStyle(
  69. color: kThemeColor,
  70. fontWeight: FontWeight.bold,
  71. fontSize: 16.px),
  72. ),
  73. ),
  74. )
  75. ],
  76. ),
  77. );
  78. }
  79. }