privacy_agreement_dialog.dart 6.5 KB

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