member_agreement_dialog.dart 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  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 MemberAgreementDialog {
  12. static const String tag = 'MemberAgreementDialog';
  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. margin: EdgeInsets.symmetric(horizontal: 31.w),
  26. decoration: ShapeDecoration(
  27. color: Colors.white,
  28. shape: RoundedRectangleBorder(
  29. borderRadius: BorderRadius.circular(20.r),
  30. ),
  31. ),
  32. child: Stack(
  33. children: [
  34. Container(
  35. padding: EdgeInsets.symmetric(
  36. horizontal: 16.w,
  37. vertical: 24.h,
  38. ),
  39. child: Column(
  40. mainAxisSize: MainAxisSize.min,
  41. crossAxisAlignment: CrossAxisAlignment.center,
  42. mainAxisAlignment: MainAxisAlignment.center,
  43. children: [
  44. Text(
  45. StringName.memberAgreementDialogTitle,
  46. style: Styles.getTextStyleBlack204W500(16.sp),
  47. ),
  48. SizedBox(height: 16.h),
  49. Text.rich(
  50. TextSpan(
  51. children: [
  52. TextSpan(
  53. text: StringName.memberAgreementDialogDesc,
  54. style: TextStyle(
  55. color: Colors.black.withAlpha(153),
  56. fontSize: 14.sp,
  57. fontWeight: FontWeight.w400,
  58. ),
  59. ),
  60. ClickTextSpan(
  61. fontSize: 14.sp,
  62. text: StringName.textSpanPrivacyPolicy,
  63. url: WebUrl.privacyPolicy,
  64. ),
  65. ClickTextSpan(
  66. fontSize: 14.sp,
  67. text:
  68. StringName.textSpanServiceTerms,
  69. url: WebUrl.serviceAgreement,
  70. ),
  71. TextSpan(
  72. text: StringName.textSpanAnd,
  73. style: TextStyle(
  74. color: Colors.black.withAlpha(153),
  75. fontSize: 14.sp,
  76. fontWeight: FontWeight.w400,
  77. ),
  78. ),
  79. ClickTextSpan( fontSize: 14.sp,text: StringName.textSpanMembershipAgreement, url: WebUrl.memberServiceAgreement),
  80. TextSpan(
  81. text: "。",
  82. style: TextStyle(
  83. color: Colors.black.withAlpha(153),
  84. fontSize: 14.sp,
  85. fontWeight: FontWeight.w400,
  86. ),
  87. ),
  88. ],
  89. ),
  90. ),
  91. SizedBox(height: 20.h),
  92. Row(
  93. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  94. children: [
  95. GestureDetector(
  96. onTap: () {
  97. if (btnCancel != null) {
  98. btnCancel();
  99. }
  100. SmartDialog.dismiss();
  101. },
  102. child: Container(
  103. height: 40.h,
  104. width: 128.w,
  105. alignment: Alignment.center,
  106. decoration: ShapeDecoration(
  107. color: const Color(0xFFF5F4F9),
  108. shape: RoundedRectangleBorder(
  109. borderRadius: BorderRadius.circular(50.r),
  110. ),
  111. ),
  112. child: Text(
  113. StringName.memberAgreementDialogCancel,
  114. style: Styles.getTextStyleBlack204W500(16.sp),
  115. ),
  116. ),
  117. ),
  118. GestureDetector(
  119. onTap: () {
  120. if (btnConfirm != null) {
  121. btnConfirm();
  122. }
  123. SmartDialog.dismiss(tag: tag);
  124. },
  125. child: Container(
  126. height: 40.h,
  127. width: 128.r,
  128. alignment: Alignment.center,
  129. decoration: Styles.getActivateButtonDecoration(
  130. 22.r,
  131. ),
  132. child: Text(
  133. StringName.memberAgreementDialogConfirm,
  134. style: Styles.getTextStyleWhiteW500(16.sp),
  135. ),
  136. ),
  137. ),
  138. ],
  139. ),
  140. ],
  141. ),
  142. ),
  143. Positioned(
  144. right: 14.w,
  145. top: 14.h,
  146. child: GestureDetector(
  147. onTap: () {
  148. SmartDialog.dismiss();
  149. },
  150. child: Assets.images.iconCustomDialogClose.image(
  151. width: 24.w,
  152. height: 24.h,
  153. ),
  154. ),
  155. ),
  156. ],
  157. ),
  158. ),
  159. ],
  160. );
  161. },
  162. );
  163. }
  164. }