优化套餐显示逻辑新增多语言

This commit is contained in:
2025-10-18 15:25:28 +08:00
parent a3b7c418b1
commit 89c7334caf
11 changed files with 198 additions and 77 deletions
@@ -172,6 +172,14 @@ class KRPurchaseMembershipView extends GetView<KRPurchaseMembershipController> {
itemBuilder: (context, index) {
final plan = controller.kr_plans[controller.kr_selectedPlanIndex.value];
final discountIndex = plan.kr_discount.isEmpty ? null : index;
// 如果是 Day 单位且 quantity 是 1(一天),则不显示
if (discountIndex != null &&
plan.kr_unitTime == 'Day' &&
plan.kr_discount[discountIndex].kr_quantity == 1) {
return SizedBox.shrink();
}
return _kr_buildPlanOptionCard(
plan,
controller.kr_selectedPlanIndex.value,
@@ -695,42 +703,37 @@ class KRPurchaseMembershipView extends GetView<KRPurchaseMembershipController> {
],
),
SizedBox(height: 6.h),
if (discountIndex != null && plan.kr_discount.isNotEmpty) ...[
if (discountIndex != null &&
plan.kr_discount.isNotEmpty &&
plan.kr_discount[discountIndex].kr_discount != 0 &&
plan.kr_discount[discountIndex].kr_discount != 100) ...[
Container(
padding: EdgeInsets.symmetric(
horizontal: 8.w,
vertical: 2.h
),
decoration: BoxDecoration(
color: plan.kr_discount[discountIndex].kr_discount < 100
? Colors.red.withOpacity(0.08)
: Colors.transparent,
color: Colors.red.withOpacity(0.08),
borderRadius: BorderRadius.circular(4.r),
border: plan.kr_discount[discountIndex].kr_discount < 100
? Border.all(
color: Colors.red.withOpacity(0.2),
width: 1,
)
: null,
boxShadow: plan.kr_discount[discountIndex].kr_discount < 100
? [
BoxShadow(
color: Colors.red.withOpacity(0.05),
blurRadius: 4,
offset: Offset(0, 2),
spreadRadius: 0,
),
]
: null,
border: Border.all(
color: Colors.red.withOpacity(0.2),
width: 1,
),
boxShadow: [
BoxShadow(
color: Colors.red.withOpacity(0.05),
blurRadius: 4,
offset: Offset(0, 2),
spreadRadius: 0,
),
],
),
child: Text(
controller.kr_getDiscountText(plan, discountIndex),
style: KrAppTextStyle(
fontSize: 10,
fontWeight: FontWeight.w500,
color: plan.kr_discount[discountIndex].kr_discount < 100
? Colors.red.withOpacity(0.9)
: Colors.transparent,
color: Colors.red.withOpacity(0.9),
),
),
),