privacy_dialog.dart 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  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.block,
  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),
  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. Expanded(
  50. child: Column(
  51. crossAxisAlignment: CrossAxisAlignment.center,
  52. mainAxisAlignment: MainAxisAlignment.center,
  53. children: [
  54. SizedBox(
  55. width: 245.w,
  56. child: Text(
  57. 'Clean up your iphone and free up storage',
  58. textAlign: TextAlign.center,
  59. style: TextStyle(
  60. color: Colors.white,
  61. fontSize: 24.sp,
  62. fontWeight: FontWeight.w500,
  63. height: 1.25.h,
  64. ),
  65. ),
  66. ),
  67. SizedBox(
  68. child: Lottie.asset(
  69. Assets.anim.animPrivacy,
  70. height: 412.h,
  71. repeat: true,
  72. ),
  73. ),
  74. SizedBox(
  75. height: 8,
  76. ),
  77. Text(
  78. 'CleanPro values your privacy. By starting, you agree to ',
  79. style: TextStyle(
  80. color: Colors.white.withValues(alpha: 0.8),
  81. fontSize: 12.sp,
  82. fontWeight: FontWeight.w400,
  83. height: 1.50.h,
  84. ),
  85. ),
  86. Text.rich(
  87. TextSpan(
  88. children: [
  89. TextSpan(
  90. text: 'our ',
  91. style: TextStyle(
  92. color: Colors.white.withValues(alpha: 0.8),
  93. fontSize: 12.sp,
  94. fontWeight: FontWeight.w400,
  95. height: 2.50.h,
  96. ),
  97. ),
  98. buildLinkText(
  99. 'Privacy Policy', Constants.privacyPolicy),
  100. TextSpan(
  101. text: ' and ',
  102. style: TextStyle(
  103. color: Colors.white.withValues(alpha: 0.8),
  104. fontSize: 12.sp,
  105. fontWeight: FontWeight.w400,
  106. height: 2.50.h,
  107. ),
  108. ),
  109. buildLinkText('Terms of Service',
  110. Constants.userAgreement),
  111. TextSpan(
  112. text: '.',
  113. style: TextStyle(
  114. color: Colors.white,
  115. fontSize: 12.sp,
  116. fontWeight: FontWeight.w400,
  117. height: 2.50.h,
  118. ),
  119. ),
  120. ],
  121. ),
  122. ),
  123. Spacer(),
  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. ),
  155. ),
  156. IgnorePointer(
  157. child: Assets.images.bgPhotoSelectedPreviewFinish.image(
  158. width: 360.w,
  159. ),
  160. ),
  161. ],
  162. ),
  163. );
  164. });
  165. }
  166. TextSpan buildLinkText(String text, String url) {
  167. return TextSpan(
  168. text: text,
  169. style: TextStyle(
  170. color: Colors.white,
  171. decoration: TextDecoration.underline,
  172. decorationColor: Colors.white,
  173. fontSize: 12.sp,
  174. fontWeight: FontWeight.w400,
  175. height: 2.50.h,
  176. ),
  177. // 链接文字样式
  178. recognizer: TapGestureRecognizer()
  179. ..onTap = () {
  180. BrowserPage.start(url);
  181. },
  182. );
  183. }