mine_expiration_reminder_dialog.dart 14 KB

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