payment_success_dialog.dart 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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/resource/string.gen.dart';
  5. import '../data/consts/web_url.dart';
  6. import '../resource/assets.gen.dart';
  7. import '../resource/colors.gen.dart';
  8. import '../utils/styles.dart';
  9. import '../widget/click_text_span.dart';
  10. // 支付成功弹窗
  11. class PaymentSuccessDialog {
  12. static const String tag = 'PaymentSuccessDialog';
  13. static void show({Function? btnCancel, Function? btnConfirm}) {
  14. SmartDialog.show(
  15. tag: tag,
  16. backType: SmartBackType.block,
  17. clickMaskDismiss: true,
  18. maskColor: ColorName.black70,
  19. builder: (_) {
  20. return Column(
  21. crossAxisAlignment: CrossAxisAlignment.center,
  22. mainAxisAlignment: MainAxisAlignment.center,
  23. children: [
  24. Container(
  25. width: double.infinity,
  26. margin: EdgeInsets.symmetric(horizontal: 31.w),
  27. decoration: ShapeDecoration(
  28. color: Colors.white,
  29. shape: RoundedRectangleBorder(
  30. borderRadius: BorderRadius.circular(20.r),
  31. ),
  32. ),
  33. child: Stack(
  34. children: [
  35. Container(
  36. padding: EdgeInsets.symmetric(
  37. horizontal: 16.w,
  38. vertical: 24.h,
  39. ),
  40. child: Column(
  41. mainAxisSize: MainAxisSize.min,
  42. crossAxisAlignment: CrossAxisAlignment.center,
  43. mainAxisAlignment: MainAxisAlignment.center,
  44. children: [
  45. Text(
  46. StringName.memberAgreementDialogTitle,
  47. style: Styles.getTextStyleBlack204W500(16.sp),
  48. ),
  49. SizedBox(height: 16.h),
  50. Text.rich(
  51. TextSpan(
  52. children: [
  53. TextSpan(
  54. text: StringName.memberAgreementDialogDesc,
  55. style: TextStyle(
  56. color: Colors.black.withAlpha(153),
  57. fontSize: 14.sp,
  58. fontWeight: FontWeight.w400,
  59. ),
  60. ),
  61. ClickTextSpan(
  62. fontSize: 14.sp,
  63. text: StringName.memberAgreementDialogAgreement,
  64. url: WebUrl.privacyPolicy,
  65. ),
  66. TextSpan(
  67. text: StringName.textSpanAnd,
  68. style: TextStyle(
  69. color: Colors.black.withAlpha(153),
  70. fontSize: 14.sp,
  71. fontWeight: FontWeight.w400,
  72. ),
  73. ),
  74. ClickTextSpan(
  75. fontSize: 14.sp,
  76. text:
  77. StringName.memberAgreementDialogAutoRenewal,
  78. url: WebUrl.serviceAgreement,
  79. ),
  80. ],
  81. ),
  82. ),
  83. SizedBox(height: 20.h),
  84. Row(
  85. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  86. children: [
  87. GestureDetector(
  88. onTap: () {
  89. if (btnCancel != null) {
  90. btnCancel();
  91. }
  92. SmartDialog.dismiss();
  93. },
  94. child: Container(
  95. height: 48.h,
  96. alignment: Alignment.center,
  97. decoration: ShapeDecoration(
  98. color: const Color(0xFFF5F4F9),
  99. shape: RoundedRectangleBorder(
  100. borderRadius: BorderRadius.circular(31.r),
  101. ),
  102. ),
  103. child: Text(
  104. StringName.memberAgreementDialogCancel,
  105. style: Styles.getTextStyleBlack204W500(16.sp),
  106. ),
  107. ),
  108. ),
  109. SizedBox(width: 16.w),
  110. GestureDetector(
  111. onTap: () {
  112. if (btnConfirm != null) {
  113. btnConfirm();
  114. }
  115. SmartDialog.dismiss(tag: tag);
  116. },
  117. child: Container(
  118. height: 48.h,
  119. alignment: Alignment.center,
  120. decoration: Styles.getActivateButtonDecoration(
  121. 20.r,
  122. ),
  123. child: Text(
  124. StringName.memberAgreementDialogConfirm,
  125. style: Styles.getTextStyleWhiteW500(16.sp),
  126. ),
  127. ),
  128. ),
  129. ],
  130. ),
  131. ],
  132. ),
  133. ),
  134. Positioned(
  135. right: 14.w,
  136. top: 14.h,
  137. child: GestureDetector(
  138. onTap: () {
  139. SmartDialog.dismiss();
  140. },
  141. child: Assets.images.iconCustomDialogClose.image(
  142. width: 24.w,
  143. height: 24.h,
  144. ),
  145. ),
  146. ),
  147. ],
  148. ),
  149. ),
  150. ],
  151. );
  152. },
  153. );
  154. }
  155. }