member_agreement_dialog.dart 6.8 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. TextSpan(
  66. text: StringName.textSpanAnd,
  67. style: TextStyle(
  68. color: Colors.black.withAlpha(153),
  69. fontSize: 14.sp,
  70. fontWeight: FontWeight.w400,
  71. ),
  72. ),
  73. ClickTextSpan(
  74. fontSize: 14.sp,
  75. text:
  76. StringName.textSpanServiceTerms,
  77. url: WebUrl.serviceAgreement,
  78. ),
  79. TextSpan(
  80. text: "。",
  81. style: TextStyle(
  82. color: Colors.black.withAlpha(153),
  83. fontSize: 14.sp,
  84. fontWeight: FontWeight.w400,
  85. ),
  86. ),
  87. ],
  88. ),
  89. ),
  90. SizedBox(height: 20.h),
  91. Row(
  92. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  93. children: [
  94. GestureDetector(
  95. onTap: () {
  96. if (btnCancel != null) {
  97. btnCancel();
  98. }
  99. SmartDialog.dismiss();
  100. },
  101. child: Container(
  102. height: 40.h,
  103. width: 128.w,
  104. alignment: Alignment.center,
  105. decoration: ShapeDecoration(
  106. color: const Color(0xFFF5F4F9),
  107. shape: RoundedRectangleBorder(
  108. borderRadius: BorderRadius.circular(50.r),
  109. ),
  110. ),
  111. child: Text(
  112. StringName.memberAgreementDialogCancel,
  113. style: Styles.getTextStyleBlack204W500(16.sp),
  114. ),
  115. ),
  116. ),
  117. GestureDetector(
  118. onTap: () {
  119. if (btnConfirm != null) {
  120. btnConfirm();
  121. }
  122. SmartDialog.dismiss(tag: tag);
  123. },
  124. child: Container(
  125. height: 40.h,
  126. width: 128.r,
  127. alignment: Alignment.center,
  128. decoration: Styles.getActivateButtonDecoration(
  129. 22.r,
  130. ),
  131. child: Text(
  132. StringName.memberAgreementDialogConfirm,
  133. style: Styles.getTextStyleWhiteW500(16.sp),
  134. ),
  135. ),
  136. ),
  137. ],
  138. ),
  139. ],
  140. ),
  141. ),
  142. Positioned(
  143. right: 14.w,
  144. top: 14.h,
  145. child: GestureDetector(
  146. onTap: () {
  147. SmartDialog.dismiss();
  148. },
  149. child: Assets.images.iconCustomDialogClose.image(
  150. width: 24.w,
  151. height: 24.h,
  152. ),
  153. ),
  154. ),
  155. ],
  156. ),
  157. ),
  158. ],
  159. );
  160. },
  161. );
  162. }
  163. }