mine_expiration_reminder_dialog.dart 14 KB

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