mine_expiration_reminder_dialog.dart 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389
  1. import 'dart:ui';
  2. import 'package:flutter/cupertino.dart';
  3. import 'package:flutter/material.dart';
  4. import 'package:flutter_screenutil/flutter_screenutil.dart';
  5. import 'package:get/get.dart';
  6. import 'package:get/get_core/src/get_main.dart';
  7. import 'package:location/utils/common_expand.dart';
  8. import '../../data/api/response/member_trial_info_response.dart';
  9. import '../../resource/assets.gen.dart';
  10. import '../../resource/colors.gen.dart';
  11. import '../../resource/string.gen.dart';
  12. class MineExpirationReminderDialog {
  13. static void show({
  14. required MemberTrialInfoResponse infoResponse,
  15. VoidCallback? cancelOnTap,
  16. VoidCallback? onDic,}) {
  17. Get.dialog(
  18. SimpleDialog(
  19. //title: Text('提示'),
  20. titlePadding: EdgeInsets.zero,
  21. contentPadding: EdgeInsets.zero,
  22. insetPadding: EdgeInsets.zero,
  23. backgroundColor:Colors.transparent,
  24. children: [
  25. MineExpirationReminderTipView(
  26. infoResponse: infoResponse,
  27. cancelOnTap: () {
  28. Get.back();
  29. },
  30. confirmOnTap: onDic)
  31. ],
  32. )
  33. );
  34. }
  35. }
  36. class MineExpirationReminderTipView extends StatefulWidget {
  37. final MemberTrialInfoResponse infoResponse;
  38. final VoidCallback? cancelOnTap;
  39. final VoidCallback? confirmOnTap;
  40. const MineExpirationReminderTipView({
  41. super.key,
  42. required this.infoResponse,
  43. this.cancelOnTap,
  44. required this.confirmOnTap,
  45. });
  46. @override
  47. State<MineExpirationReminderTipView> createState() => _MineExpirationReminderTipViewState();
  48. }
  49. class _MineExpirationReminderTipViewState extends State<MineExpirationReminderTipView> {
  50. @override
  51. Widget build(BuildContext context) {
  52. return Container(
  53. width: 1.sw,
  54. padding: EdgeInsets.only(left: 36.w,right: 36.w,bottom: 16.w),
  55. decoration: BoxDecoration(
  56. color: Colors.transparent,
  57. //borderRadius: BorderRadius.circular(16.w),
  58. image: DecorationImage(
  59. image: Assets.images.iconMineTrialExpirationBg.provider(),
  60. fit: BoxFit.fill,
  61. )
  62. ),
  63. child: IntrinsicHeight(
  64. child: Column(
  65. mainAxisAlignment: MainAxisAlignment.start,
  66. children: [
  67. SizedBox(height: 54.1.w + 40.w,),
  68. Container(
  69. alignment: Alignment.centerLeft,
  70. child: Text("您的安全防护已暂停!",
  71. style: TextStyle(
  72. fontSize: 19.sp,
  73. color: '#5E60FE'.color,
  74. fontWeight: FontWeight.bold)
  75. ),
  76. ),
  77. SizedBox(height: 9.w,),
  78. Row(
  79. children: [
  80. Assets.images.iconMineTrialExpirationHeader.image(width: 52.w,height: 52.w),
  81. SizedBox(width: 6.w,),
  82. Column(
  83. mainAxisAlignment: MainAxisAlignment.start,
  84. crossAxisAlignment: CrossAxisAlignment.start,
  85. children: [
  86. RichText(
  87. text: TextSpan(
  88. text: '您已守护了Ta ',
  89. style: TextStyle(
  90. fontSize: 10.sp,
  91. color: Color(0xFF5E60FE),
  92. fontWeight: FontWeight.w400,
  93. ),
  94. children: [
  95. TextSpan(
  96. text: '${widget.infoResponse.watchTimes}',
  97. style: TextStyle(
  98. fontSize: 13.sp, // 加大字号
  99. color: "#7B7DFF".color, // 红色
  100. fontWeight: FontWeight.bold, // 加粗强调
  101. ),
  102. ),
  103. TextSpan(
  104. text: ' 次,',
  105. style: TextStyle(
  106. fontSize: 10.sp,
  107. color: Color(0xFF5E60FE),
  108. fontWeight: FontWeight.w400,
  109. ),
  110. ),
  111. ],
  112. ),
  113. ),
  114. RichText(
  115. text: TextSpan(
  116. text: '并且有 ',
  117. style: TextStyle(
  118. fontSize: 10.sp,
  119. color: Color(0xFF5E60FE),
  120. fontWeight: FontWeight.w400,
  121. ),
  122. children: [
  123. TextSpan(
  124. text: '${widget.infoResponse.trackCount}',
  125. style: TextStyle(
  126. fontSize: 13.sp, // 加大字号
  127. color: "#7B7DFF".color, // 红色
  128. fontWeight: FontWeight.bold, // 加粗强调
  129. ),
  130. ),
  131. TextSpan(
  132. text: ' 条重要轨迹即将消失。',
  133. style: TextStyle(
  134. fontSize: 10.sp,
  135. color: Color(0xFF5E60FE),
  136. fontWeight: FontWeight.w400,
  137. ),
  138. ),
  139. ],
  140. ),
  141. ),
  142. ],
  143. )
  144. ],
  145. ),
  146. SizedBox(height: 17.w,),
  147. Stack(
  148. children: [
  149. Row(
  150. mainAxisAlignment: MainAxisAlignment.center,
  151. children: [
  152. Expanded(
  153. child: _regularMember(),
  154. ),
  155. SizedBox(width: 8.w,),
  156. Expanded(
  157. child: _memberUsers()
  158. )
  159. ],
  160. ),
  161. Positioned(
  162. width: 56.w,
  163. height: 74.w,
  164. bottom: 0,
  165. left: (MediaQuery.of(Get.context!).size.width - 36.w * 2.0) / 2.0 - 36.w + 4.w,
  166. child: Assets.images.iconMineTrialExpirationUp.image(width: 56.w,height: 75.w)
  167. )
  168. ],
  169. ),
  170. SizedBox(height: 16.w,),
  171. GestureDetector(
  172. onTap: () {
  173. Get.back();
  174. widget.confirmOnTap!();
  175. },
  176. child: Container(
  177. decoration: BoxDecoration(
  178. gradient: LinearGradient(
  179. begin: Alignment.centerLeft, // 90度相当于从左到右
  180. end: Alignment.centerRight,
  181. colors: [
  182. Color(0xFF7B7DFF), // #7B7DFF
  183. Color(0xFF6365FF), // #6365FF
  184. ],
  185. stops: [0.0, 1.0],
  186. // 从0%到100%
  187. ),
  188. borderRadius: BorderRadius.circular(43.w / 2.0),
  189. ),
  190. height: 43.w,
  191. alignment: Alignment.center,
  192. child: Text(StringName.memberVipRenew,
  193. style: TextStyle(
  194. fontSize: 14.sp,
  195. color: '#FFFFFF'.color,
  196. fontWeight: FontWeight.w500)
  197. ),
  198. ),
  199. ),
  200. SizedBox(
  201. height: 12.w,
  202. ),
  203. GestureDetector(
  204. onTap: widget.cancelOnTap,
  205. child: Container(
  206. height: 20.w,
  207. child: Text("下次再说",
  208. style: TextStyle(
  209. fontSize: 14.sp,
  210. color: '#898996'.color,
  211. fontWeight: FontWeight.w500)
  212. ),
  213. ),
  214. ),
  215. ],
  216. ),
  217. ),
  218. );
  219. }
  220. //普通会员
  221. Widget _regularMember() {
  222. return Container(
  223. padding: EdgeInsets.only(top: 16.w,bottom: 32.w),
  224. decoration: BoxDecoration(
  225. gradient: LinearGradient(
  226. begin: Alignment.bottomCenter, // 0deg相当于从底部开始
  227. end: Alignment.topCenter,
  228. colors: [
  229. Color(0xFFFFFFFF), // #FFF
  230. Color(0xFFE9E9FF), // #E9E9FF
  231. ],
  232. stops: [0.6629, 0.9994],
  233. ),
  234. border: Border.all(
  235. color: Color(0xFFFFFFFF), // #FFF
  236. width: 1.5,
  237. ),
  238. borderRadius: BorderRadius.circular(14.w),
  239. ),
  240. child: Column(
  241. crossAxisAlignment: CrossAxisAlignment.center,
  242. children: [
  243. Text("普通会员",
  244. style: TextStyle(
  245. fontSize: 11.sp,
  246. color: "#333333".color,
  247. fontWeight: FontWeight.w500)
  248. ),
  249. SizedBox(height: 12.w,),
  250. _memberUntiItem(Assets.images.iconMineTrialExpirationHave.image(width: 12.w,height: 12.w), "实时定位", "15分钟试用"),
  251. SizedBox(height: 4.w,),
  252. _memberUntiItem(Assets.images.iconMineTrialExpirationQuestion.image(width: 12.w,height: 12.w), "轨迹回溯", "--",isStop: true),
  253. SizedBox(height: 4.w,),
  254. _memberUntiItem(Assets.images.iconMineTrialExpirationQuestion.image(width: 12.w,height: 12.w), "紧急警报", "--",isStop: true),
  255. SizedBox(height: 4.w,),
  256. _memberUntiItem(Assets.images.iconMineTrialExpirationHave.image(width: 12.w,height: 12.w), "专属客服通道", "普通通道"),
  257. ],
  258. ),
  259. );
  260. }
  261. //会员用户
  262. Widget _memberUsers() {
  263. return Container(
  264. padding: EdgeInsets.only(top: 12.w,bottom: 0),
  265. decoration: BoxDecoration(
  266. gradient: LinearGradient(
  267. begin: Alignment.topCenter, // 180度相当于从上到下
  268. end: Alignment.bottomCenter,
  269. colors: [
  270. Color(0xFFFFE1C5), // #FFE1C5
  271. Color(0xFFFFFFFF), // #FFF
  272. ],
  273. stops: [0.0, 0.3676], // 对应0%和36.76%的位置
  274. ),
  275. border: Border.all(
  276. color: Color(0xFFFFFFFF), // #FFF
  277. width: 1.5, // 描边宽度1.5px
  278. ),
  279. borderRadius: BorderRadius.circular(14.w), // 可根据需要设置圆角
  280. ),
  281. child: Column(
  282. crossAxisAlignment: CrossAxisAlignment.center,
  283. children: [
  284. Row(
  285. mainAxisAlignment: MainAxisAlignment.center,
  286. children: [
  287. Text("会员用户",
  288. style: TextStyle(
  289. fontSize: 11.sp,
  290. color: "#333333".color,
  291. fontWeight: FontWeight.w500)
  292. ),
  293. SizedBox(width: 2.w,),
  294. Assets.images.iconMineTrialExpirationRecommend.image(width: 15.w,height: 15.w)
  295. ],
  296. ),
  297. SizedBox(height: 12.w,),
  298. _memberUntiItem(Assets.images.iconMineTrialExpirationHave.image(width: 12.w,height: 12.w), "实时定位", "无限使用"),
  299. SizedBox(height: 4.w,),
  300. _memberUntiItem(Assets.images.iconMineTrialExpirationHave.image(width: 12.w,height: 12.w), "轨迹回溯", "无限回溯"),
  301. SizedBox(height: 4.w,),
  302. _memberUntiItem(Assets.images.iconMineTrialExpirationHave.image(width: 12.w,height: 12.w), "紧急警报", "安全自动预警"),
  303. SizedBox(height: 4.w,),
  304. _memberUntiItem(Assets.images.iconMineTrialExpirationHave.image(width: 12.w,height: 12.w), "专属客服通道", "1V1专属通道"),
  305. Container(
  306. alignment: Alignment.topRight,
  307. child: Assets.images.iconMineTrialExpirationVip.image(width: 45.w,height: 35.w),
  308. )
  309. ],
  310. ),
  311. );
  312. }
  313. //通用item
  314. Widget _memberUntiItem(Image image,String title,String descrip,{bool? isStop = false}) {
  315. return Container(
  316. height: 36.5.w,
  317. padding: EdgeInsets.only(left: 26.w),
  318. child: Row(
  319. crossAxisAlignment: CrossAxisAlignment.center,
  320. children: [
  321. Container(
  322. padding: EdgeInsets.only(top: 5.w),
  323. child: Column(
  324. mainAxisAlignment: MainAxisAlignment.center,
  325. children: [
  326. Row(children: [
  327. image,
  328. SizedBox(width: 9.5.w,),
  329. Text(title,
  330. style: TextStyle(
  331. fontSize: 11.sp,
  332. color: '#333333'.color,
  333. fontWeight: FontWeight.w500)
  334. ),
  335. ],),
  336. SizedBox(width: 4.w,),
  337. Row(
  338. mainAxisAlignment: MainAxisAlignment.start,
  339. children: [
  340. SizedBox(width: 21.5,),
  341. Text(descrip,
  342. textAlign: TextAlign.left,
  343. style: TextStyle(
  344. fontSize: 9.sp,
  345. color: '#898996'.color,
  346. fontWeight: FontWeight.w400)
  347. )
  348. ],
  349. ),
  350. ],
  351. ),
  352. ),
  353. SizedBox(width: 1.w,),
  354. Container(
  355. padding: EdgeInsets.symmetric(vertical: 0),
  356. alignment: Alignment.topCenter,
  357. child: Visibility(
  358. visible: isStop ?? false,
  359. child: Container(
  360. padding: EdgeInsets.symmetric(horizontal: 4.w,vertical: 1.5.w),
  361. decoration: BoxDecoration(
  362. image: DecorationImage(image: Assets.images.iconMineTrialExpirationPauseBg.provider())
  363. ),
  364. child: Text("暂停服务",
  365. style: TextStyle(
  366. fontSize: 8.sp,
  367. color: ColorName.white,
  368. fontWeight: FontWeight.w400)
  369. ),
  370. ),
  371. ),
  372. )
  373. ],
  374. )
  375. );
  376. }
  377. }