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.memberAgreementDialogAgreement,
  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.memberAgreementDialogAutoRenewal,
  77. url: WebUrl.serviceAgreement,
  78. ),
  79. ],
  80. ),
  81. ),
  82. SizedBox(height: 20.h),
  83. Row(
  84. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  85. children: [
  86. GestureDetector(
  87. onTap: () {
  88. if (btnCancel != null) {
  89. btnCancel();
  90. }
  91. SmartDialog.dismiss();
  92. },
  93. child: Container(
  94. height: 40.h,
  95. width: 128.w,
  96. alignment: Alignment.center,
  97. decoration: ShapeDecoration(
  98. color: const Color(0xFFF5F4F9),
  99. shape: RoundedRectangleBorder(
  100. borderRadius: BorderRadius.circular(50.r),
  101. ),
  102. ),
  103. child: Text(
  104. StringName.memberAgreementDialogCancel,
  105. style: Styles.getTextStyleBlack204W500(16.sp),
  106. ),
  107. ),
  108. ),
  109. GestureDetector(
  110. onTap: () {
  111. if (btnConfirm != null) {
  112. btnConfirm();
  113. }
  114. SmartDialog.dismiss(tag: tag);
  115. },
  116. child: Container(
  117. height: 40.h,
  118. width: 128.r,
  119. alignment: Alignment.center,
  120. decoration: ShapeDecoration(
  121. shape: RoundedRectangleBorder(
  122. borderRadius: BorderRadius.circular(50.r),
  123. ),
  124. gradient: LinearGradient(
  125. begin: Alignment.topCenter,
  126. end: Alignment.centerRight,
  127. colors: [
  128. const Color(0xFF7D46FC),
  129. const Color(0xFFBC87FF),
  130. ],
  131. ),
  132. ),
  133. child: Text(
  134. StringName.memberAgreementDialogConfirm,
  135. style: Styles.getTextStyleWhiteW500(16.sp),
  136. ),
  137. ),
  138. ),
  139. ],
  140. ),
  141. ],
  142. ),
  143. ),
  144. Positioned(
  145. right: 14.w,
  146. top: 14.h,
  147. child: GestureDetector(
  148. onTap: () {
  149. SmartDialog.dismiss();
  150. },
  151. child: Assets.images.iconCustomDialogClose.image(
  152. width: 24.w,
  153. height: 24.h,
  154. ),
  155. ),
  156. ),
  157. ],
  158. ),
  159. ),
  160. ],
  161. );
  162. },
  163. );
  164. }
  165. }