mine_expiration_reminder_dialog.dart 14 KB

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