feat: 尚未购买的弹窗
This commit is contained in:
@@ -4,11 +4,11 @@ import 'package:get/get.dart';
|
||||
import 'package:kaer_with_panels/app/common/app_run_data.dart';
|
||||
import 'package:kaer_with_panels/app/widgets/hi_base_scaffold.dart';
|
||||
import 'package:kaer_with_panels/app/widgets/kr_local_image.dart';
|
||||
import 'package:kaer_with_panels/app/widgets/kr_subscription_expiry_text.dart';
|
||||
import '../controllers/kr_delete_account_controller.dart';
|
||||
import 'package:kaer_with_panels/app/localization/app_translations.dart';
|
||||
import 'package:kaer_with_panels/app/widgets/kr_app_text_style.dart';
|
||||
|
||||
|
||||
class KRDeleteAccountView extends GetView<KRDeleteAccountController> {
|
||||
const KRDeleteAccountView({super.key});
|
||||
|
||||
@@ -46,7 +46,8 @@ class KRDeleteAccountView extends GetView<KRDeleteAccountController> {
|
||||
padding: EdgeInsets.symmetric(vertical: 12.w),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(24.w),
|
||||
border: Border.all(color: const Color(0xFFFF2ED1), width: 2),
|
||||
border:
|
||||
Border.all(color: const Color(0xFFFF2ED1), width: 2),
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
@@ -87,7 +88,6 @@ class KRDeleteAccountView extends GetView<KRDeleteAccountController> {
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Widget _buildUserInfoSection() {
|
||||
return Row(
|
||||
children: [
|
||||
@@ -129,12 +129,16 @@ class KRDeleteAccountView extends GetView<KRDeleteAccountController> {
|
||||
);
|
||||
}),
|
||||
Obx(() {
|
||||
final _ = KRAppRunData.getInstance().kr_isLogin.value;
|
||||
final userId = (KRAppRunData.getInstance().kr_userId.value ?? '').toString();
|
||||
final deviceId = KRAppRunData.getInstance().deviceId ?? '';
|
||||
|
||||
final account = KRAppRunData.getInstance()
|
||||
.kr_account
|
||||
.value;
|
||||
final isDeviceLogin = account != null &&
|
||||
account.startsWith('9000');
|
||||
final accountText = isDeviceLogin
|
||||
? '待绑定'
|
||||
: 'ID: ${KRAppRunData.getInstance().kr_account.value.toString()}';
|
||||
return Text(
|
||||
'ID: ${userId.isNotEmpty ? userId : deviceId}',
|
||||
accountText,
|
||||
style: TextStyle(
|
||||
color: Colors.white.withOpacity(0.85),
|
||||
fontSize: 14.sp,
|
||||
@@ -142,51 +146,14 @@ class KRDeleteAccountView extends GetView<KRDeleteAccountController> {
|
||||
),
|
||||
);
|
||||
}),
|
||||
Obx(() {
|
||||
final currentSubscribe =
|
||||
controller.kr_subscribeService.kr_currentSubscribe.value;
|
||||
String expiryText;
|
||||
|
||||
if (currentSubscribe == null) {
|
||||
expiryText = '尚未购买套餐';
|
||||
} else {
|
||||
final now = DateTime.now();
|
||||
DateTime? expireDateTime;
|
||||
try {
|
||||
expireDateTime =
|
||||
DateTime.parse(currentSubscribe.expireTime);
|
||||
} catch (e) {
|
||||
expireDateTime = null;
|
||||
}
|
||||
|
||||
if (expireDateTime == null) {
|
||||
expiryText = '套餐信息无效';
|
||||
} else if (expireDateTime.isBefore(now)) {
|
||||
final formattedExpireDate =
|
||||
'${expireDateTime.year}/${expireDateTime.month.toString().padLeft(2, '0')}/${expireDateTime.day.toString().padLeft(2, '0')}';
|
||||
expiryText = '已于 $formattedExpireDate 到期';
|
||||
} else {
|
||||
expiryText = '到期时间:${expireDateTime}';final year = expireDateTime.year;
|
||||
final month = expireDateTime.month.toString().padLeft(2, '0');
|
||||
final day = expireDateTime.day.toString().padLeft(2, '0');
|
||||
final hour = expireDateTime.hour.toString().padLeft(2, '0');
|
||||
final minute = expireDateTime.minute.toString().padLeft(2, '0');
|
||||
final second = expireDateTime.second.toString().padLeft(2, '0');
|
||||
|
||||
// 2. 拼接成最终的字符串
|
||||
final formattedDateTime = '$year/$month/$day $hour:$minute:$second';
|
||||
|
||||
expiryText = '到期时间:$formattedDateTime';
|
||||
}
|
||||
}
|
||||
return Text(
|
||||
expiryText,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 12.sp,
|
||||
),
|
||||
);
|
||||
}),
|
||||
KRSubscriptionExpiryText(
|
||||
expireTimeProvider: () => controller
|
||||
.kr_subscribeService.kr_currentSubscribe.value?.expireTime,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 12.sp,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -213,7 +180,8 @@ class KRDeleteAccountView extends GetView<KRDeleteAccountController> {
|
||||
color: const Color(0xFFA6A6A6),
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
contentPadding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 10.w),
|
||||
contentPadding:
|
||||
EdgeInsets.symmetric(horizontal: 16.w, vertical: 10.w),
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(25.w),
|
||||
borderSide: BorderSide(color: Colors.white, width: 2),
|
||||
@@ -233,14 +201,15 @@ class KRDeleteAccountView extends GetView<KRDeleteAccountController> {
|
||||
suffixIcon: Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 5.w, vertical: 5.w),
|
||||
child: Obx(() {
|
||||
|
||||
return GestureDetector(
|
||||
onTap: controller.kr_canSendCode.value ? controller.kr_sendCode : null,
|
||||
onTap: controller.kr_canSendCode.value
|
||||
? controller.kr_sendCode
|
||||
: null,
|
||||
child: Container(
|
||||
width: 100.w,
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
color: controller.kr_canSendCode.value
|
||||
color: controller.kr_canSendCode.value
|
||||
? Theme.of(Get.context!).primaryColor
|
||||
: const Color(0xFFD5D5D5),
|
||||
borderRadius: BorderRadius.circular(100.r), // 药丸状
|
||||
@@ -254,7 +223,7 @@ class KRDeleteAccountView extends GetView<KRDeleteAccountController> {
|
||||
fontWeight: FontWeight.w600,
|
||||
color: controller.kr_canSendCode.value
|
||||
? Colors.black
|
||||
: const Color(0xFF464655) ,
|
||||
: const Color(0xFF464655),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user