import 'dart:ui'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:get/get_core/src/get_main.dart'; import 'package:location/utils/common_expand.dart'; import 'package:retrofit/http.dart'; import '../../data/api/response/member_trial_info_response.dart'; import '../../resource/assets.gen.dart'; import '../../resource/colors.gen.dart'; import '../../resource/string.gen.dart'; class MineExpirationReminderDialog { static void show({ required MemberTrialInfoResponse infoResponse, VoidCallback? cancelOnTap, VoidCallback? onDic,}) { Get.dialog( SimpleDialog( //title: Text('提示'), titlePadding: EdgeInsets.zero, contentPadding: EdgeInsets.zero, insetPadding: EdgeInsets.zero, backgroundColor:Colors.transparent, children: [ MineExpirationReminderTipView( infoResponse: infoResponse, cancelOnTap: () { Get.back(); }, confirmOnTap: onDic) ], ) ); } } class MineExpirationReminderTipView extends StatefulWidget { final MemberTrialInfoResponse infoResponse; final VoidCallback? cancelOnTap; final VoidCallback? confirmOnTap; const MineExpirationReminderTipView({ super.key, required this.infoResponse, this.cancelOnTap, required this.confirmOnTap, }); @override State createState() => _MineExpirationReminderTipViewState(); } class _MineExpirationReminderTipViewState extends State { @override Widget build(BuildContext context) { return Container( width: 1.sw, padding: EdgeInsets.only(left: 36.w,right: 36.w,bottom: 16.w), decoration: BoxDecoration( color: Colors.transparent, //borderRadius: BorderRadius.circular(16.w), image: DecorationImage( image: Assets.images.iconMineTrialExpirationBg.provider(), fit: BoxFit.fill, ) ), child: IntrinsicHeight( child: Column( mainAxisAlignment: MainAxisAlignment.start, children: [ SizedBox(height: 54.1.w + 40.w,), Container( alignment: Alignment.centerLeft, child: Text("您的安全防护已暂停!", style: TextStyle( fontSize: 19.sp, color: '#5E60FE'.color, fontWeight: FontWeight.bold) ), ), SizedBox(height: 9.w,), Row( children: [ Assets.images.iconMineTrialExpirationHeader.image(width: 52.w,height: 52.w), SizedBox(width: 6.w,), Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ RichText( text: TextSpan( text: '您已守护了Ta ', style: TextStyle( fontSize: 10.sp, color: Color(0xFF5E60FE), fontWeight: FontWeight.w400, ), children: [ TextSpan( text: '${widget.infoResponse.watchTimes}', style: TextStyle( fontSize: 13.sp, // 加大字号 color: "#7B7DFF".color, // 红色 fontWeight: FontWeight.bold, // 加粗强调 ), ), TextSpan( text: ' 次,', style: TextStyle( fontSize: 10.sp, color: Color(0xFF5E60FE), fontWeight: FontWeight.w400, ), ), ], ), ), RichText( text: TextSpan( text: '并且有 ', style: TextStyle( fontSize: 10.sp, color: Color(0xFF5E60FE), fontWeight: FontWeight.w400, ), children: [ TextSpan( text: '${widget.infoResponse.trackCount}', style: TextStyle( fontSize: 13.sp, // 加大字号 color: "#7B7DFF".color, // 红色 fontWeight: FontWeight.bold, // 加粗强调 ), ), TextSpan( text: ' 条重要轨迹即将消失。', style: TextStyle( fontSize: 10.sp, color: Color(0xFF5E60FE), fontWeight: FontWeight.w400, ), ), ], ), ), ], ) ], ), SizedBox(height: 17.w,), Stack( children: [ Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Expanded( child: _regularMember(), ), SizedBox(width: 8.w,), Expanded( child: _memberUsers() ) ], ), Positioned( width: 56.w, height: 74.w, bottom: 0, left: (MediaQuery.of(Get.context!).size.width - 36.w * 2.0) / 2.0 - 36.w + 4.w, child: Assets.images.iconMineTrialExpirationUp.image(width: 56.w,height: 75.w) ) ], ), SizedBox(height: 16.w,), GestureDetector( onTap: () { Get.back(); widget.confirmOnTap!(); }, child: Container( decoration: BoxDecoration( gradient: LinearGradient( begin: Alignment.centerLeft, // 90度相当于从左到右 end: Alignment.centerRight, colors: [ Color(0xFF7B7DFF), // #7B7DFF Color(0xFF6365FF), // #6365FF ], stops: [0.0, 1.0], // 从0%到100% ), borderRadius: BorderRadius.circular(43.w / 2.0), ), height: 43.w, alignment: Alignment.center, child: Text(StringName.memberVipRenew, style: TextStyle( fontSize: 14.sp, color: '#FFFFFF'.color, fontWeight: FontWeight.w500) ), ), ), SizedBox( height: 12.w, ), GestureDetector( onTap: widget.cancelOnTap, child: Container( height: 20.w, child: Text("下次再说", style: TextStyle( fontSize: 14.sp, color: '#898996'.color, fontWeight: FontWeight.w500) ), ), ), ], ), ), ); } //普通会员 Widget _regularMember() { return Container( padding: EdgeInsets.only(top: 16.w,bottom: 32.w), decoration: BoxDecoration( gradient: LinearGradient( begin: Alignment.bottomCenter, // 0deg相当于从底部开始 end: Alignment.topCenter, colors: [ Color(0xFFFFFFFF), // #FFF Color(0xFFE9E9FF), // #E9E9FF ], stops: [0.6629, 0.9994], ), border: Border.all( color: Color(0xFFFFFFFF), // #FFF width: 1.5, ), borderRadius: BorderRadius.circular(14.w), ), child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ Text("普通会员", style: TextStyle( fontSize: 11.sp, color: "#333333".color, fontWeight: FontWeight.w500) ), SizedBox(height: 12.w,), _memberUntiItem(Assets.images.iconMineTrialExpirationHave.image(width: 12.w,height: 12.w), "实时定位", "15分钟试用"), SizedBox(height: 4.w,), _memberUntiItem(Assets.images.iconMineTrialExpirationQuestion.image(width: 12.w,height: 12.w), "轨迹回溯", "--",isStop: true), SizedBox(height: 4.w,), _memberUntiItem(Assets.images.iconMineTrialExpirationQuestion.image(width: 12.w,height: 12.w), "紧急警报", "--",isStop: true), SizedBox(height: 4.w,), _memberUntiItem(Assets.images.iconMineTrialExpirationHave.image(width: 12.w,height: 12.w), "专属客服通道", "普通通道"), ], ), ); } //会员用户 Widget _memberUsers() { return Container( padding: EdgeInsets.only(top: 12.w,bottom: 0), decoration: BoxDecoration( gradient: LinearGradient( begin: Alignment.topCenter, // 180度相当于从上到下 end: Alignment.bottomCenter, colors: [ Color(0xFFFFE1C5), // #FFE1C5 Color(0xFFFFFFFF), // #FFF ], stops: [0.0, 0.3676], // 对应0%和36.76%的位置 ), border: Border.all( color: Color(0xFFFFFFFF), // #FFF width: 1.5, // 描边宽度1.5px ), borderRadius: BorderRadius.circular(14.w), // 可根据需要设置圆角 ), child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Text("会员用户", style: TextStyle( fontSize: 11.sp, color: "#333333".color, fontWeight: FontWeight.w500) ), SizedBox(width: 2.w,), Assets.images.iconMineTrialExpirationRecommend.image(width: 15.w,height: 15.w) ], ), SizedBox(height: 12.w,), _memberUntiItem(Assets.images.iconMineTrialExpirationHave.image(width: 12.w,height: 12.w), "实时定位", "无限使用"), SizedBox(height: 4.w,), _memberUntiItem(Assets.images.iconMineTrialExpirationHave.image(width: 12.w,height: 12.w), "轨迹回溯", "无限回溯"), SizedBox(height: 4.w,), _memberUntiItem(Assets.images.iconMineTrialExpirationHave.image(width: 12.w,height: 12.w), "紧急警报", "安全自动预警"), SizedBox(height: 4.w,), _memberUntiItem(Assets.images.iconMineTrialExpirationHave.image(width: 12.w,height: 12.w), "专属客服通道", "1V1专属通道"), Container( alignment: Alignment.topRight, child: Assets.images.iconMineTrialExpirationVip.image(width: 45.w,height: 35.w), ) ], ), ); } //通用item Widget _memberUntiItem(Image image,String title,String descrip,{bool? isStop = false}) { return Container( height: 36.5.w, padding: EdgeInsets.only(left: 26.w), child: Row( crossAxisAlignment: CrossAxisAlignment.center, children: [ Container( padding: EdgeInsets.only(top: 5.w), child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Row(children: [ image, SizedBox(width: 9.5.w,), Text(title, style: TextStyle( fontSize: 11.sp, color: '#333333'.color, fontWeight: FontWeight.w500) ), ],), SizedBox(width: 4.w,), Row( mainAxisAlignment: MainAxisAlignment.start, children: [ SizedBox(width: 21.5,), Text(descrip, textAlign: TextAlign.left, style: TextStyle( fontSize: 9.sp, color: '#898996'.color, fontWeight: FontWeight.w400) ) ], ), ], ), ), SizedBox(width: 1.w,), Container( padding: EdgeInsets.symmetric(vertical: 0), alignment: Alignment.topCenter, child: Visibility( visible: isStop ?? false, child: Container( padding: EdgeInsets.symmetric(horizontal: 4.w,vertical: 1.5.w), decoration: BoxDecoration( image: DecorationImage(image: Assets.images.iconMineTrialExpirationPauseBg.provider()) ), child: Text("暂停服务", style: TextStyle( fontSize: 8.sp, color: ColorName.white, fontWeight: FontWeight.w400) ), ), ), ) ], ) ); } }