修复ScreenUtil 在某些安卓设备上计算异常,导致所有使用 .w 和 .h 的尺寸都变成 0 或极小值,导致界面不显示
(cherry picked from commit 73af298aebafc2e13668d645d461b99786b0c1e2)
This commit is contained in:
parent
17b3f6b92d
commit
75c7d31da1
@ -97,18 +97,18 @@ class KRHomeBottomPanel extends GetView<KRHomeController> {
|
|||||||
if (hasValidSubscription)
|
if (hasValidSubscription)
|
||||||
// 已订阅:显示连接信息卡片
|
// 已订阅:显示连接信息卡片
|
||||||
Builder(builder: (context) {
|
Builder(builder: (context) {
|
||||||
KRLogUtil.kr_i('🔹 渲染连接信息卡片,margin top: ${12.h}', tag: 'HomeBottomPanel');
|
KRLogUtil.kr_i('🔹 渲染连接信息卡片,margin top: ${12}', tag: 'HomeBottomPanel');
|
||||||
return Container(
|
return Container(
|
||||||
margin: EdgeInsets.only(top: 12.h),
|
margin: EdgeInsets.only(top: 12),
|
||||||
child: const KRHomeConnectionInfoView(),
|
child: const KRHomeConnectionInfoView(),
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
else
|
else
|
||||||
// 未订阅(包括未登录):始终显示订阅卡片
|
// 未订阅(包括未登录):始终显示订阅卡片
|
||||||
Builder(builder: (context) {
|
Builder(builder: (context) {
|
||||||
KRLogUtil.kr_i('🔹 渲染订阅卡片,margin: top=${12.h}, left=${12.w}, right=${12.w}', tag: 'HomeBottomPanel');
|
KRLogUtil.kr_i('🔹 渲染订阅卡片,margin: top=${12}, left=${12}, right=${12}', tag: 'HomeBottomPanel');
|
||||||
return Container(
|
return Container(
|
||||||
margin: EdgeInsets.only(top: 12.h, left: 12.w, right: 12.w),
|
margin: EdgeInsets.only(top: 12, left: 12, right: 12),
|
||||||
child: const KRSubscriptionCard(),
|
child: const KRSubscriptionCard(),
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
@ -116,21 +116,21 @@ class KRHomeBottomPanel extends GetView<KRHomeController> {
|
|||||||
// 2. 如果已订阅且是试用,展示试用卡片
|
// 2. 如果已订阅且是试用,展示试用卡片
|
||||||
if (hasValidSubscription && isTrial)
|
if (hasValidSubscription && isTrial)
|
||||||
Container(
|
Container(
|
||||||
margin: EdgeInsets.only(top: 12.h),
|
margin: EdgeInsets.only(top: 12),
|
||||||
child: const KRHomeTrialCard(),
|
child: const KRHomeTrialCard(),
|
||||||
),
|
),
|
||||||
|
|
||||||
// 3. 如果已订阅且是最后一天,展示最后一天卡片
|
// 3. 如果已订阅且是最后一天,展示最后一天卡片
|
||||||
if (hasValidSubscription && isLastDay && !isTrial)
|
if (hasValidSubscription && isLastDay && !isTrial)
|
||||||
Container(
|
Container(
|
||||||
margin: EdgeInsets.only(top: 12.h),
|
margin: EdgeInsets.only(top: 12),
|
||||||
child: const KRHomeLastDayCard(),
|
child: const KRHomeLastDayCard(),
|
||||||
),
|
),
|
||||||
|
|
||||||
// 4. 连接选项(分组和国家入口)- 始终显示
|
// 4. 连接选项(分组和国家入口)- 始终显示
|
||||||
Padding(
|
const Padding(
|
||||||
padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 12.h),
|
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||||
child: const KRHomeConnectionOptionsView(),
|
child: KRHomeConnectionOptionsView(),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -157,7 +157,7 @@ class KRHomeBottomPanel extends GetView<KRHomeController> {
|
|||||||
// 顶层:加载指示器
|
// 顶层:加载指示器
|
||||||
Center(
|
Center(
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: EdgeInsets.all(16.w),
|
padding: EdgeInsets.all(16),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Get.context!.theme.cardColor,
|
color: Get.context!.theme.cardColor,
|
||||||
borderRadius: BorderRadius.circular(12.r),
|
borderRadius: BorderRadius.circular(12.r),
|
||||||
@ -176,7 +176,7 @@ class KRHomeBottomPanel extends GetView<KRHomeController> {
|
|||||||
color: Colors.green,
|
color: Colors.green,
|
||||||
strokeWidth: 3.0,
|
strokeWidth: 3.0,
|
||||||
),
|
),
|
||||||
SizedBox(height: 12.h),
|
SizedBox(height: 12),
|
||||||
Text(
|
Text(
|
||||||
'正在加载...',
|
'正在加载...',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
@ -194,18 +194,18 @@ class KRHomeBottomPanel extends GetView<KRHomeController> {
|
|||||||
|
|
||||||
Widget _kr_buildErrorView(BuildContext context) {
|
Widget _kr_buildErrorView(BuildContext context) {
|
||||||
return Container(
|
return Container(
|
||||||
height: 200.h,
|
height: 200,
|
||||||
padding: EdgeInsets.all(16.w),
|
padding: EdgeInsets.all(16),
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Icon(
|
Icon(
|
||||||
Icons.error_outline,
|
Icons.error_outline,
|
||||||
size: 48.w,
|
size: 48,
|
||||||
color: Theme.of(context).colorScheme.error,
|
color: Theme.of(context).colorScheme.error,
|
||||||
),
|
),
|
||||||
SizedBox(height: 16.h),
|
SizedBox(height: 16),
|
||||||
Text(
|
Text(
|
||||||
AppTranslations.kr_home.error,
|
AppTranslations.kr_home.error,
|
||||||
style: KrAppTextStyle(
|
style: KrAppTextStyle(
|
||||||
@ -214,7 +214,7 @@ class KRHomeBottomPanel extends GetView<KRHomeController> {
|
|||||||
color: Theme.of(context).textTheme.bodyMedium?.color,
|
color: Theme.of(context).textTheme.bodyMedium?.color,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(height: 8.h),
|
SizedBox(height: 8),
|
||||||
Text(
|
Text(
|
||||||
AppTranslations.kr_home.checkNetwork,
|
AppTranslations.kr_home.checkNetwork,
|
||||||
style: KrAppTextStyle(
|
style: KrAppTextStyle(
|
||||||
@ -222,10 +222,10 @@ class KRHomeBottomPanel extends GetView<KRHomeController> {
|
|||||||
color: Theme.of(context).textTheme.bodySmall?.color,
|
color: Theme.of(context).textTheme.bodySmall?.color,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(height: 24.h),
|
SizedBox(height: 24),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 200.w,
|
width: 200,
|
||||||
height: 44.h,
|
height: 44,
|
||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
onPressed: () => controller.kr_refreshAll(),
|
onPressed: () => controller.kr_refreshAll(),
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
|
|||||||
@ -25,17 +25,17 @@ class KRHomeConnectionInfoView extends GetView<KRHomeController> {
|
|||||||
Widget _buildConnectCard(BuildContext context) {
|
Widget _buildConnectCard(BuildContext context) {
|
||||||
return Obx(() {
|
return Obx(() {
|
||||||
return Container(
|
return Container(
|
||||||
margin: EdgeInsets.symmetric(horizontal: 16.w),
|
margin: EdgeInsets.symmetric(horizontal: 16),
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: 116.h,
|
height: 116,
|
||||||
decoration: ShapeDecoration(
|
decoration: ShapeDecoration(
|
||||||
color: Theme.of(context).cardColor,
|
color: Theme.of(context).cardColor,
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(16.w),
|
borderRadius: BorderRadius.circular(16),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.all(14.w),
|
padding: EdgeInsets.all(14),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
@ -66,7 +66,7 @@ class KRHomeConnectionInfoView extends GetView<KRHomeController> {
|
|||||||
),
|
),
|
||||||
Icon(
|
Icon(
|
||||||
Icons.arrow_forward_ios,
|
Icons.arrow_forward_ios,
|
||||||
size: 12.w,
|
size: 12,
|
||||||
color: Theme.of(context).textTheme.bodySmall?.color,
|
color: Theme.of(context).textTheme.bodySmall?.color,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -74,7 +74,7 @@ class KRHomeConnectionInfoView extends GetView<KRHomeController> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
SizedBox(height: 10.h),
|
SizedBox(height: 10),
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
@ -90,7 +90,7 @@ class KRHomeConnectionInfoView extends GetView<KRHomeController> {
|
|||||||
countryCode: countryCode,
|
countryCode: countryCode,
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
SizedBox(width: 10.w),
|
SizedBox(width: 10),
|
||||||
Column(
|
Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
@ -102,7 +102,7 @@ class KRHomeConnectionInfoView extends GetView<KRHomeController> {
|
|||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(height: 6.h),
|
SizedBox(height: 6),
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Obx(() {
|
Obx(() {
|
||||||
@ -147,10 +147,10 @@ class KRHomeConnectionInfoView extends GetView<KRHomeController> {
|
|||||||
children: [
|
children: [
|
||||||
KRSimpleLoading(
|
KRSimpleLoading(
|
||||||
color: Colors.green,
|
color: Colors.green,
|
||||||
size: 12.w,
|
size: 12,
|
||||||
duration: const Duration(milliseconds: 800),
|
duration: const Duration(milliseconds: 800),
|
||||||
),
|
),
|
||||||
SizedBox(width: 2.w),
|
SizedBox(width: 2),
|
||||||
Text(
|
Text(
|
||||||
AppTranslations.kr_home.connecting,
|
AppTranslations.kr_home.connecting,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
@ -166,7 +166,7 @@ class KRHomeConnectionInfoView extends GetView<KRHomeController> {
|
|||||||
return Row(
|
return Row(
|
||||||
children: [
|
children: [
|
||||||
Icon(Icons.signal_cellular_alt,
|
Icon(Icons.signal_cellular_alt,
|
||||||
size: 12.w,
|
size: 12,
|
||||||
color: getLatencyColor(delay)),
|
color: getLatencyColor(delay)),
|
||||||
SizedBox(width: 2),
|
SizedBox(width: 2),
|
||||||
Text(
|
Text(
|
||||||
@ -188,9 +188,9 @@ class KRHomeConnectionInfoView extends GetView<KRHomeController> {
|
|||||||
}
|
}
|
||||||
return Row(
|
return Row(
|
||||||
children: [
|
children: [
|
||||||
SizedBox(width: 10.w),
|
SizedBox(width: 10),
|
||||||
Icon(Icons.arrow_upward,
|
Icon(Icons.arrow_upward,
|
||||||
size: 12.w,
|
size: 12,
|
||||||
color: Theme.of(context).textTheme.bodySmall?.color),
|
color: Theme.of(context).textTheme.bodySmall?.color),
|
||||||
Text(
|
Text(
|
||||||
controller.kr_formatBytes(KRSingBoxImp.instance.kr_stats.value.uplink),
|
controller.kr_formatBytes(KRSingBoxImp.instance.kr_stats.value.uplink),
|
||||||
@ -200,9 +200,9 @@ class KRHomeConnectionInfoView extends GetView<KRHomeController> {
|
|||||||
fontWeight: FontWeight.w400,
|
fontWeight: FontWeight.w400,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(width: 10.w),
|
SizedBox(width: 10),
|
||||||
Icon(Icons.arrow_downward,
|
Icon(Icons.arrow_downward,
|
||||||
size: 12.w,
|
size: 12,
|
||||||
color: Theme.of(context).textTheme.bodySmall?.color),
|
color: Theme.of(context).textTheme.bodySmall?.color),
|
||||||
Text(
|
Text(
|
||||||
controller.kr_formatBytes(KRSingBoxImp.instance.kr_stats.value.downlink),
|
controller.kr_formatBytes(KRSingBoxImp.instance.kr_stats.value.downlink),
|
||||||
|
|||||||
@ -14,19 +14,23 @@ class KRHomeConnectionOptionsView extends GetView<KRHomeController> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
print('🔌 [ConnectionOptions] 开始构建连接选项组件');
|
||||||
|
|
||||||
return Column(
|
return Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
AppTranslations.kr_home.connectionSectionTitle,
|
AppTranslations.kr_home.connectionSectionTitle,
|
||||||
style: KrAppTextStyle(
|
style: TextStyle(
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
color: Theme.of(context).textTheme.bodyMedium?.color,
|
color: Theme.of(context).brightness == Brightness.dark
|
||||||
|
? Colors.white
|
||||||
|
: Colors.black87,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(height: 8.h),
|
const SizedBox(height: 12),
|
||||||
_buildConnectionOption(
|
_buildConnectionOption(
|
||||||
"home_ct",
|
"home_ct",
|
||||||
AppTranslations.kr_home.countryRegion,
|
AppTranslations.kr_home.countryRegion,
|
||||||
@ -41,8 +45,11 @@ class KRHomeConnectionOptionsView extends GetView<KRHomeController> {
|
|||||||
|
|
||||||
Widget _buildConnectionOption(String icon, String label, BuildContext context,
|
Widget _buildConnectionOption(String icon, String label, BuildContext context,
|
||||||
{VoidCallback? onTap}) {
|
{VoidCallback? onTap}) {
|
||||||
|
print('🔌 [ConnectionOptions] 构建连接选项: $label');
|
||||||
|
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
print('🔌 [ConnectionOptions] 选项被点击: $label');
|
||||||
if (controller.kr_subscribeService.kr_currentSubscribe.value == null) {
|
if (controller.kr_subscribeService.kr_currentSubscribe.value == null) {
|
||||||
// 未订阅状态下,使用统一的订阅导航工具
|
// 未订阅状态下,使用统一的订阅导航工具
|
||||||
KRSubscribeNavigationUtil.navigateToPurchase(tag: 'ConnectionOptions');
|
KRSubscribeNavigationUtil.navigateToPurchase(tag: 'ConnectionOptions');
|
||||||
@ -52,30 +59,34 @@ class KRHomeConnectionOptionsView extends GetView<KRHomeController> {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: EdgeInsets.all(16.w),
|
padding: const EdgeInsets.all(16),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Theme.of(context).cardColor,
|
color: Theme.of(context).cardColor,
|
||||||
borderRadius: BorderRadius.circular(12.r),
|
borderRadius: BorderRadius.circular(12),
|
||||||
),
|
),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
KrLocalImage(
|
KrLocalImage(
|
||||||
imageName: icon,
|
imageName: icon,
|
||||||
width: 32.w,
|
width: 36,
|
||||||
height: 32.w,
|
height: 36,
|
||||||
color: Theme.of(context).textTheme.bodyMedium?.color,
|
color: Theme.of(context).brightness == Brightness.dark
|
||||||
|
? Colors.white70
|
||||||
|
: Colors.black87,
|
||||||
),
|
),
|
||||||
SizedBox(height: 12.h),
|
const SizedBox(height: 12),
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Text(
|
child: Text(
|
||||||
label,
|
label,
|
||||||
style: KrAppTextStyle(
|
style: TextStyle(
|
||||||
fontSize: 13,
|
fontSize: 14,
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
color: Theme.of(context).textTheme.bodyMedium?.color,
|
color: Theme.of(context).brightness == Brightness.dark
|
||||||
|
? Colors.white
|
||||||
|
: Colors.black87,
|
||||||
),
|
),
|
||||||
maxLines: 2,
|
maxLines: 2,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
@ -83,8 +94,10 @@ class KRHomeConnectionOptionsView extends GetView<KRHomeController> {
|
|||||||
),
|
),
|
||||||
Icon(
|
Icon(
|
||||||
Icons.arrow_forward_ios,
|
Icons.arrow_forward_ios,
|
||||||
size: 12.w,
|
size: 14,
|
||||||
color: Theme.of(context).textTheme.bodySmall?.color,
|
color: Theme.of(context).brightness == Brightness.dark
|
||||||
|
? Colors.white54
|
||||||
|
: Colors.black45,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@ -15,16 +15,16 @@ class KRHomeLastDayCard extends GetView<KRHomeController> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return Container(
|
||||||
margin: EdgeInsets.symmetric(horizontal: 16.w),
|
margin: EdgeInsets.symmetric(horizontal: 16),
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
decoration: ShapeDecoration(
|
decoration: ShapeDecoration(
|
||||||
color: Theme.of(context).cardColor,
|
color: Theme.of(context).cardColor,
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(16.w),
|
borderRadius: BorderRadius.circular(16),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.all(14.w),
|
padding: EdgeInsets.all(14),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
@ -54,7 +54,7 @@ class KRHomeLastDayCard extends GetView<KRHomeController> {
|
|||||||
),
|
),
|
||||||
Icon(
|
Icon(
|
||||||
Icons.arrow_forward_ios,
|
Icons.arrow_forward_ios,
|
||||||
size: 12.w,
|
size: 12,
|
||||||
color: Colors.blue,
|
color: Colors.blue,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -64,14 +64,14 @@ class KRHomeLastDayCard extends GetView<KRHomeController> {
|
|||||||
),
|
),
|
||||||
|
|
||||||
// 倒计时显示
|
// 倒计时显示
|
||||||
SizedBox(height: 10.h),
|
SizedBox(height: 10),
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
padding: EdgeInsets.all(8.w),
|
padding: EdgeInsets.all(8),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.blue.withOpacity(0.1),
|
color: Colors.blue.withOpacity(0.1),
|
||||||
borderRadius: BorderRadius.circular(8.w),
|
borderRadius: BorderRadius.circular(8),
|
||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
@ -79,9 +79,9 @@ class KRHomeLastDayCard extends GetView<KRHomeController> {
|
|||||||
Icon(
|
Icon(
|
||||||
Icons.timer_outlined,
|
Icons.timer_outlined,
|
||||||
color: Colors.blue,
|
color: Colors.blue,
|
||||||
size: 16.w,
|
size: 16,
|
||||||
),
|
),
|
||||||
SizedBox(width: 4.w),
|
SizedBox(width: 4),
|
||||||
Text(
|
Text(
|
||||||
AppTranslations.kr_home.lastDaySubscriptionMessage,
|
AppTranslations.kr_home.lastDaySubscriptionMessage,
|
||||||
style: KrAppTextStyle(
|
style: KrAppTextStyle(
|
||||||
@ -93,7 +93,7 @@ class KRHomeLastDayCard extends GetView<KRHomeController> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(width: 12.w),
|
SizedBox(width: 12),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
|||||||
@ -16,16 +16,16 @@ class KRHomeTrialCard extends GetView<KRHomeController> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return Container(
|
||||||
margin: EdgeInsets.symmetric(horizontal: 16.w),
|
margin: EdgeInsets.symmetric(horizontal: 16),
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
decoration: ShapeDecoration(
|
decoration: ShapeDecoration(
|
||||||
color: Theme.of(context).cardColor,
|
color: Theme.of(context).cardColor,
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(16.w),
|
borderRadius: BorderRadius.circular(16),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.all(14.w),
|
padding: EdgeInsets.all(14),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
@ -55,7 +55,7 @@ class KRHomeTrialCard extends GetView<KRHomeController> {
|
|||||||
),
|
),
|
||||||
Icon(
|
Icon(
|
||||||
Icons.arrow_forward_ios,
|
Icons.arrow_forward_ios,
|
||||||
size: 12.w,
|
size: 12,
|
||||||
color: Colors.blue,
|
color: Colors.blue,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -65,14 +65,14 @@ class KRHomeTrialCard extends GetView<KRHomeController> {
|
|||||||
),
|
),
|
||||||
|
|
||||||
// 倒计时显示
|
// 倒计时显示
|
||||||
SizedBox(height: 10.h),
|
SizedBox(height: 10),
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
padding: EdgeInsets.all(8.w),
|
padding: EdgeInsets.all(8),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.blue.withOpacity(0.1),
|
color: Colors.blue.withOpacity(0.1),
|
||||||
borderRadius: BorderRadius.circular(8.w),
|
borderRadius: BorderRadius.circular(8),
|
||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
@ -80,9 +80,9 @@ class KRHomeTrialCard extends GetView<KRHomeController> {
|
|||||||
Icon(
|
Icon(
|
||||||
Icons.timer_outlined,
|
Icons.timer_outlined,
|
||||||
color: Colors.blue,
|
color: Colors.blue,
|
||||||
size: 16.w,
|
size: 16,
|
||||||
),
|
),
|
||||||
SizedBox(width: 4.w),
|
SizedBox(width: 4),
|
||||||
Text(
|
Text(
|
||||||
AppTranslations.kr_home.trialing,
|
AppTranslations.kr_home.trialing,
|
||||||
style: KrAppTextStyle(
|
style: KrAppTextStyle(
|
||||||
@ -94,7 +94,7 @@ class KRHomeTrialCard extends GetView<KRHomeController> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(width: 12.w),
|
SizedBox(width: 12),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
|||||||
@ -29,47 +29,45 @@ class KRSubscriptionCard extends StatelessWidget {
|
|||||||
print('🎴 [SubscriptionCard] 卡片颜色: ${Theme.of(context).cardColor}');
|
print('🎴 [SubscriptionCard] 卡片颜色: ${Theme.of(context).cardColor}');
|
||||||
print('🎴 [SubscriptionCard] 主题亮度: ${Theme.of(context).brightness}');
|
print('🎴 [SubscriptionCard] 主题亮度: ${Theme.of(context).brightness}');
|
||||||
print('🎴 [SubscriptionCard] 文本颜色: ${Theme.of(context).textTheme.bodyMedium?.color}');
|
print('🎴 [SubscriptionCard] 文本颜色: ${Theme.of(context).textTheme.bodyMedium?.color}');
|
||||||
print('🎴 [SubscriptionCard] ScreenUtil - 12.w=${12.w}, 16.h=${16.h}, 44.w=${44.w}');
|
print('🎴 [SubscriptionCard] ScreenUtil 测试 - 12.w=${12.w}, 16.h=${16.h}, 44.w=${44.w}');
|
||||||
|
|
||||||
// 🔧 关键修复:添加最小高度约束和调试边框
|
// 🔧 关键修复:完全移除 ScreenUtil,使用固定像素值避免缩放问题
|
||||||
return Container(
|
return Container(
|
||||||
// 添加最小高度,确保卡片可见
|
// 添加固定高度,确保卡片可见
|
||||||
constraints: const BoxConstraints(minHeight: 180),
|
constraints: const BoxConstraints(minHeight: 200),
|
||||||
|
padding: const EdgeInsets.all(16),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Theme.of(context).cardColor,
|
color: Theme.of(context).cardColor,
|
||||||
borderRadius: BorderRadius.circular(12.w),
|
borderRadius: BorderRadius.circular(12),
|
||||||
// 🔧 添加边框用于调试可见性
|
|
||||||
border: Border.all(
|
|
||||||
color: Colors.blue.withOpacity(0.3),
|
|
||||||
width: 2,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
|
// 图标
|
||||||
Container(
|
Container(
|
||||||
width: 44.w,
|
width: 48,
|
||||||
height: 44.w,
|
height: 48,
|
||||||
margin: EdgeInsets.only(top: 16.h),
|
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.blue.withOpacity(0.1),
|
color: Colors.blue.withOpacity(0.1),
|
||||||
shape: BoxShape.circle,
|
shape: BoxShape.circle,
|
||||||
),
|
),
|
||||||
child: Icon(
|
child: const Icon(
|
||||||
Icons.language,
|
Icons.language,
|
||||||
color: Colors.blue,
|
color: Colors.blue,
|
||||||
size: 26.w,
|
size: 28,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(height: 12.h),
|
const SizedBox(height: 16),
|
||||||
|
// 描述文字
|
||||||
Padding(
|
Padding(
|
||||||
padding: EdgeInsets.symmetric(horizontal: 16.w),
|
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||||
child: Text(
|
child: Text(
|
||||||
AppTranslations.kr_home.subscriptionDescription,
|
AppTranslations.kr_home.subscriptionDescription,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: KrAppTextStyle(
|
style: TextStyle(
|
||||||
fontSize: 14,
|
fontSize: 15,
|
||||||
fontWeight: FontWeight.w400,
|
fontWeight: FontWeight.w400,
|
||||||
|
height: 1.5,
|
||||||
// 🔧 关键修复:确保文本颜色可见
|
// 🔧 关键修复:确保文本颜色可见
|
||||||
color: Theme.of(context).brightness == Brightness.dark
|
color: Theme.of(context).brightness == Brightness.dark
|
||||||
? Colors.white
|
? Colors.white
|
||||||
@ -77,28 +75,29 @@ class KRSubscriptionCard extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(height: 16.h),
|
const SizedBox(height: 20),
|
||||||
Padding(
|
// 订阅按钮
|
||||||
padding: EdgeInsets.fromLTRB(16.w, 0, 16.w, 16.h),
|
SizedBox(
|
||||||
child: SizedBox(
|
width: double.infinity,
|
||||||
width: double.infinity,
|
height: 46,
|
||||||
height: 42.h,
|
child: ElevatedButton(
|
||||||
child: ElevatedButton(
|
onPressed: () {
|
||||||
onPressed: () => KRSubscribeNavigationUtil.navigateToPurchase(tag: 'SubscriptionCard'),
|
print('🎴 [SubscriptionCard] 订阅按钮被点击');
|
||||||
style: ElevatedButton.styleFrom(
|
KRSubscribeNavigationUtil.navigateToPurchase(tag: 'SubscriptionCard');
|
||||||
backgroundColor: Colors.blue,
|
},
|
||||||
elevation: 0,
|
style: ElevatedButton.styleFrom(
|
||||||
shape: RoundedRectangleBorder(
|
backgroundColor: Colors.blue,
|
||||||
borderRadius: BorderRadius.circular(8.r),
|
elevation: 0,
|
||||||
),
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
),
|
),
|
||||||
child: Text(
|
),
|
||||||
AppTranslations.kr_home.subscribe,
|
child: Text(
|
||||||
style: KrAppTextStyle(
|
AppTranslations.kr_home.subscribe,
|
||||||
fontSize: 16,
|
style: const TextStyle(
|
||||||
fontWeight: FontWeight.w500,
|
fontSize: 16,
|
||||||
color: Colors.white,
|
fontWeight: FontWeight.w500,
|
||||||
),
|
color: Colors.white,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user