privacy_dialog.dart 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. import 'package:clean/data/consts/constants.dart';
  2. import 'package:clean/module/browser/browser_view.dart';
  3. import 'package:clean/resource/assets.gen.dart';
  4. import 'package:clean/resource/colors.gen.dart';
  5. import 'package:flutter/Material.dart';
  6. import 'package:flutter/gestures.dart';
  7. import 'package:flutter_screenutil/flutter_screenutil.dart';
  8. import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
  9. import 'package:lottie/lottie.dart';
  10. void privacyDialog({required Function onAgree, required Function onDisagree}) {
  11. const tag = 'privacyDialog';
  12. SmartDialog.show(
  13. tag: tag,
  14. backType: SmartBackType.normal,
  15. clickMaskDismiss: false,
  16. maskColor: ColorName.black,
  17. builder: (_) {
  18. return Container(
  19. height: double.infinity,
  20. width: double.infinity,
  21. child: Stack(
  22. children: [
  23. SafeArea(
  24. child: Column(
  25. crossAxisAlignment: CrossAxisAlignment.start,
  26. children: [
  27. GestureDetector(
  28. onTap: () {
  29. onDisagree();
  30. SmartDialog.dismiss(tag: tag);
  31. },
  32. child: Container(
  33. margin: EdgeInsets.only(left: 16.w, top: 16.h),
  34. width: 28.w,
  35. height: 28.w,
  36. decoration: ShapeDecoration(
  37. color: Color(0xFF2A3E55),
  38. shape: RoundedRectangleBorder(
  39. borderRadius: BorderRadius.circular(86.r),
  40. ),
  41. image: DecorationImage(
  42. image: Assets.images.iconPrivateClose.provider(),
  43. ),
  44. ),
  45. )),
  46. SizedBox(
  47. height: 45.h,
  48. ),
  49. Column(
  50. crossAxisAlignment: CrossAxisAlignment.center,
  51. mainAxisAlignment: MainAxisAlignment.center,
  52. children: [
  53. SizedBox(
  54. width: 245.w,
  55. child: Text(
  56. 'Clean up your iphone and free up storage',
  57. textAlign: TextAlign.center,
  58. style: TextStyle(
  59. color: Colors.white,
  60. fontSize: 24.sp,
  61. fontWeight: FontWeight.w500,
  62. height: 1.25.h,
  63. ),
  64. ),
  65. ),
  66. // SizedBox(
  67. // child: Lottie.asset(
  68. // Assets.anim.animPrivacy,
  69. // height: 412.w,
  70. // repeat: true,
  71. // )),
  72. SizedBox(
  73. height: 8,
  74. ),
  75. Text(
  76. 'CleanPro values your privacy. By starting, you agree to ',
  77. style: TextStyle(
  78. color: Colors.white.withValues(alpha: 0.8),
  79. fontSize: 12.sp,
  80. fontWeight: FontWeight.w400,
  81. height: 1.50.h,
  82. ),
  83. ),
  84. Text.rich(
  85. TextSpan(
  86. children: [
  87. TextSpan(
  88. text: 'our ',
  89. style: TextStyle(
  90. color: Colors.white.withValues(alpha: 0.8),
  91. fontSize: 12.sp,
  92. fontWeight: FontWeight.w400,
  93. height: 2.50.h,
  94. ),
  95. ),
  96. buildLinkText(
  97. 'Privacy Policy', Constants.privacyPolicy),
  98. TextSpan(
  99. text: ' and ',
  100. style: TextStyle(
  101. color: Colors.white.withValues(alpha: 0.8),
  102. fontSize: 12.sp,
  103. fontWeight: FontWeight.w400,
  104. height: 2.50.h,
  105. ),
  106. ),
  107. buildLinkText(
  108. 'Terms of Service', Constants.userAgreement),
  109. TextSpan(
  110. text: '.',
  111. style: TextStyle(
  112. color: Colors.white,
  113. fontSize: 12.sp,
  114. fontWeight: FontWeight.w400,
  115. height: 2.50.h,
  116. ),
  117. ),
  118. ],
  119. ),
  120. ),
  121. SizedBox(
  122. height: 8.h,
  123. ),
  124. GestureDetector(
  125. onTap: () {
  126. onAgree();
  127. SmartDialog.dismiss(tag: tag);
  128. },
  129. child: Container(
  130. width: 316.w,
  131. height: 48.h,
  132. decoration: ShapeDecoration(
  133. color: Color(0xFF0279FB),
  134. shape: RoundedRectangleBorder(
  135. borderRadius: BorderRadius.circular(24.r),
  136. ),
  137. ),
  138. child: Center(
  139. child: Text(
  140. 'Start',
  141. style: TextStyle(
  142. color: Colors.white,
  143. fontSize: 16.sp,
  144. fontWeight: FontWeight.w500,
  145. ),
  146. ),
  147. ),
  148. )),
  149. ],
  150. ),
  151. ],
  152. ),
  153. ),
  154. IgnorePointer(
  155. child: Assets.images.bgPhotoSelectedPreviewFinish.image(
  156. width: 360.w,
  157. height: 335.h,
  158. ),
  159. ),
  160. ],
  161. ),
  162. );
  163. });
  164. }
  165. TextSpan buildLinkText(String text, String url) {
  166. return TextSpan(
  167. text: text,
  168. style: TextStyle(
  169. color: Colors.white,
  170. decoration: TextDecoration.underline,
  171. decorationColor: Colors.white,
  172. fontSize: 12.sp,
  173. fontWeight: FontWeight.w400,
  174. height: 2.50.h,
  175. ),
  176. // 链接文字样式
  177. recognizer: TapGestureRecognizer()
  178. ..onTap = () {
  179. BrowserPage.start(url);
  180. },
  181. );
  182. }