feat: bugfix
This commit is contained in:
@@ -92,14 +92,14 @@ class KRPurchaseMembershipView extends GetView<KRPurchaseMembershipController> {
|
||||
padding:
|
||||
EdgeInsets.only(bottom: 8.0),
|
||||
child: SizedBox(
|
||||
height: 140.0,
|
||||
height: 130.0,
|
||||
child: _kr_buildPlanOptionCard(
|
||||
plan,
|
||||
controller
|
||||
.kr_selectedPlanIndex.value,
|
||||
discountIndex,
|
||||
context,
|
||||
index == 0,
|
||||
index,
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -167,11 +167,12 @@ class KRPurchaseMembershipView extends GetView<KRPurchaseMembershipController> {
|
||||
int planIndex,
|
||||
int? discountIndex,
|
||||
BuildContext context,
|
||||
bool isFirst,
|
||||
int index,
|
||||
) {
|
||||
// 由于移除了 Obx,isSelected 的值在构建时就固定了。
|
||||
// 它将不再响应用户的点击事件来改变UI。
|
||||
// 根据您的要求,isSelected 的值与 isFirst 相反。
|
||||
bool isFirst = 0 == index;
|
||||
bool isSelected = !isFirst;
|
||||
|
||||
return GestureDetector(
|
||||
@@ -190,16 +191,16 @@ class KRPurchaseMembershipView extends GetView<KRPurchaseMembershipController> {
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(38.0), // 内部圆角
|
||||
child: Container(
|
||||
padding: EdgeInsets.fromLTRB(45.0, 10.0, 0.0, 10.0),
|
||||
padding: EdgeInsets.fromLTRB(45.0, 0.0, 0.0, 0.0),
|
||||
decoration: BoxDecoration(
|
||||
color: isSelected ? Colors.black : Theme.of(context).primaryColor,
|
||||
borderRadius: BorderRadius.circular(38.0),
|
||||
),
|
||||
child: Stack(
|
||||
alignment: Alignment.centerLeft,
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
@@ -214,25 +215,80 @@ class KRPurchaseMembershipView extends GetView<KRPurchaseMembershipController> {
|
||||
: Theme.of(context).textTheme.bodyMedium?.color,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'¥${controller.kr_getPlanPrice(plan, discountIndex: discountIndex).toStringAsFixed(2)}',
|
||||
style: TextStyle(
|
||||
fontSize: 40,
|
||||
height: 1,
|
||||
fontWeight: FontWeight.w600,
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
KrLocalImage(
|
||||
imageName: 'money-icon',
|
||||
imageType: ImageType.svg,
|
||||
width: 36,
|
||||
height: 36,
|
||||
color: isSelected
|
||||
? Colors.white
|
||||
: Theme.of(context).textTheme.bodyMedium?.color,
|
||||
)),
|
||||
Text(
|
||||
'约¥${controller.kr_getDayPlanPrice(plan, discountIndex: discountIndex).toStringAsFixed(2)}/天',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
SizedBox(width: 2),
|
||||
Text(
|
||||
controller
|
||||
.kr_getPlanPrice(plan,
|
||||
discountIndex: discountIndex)
|
||||
.toStringAsFixed(2),
|
||||
style: TextStyle(
|
||||
fontSize: 40,
|
||||
height: 1,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: isSelected
|
||||
? Colors.white
|
||||
: Theme.of(context)
|
||||
.textTheme
|
||||
.bodyMedium
|
||||
?.color,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
'约',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: isSelected
|
||||
? Colors.white
|
||||
: Theme.of(context)
|
||||
.textTheme
|
||||
.bodyMedium
|
||||
?.color,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 2),
|
||||
KrLocalImage(
|
||||
imageName: 'money-icon',
|
||||
imageType: ImageType.svg,
|
||||
width: 16,
|
||||
height: 16,
|
||||
color: isSelected
|
||||
? Colors.white
|
||||
: Theme.of(context).textTheme.bodyMedium?.color,
|
||||
)),
|
||||
),
|
||||
SizedBox(width: 2),
|
||||
Text(
|
||||
'${controller.kr_getDayPlanPrice(plan, discountIndex: discountIndex).toStringAsFixed(2)}/天',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: isSelected
|
||||
? Colors.white
|
||||
: Theme.of(context)
|
||||
.textTheme
|
||||
.bodyMedium
|
||||
?.color,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
]),
|
||||
if (!isFirst)
|
||||
Positioned(
|
||||
@@ -242,7 +298,7 @@ class KRPurchaseMembershipView extends GetView<KRPurchaseMembershipController> {
|
||||
angle: 0.785398, // 45度角 (π/4)
|
||||
child: Container(
|
||||
// 调整位置,让标签的一部分显示在容器外
|
||||
transform: Matrix4.translationValues(30, -10, 0),
|
||||
transform: Matrix4.translationValues(40, -10, 0),
|
||||
width: 130, // 适当的宽度
|
||||
height: 20, // 固定高度
|
||||
decoration: BoxDecoration(
|
||||
@@ -254,7 +310,9 @@ class KRPurchaseMembershipView extends GetView<KRPurchaseMembershipController> {
|
||||
style: TextStyle(
|
||||
color: Colors.black, // 白色文字更清晰
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w300,
|
||||
fontWeight: index == 1
|
||||
? FontWeight.w300
|
||||
: FontWeight.w600,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user