payment_success_dialog.dart 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter_screenutil/flutter_screenutil.dart';
  3. import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
  4. import 'package:keyboard/data/repository/account_repository.dart';
  5. import 'package:keyboard/resource/string.gen.dart';
  6. import '../data/bean/goods_info.dart';
  7. import '../resource/assets.gen.dart';
  8. import '../resource/colors.gen.dart';
  9. import '../utils/date_util.dart';
  10. import '../utils/styles.dart';
  11. import 'package:get/get.dart';
  12. // 支付成功
  13. class PaymentSuccessDialog {
  14. static const String tag = 'PaymentSuccessDialog';
  15. static void show({
  16. required Function? btnConfirm,
  17. required GoodsInfo goodsInfo,
  18. }) {
  19. SmartDialog.show(
  20. tag: tag,
  21. backType: SmartBackType.block,
  22. clickMaskDismiss: true,
  23. maskColor: ColorName.black70,
  24. builder: (_) {
  25. return Column(
  26. crossAxisAlignment: CrossAxisAlignment.center,
  27. mainAxisAlignment: MainAxisAlignment.center,
  28. children: [
  29. Container(
  30. width: double.infinity,
  31. margin: EdgeInsets.symmetric(horizontal: 31.w),
  32. decoration: ShapeDecoration(
  33. color: Colors.white,
  34. shape: RoundedRectangleBorder(
  35. borderRadius: BorderRadius.circular(20.r),
  36. ),
  37. ),
  38. child: Stack(
  39. children: [
  40. Container(
  41. width: double.infinity,
  42. padding: EdgeInsets.symmetric(
  43. horizontal: 16.w,
  44. vertical: 16.h,
  45. ),
  46. child: Column(
  47. mainAxisSize: MainAxisSize.min,
  48. crossAxisAlignment: CrossAxisAlignment.center,
  49. mainAxisAlignment: MainAxisAlignment.center,
  50. children: [
  51. Assets.images.iconDialogPaySuccess.image(
  52. width: 88.w,
  53. height: 88.h,
  54. ),
  55. SizedBox(height: 8.h),
  56. Text(
  57. StringName.paySuccessDialogTitle,
  58. style: Styles.getTextStyleBlack204W500(16.sp),
  59. ),
  60. Obx(() {
  61. return Text(
  62. AccountRepository.getInstance()
  63. .memberStatusInfo
  64. .value
  65. ?.permanent ==
  66. true
  67. ? StringName.paySuccessDialogPermanent
  68. : "${goodsInfo.name}${DateUtil.fromMillisecondsSinceEpoch('yyyy年MM月dd日', AccountRepository.getInstance().memberStatusInfo.value?.endTimestamp ?? 0)}${StringName.paySuccessDialogDesc}",
  69. style: Styles.getTextStyleBlack153W400(14.sp),
  70. );
  71. }),
  72. SizedBox(height: 24.h),
  73. SizedBox(
  74. width: double.infinity,
  75. child: GestureDetector(
  76. onTap: () {
  77. SmartDialog.dismiss();
  78. btnConfirm?.call();
  79. },
  80. child: Container(
  81. height: 40.h,
  82. decoration: Styles.getActivateButtonDecoration(
  83. 22.r,
  84. ),
  85. child: Center(
  86. child: Text(
  87. StringName.paySuccessDialogConfirm,
  88. style: Styles.getTextStyleWhiteW500(16.sp),
  89. ),
  90. ),
  91. ),
  92. ),
  93. ),
  94. ],
  95. ),
  96. ),
  97. Positioned(
  98. right: 14.w,
  99. top: 14.h,
  100. child: GestureDetector(
  101. onTap: () {
  102. SmartDialog.dismiss();
  103. btnConfirm?.call();
  104. },
  105. child: Assets.images.iconCustomDialogClose.image(
  106. width: 24.w,
  107. height: 24.h,
  108. ),
  109. ),
  110. ),
  111. ],
  112. ),
  113. ),
  114. ],
  115. );
  116. },
  117. );
  118. }
  119. }