Compare commits

..

No commits in common. "f1e8e7f53093e6cd1b176df5d3b7e86f42a30368" and "cf297caf09a6b9e658b67f5c08f0b1e179385f7d" have entirely different histories.

15 changed files with 132 additions and 262 deletions

View File

@ -1,4 +1,4 @@
org.gradle.jvmargs=-Xlint:-options
org.gradle.jvmargs=-Xmx4048m -Dfile.encoding=UTF-8
android.useAndroidX=true
android.enableJetifier=true
# org.gradle.java.home=/Users/mac/Library/Java/JavaVirtualMachines/ms-17.0.16/Contents/Home

View File

@ -4,7 +4,6 @@ import '../utils/kr_update_util.dart';
import '../utils/kr_secure_storage.dart';
import '../utils/kr_log_util.dart';
import '../services/singbox_imp/kr_sing_box_imp.dart';
import '../utils/kr_init_log_collector.dart'; // 🔧
import 'dart:async';
import 'dart:convert';
import 'dart:io';
@ -1338,17 +1337,10 @@ class AppConfig {
KRUpdateApplication? kr_update_application;
// 🔧
final _initLog = KRInitLogCollector();
Future<void> initConfig({
Future<void> Function()? onSuccess,
}) async {
_initLog.logSeparator();
_initLog.log('🌐 开始应用配置初始化(域名加载)', tag: 'Domain');
if (_isInitializing) {
_initLog.logWarning('配置初始化已在进行中,跳过重复调用', tag: 'Domain');
KRLogUtil.kr_w('配置初始化已在进行中,跳过重复调用', tag: 'AppConfig');
return;
}
@ -1356,13 +1348,10 @@ class AppConfig {
_isInitializing = true;
try {
// 🔧 6
_initLog.log('开始加载基础域名配置', tag: 'Domain');
await KRDomain.kr_loadBaseDomain();
_initLog.logSuccess('当前使用域名: ${KRDomain.kr_currentDomain}', tag: 'Domain');
KRLogUtil.kr_i('📍 当前使用域名: ${KRDomain.kr_currentDomain}', tag: 'AppConfig');
//
_initLog.log('开始配置请求流程(包含重试机制)', tag: 'Domain');
KRLogUtil.kr_i('🚀 开始配置初始化', tag: 'AppConfig');
await _startAutoRetry(onSuccess);
} finally {
@ -1413,32 +1402,24 @@ class AppConfig {
return;
}
_initLog.log('发起配置请求 API (尝试 $totalAttempts/$maxTotalAttempts)', tag: 'Domain');
final result = await _kr_userApi.kr_config();
result.fold(
(error) async {
_initLog.logError('配置请求失败 (重试 $currentRetryCount/$kr_maxRetryCount)', tag: 'Domain', error: error);
KRLogUtil.kr_e('配置初始化失败: $error', tag: 'AppConfig');
currentRetryCount++;
//
final retryDelay = (kr_retryInterval * pow(kr_backoffFactor, currentRetryCount)).toInt();
final actualDelay = max(retryDelay, 100);
_initLog.log('将在 ${actualDelay}ms 后重试', tag: 'Domain');
//
_initLog.log('尝试切换到下一个备用域名', tag: 'Domain');
await KRDomain.kr_switchToNextDomain();
_initLog.log('当前域名: ${KRDomain.kr_currentDomain}', tag: 'Domain');
//
// 100ms避免立即重试
final actualDelay = max(retryDelay, 100);
await Future.delayed(Duration(milliseconds: actualDelay));
await executeConfigRequest();
},
(config) async {
_initLog.logSuccess('配置请求成功!', tag: 'Domain');
_initLog.log('网站ID: ${config.kr_website_id}', tag: 'Domain');
_initLog.log('官网: ${config.kr_official_website}', tag: 'Domain');
_retryTimer?.cancel();
currentRetryCount = 0;

View File

@ -2,7 +2,6 @@ import 'dart:async';
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:path_provider/path_provider.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:get/get.dart';
import 'package:kaer_with_panels/app/common/app_run_data.dart';
@ -31,11 +30,8 @@ import 'package:kaer_with_panels/app/utils/kr_common_util.dart';
import 'package:kaer_with_panels/app/utils/kr_secure_storage.dart';
import 'package:kaer_with_panels/app/services/singbox_imp/kr_sing_box_imp.dart';
import 'package:flutter/foundation.dart';
import 'package:kaer_with_panels/app/utils/kr_init_log_collector.dart'; // 🔧
class KRHomeController extends GetxController with WidgetsBindingObserver {
// 🔧
final _initLog = KRInitLogCollector();
///
final KRSubscribeService kr_subscribeService = KRSubscribeService();
@ -282,20 +278,16 @@ class KRHomeController extends GetxController with WidgetsBindingObserver {
void _kr_initLoginStatus() {
_initLog.log('开始初始化登录状态处理', tag: 'Home');
KRLogUtil.kr_i('初始化登录状态', tag: 'HomeController');
// 🔧 Android 15 8
Timer(const Duration(seconds: 8), () {
if (kr_currentListStatus.value == KRHomeViewsListStatus.kr_loading) {
_initLog.logWarning('⏱️ 订阅加载超时(8秒保护),强制设置为无数据状态', tag: 'Subscribe');
_initLog.log('当前列表状态仍为: loading触发超时保护', tag: 'Subscribe');
KRLogUtil.kr_w('⏱️ 订阅服务初始化超时(8秒),强制设置为无数据状态', tag: 'HomeController');
// 🔧 Android 15 none error
kr_currentListStatus.value = KRHomeViewsListStatus.kr_none;
//
kr_updateBottomPanelHeight();
_initLog.log('已强制切换到默认视图, 底部面板高度: ${kr_bottomPanelHeight.value}', tag: 'Subscribe');
KRLogUtil.kr_i('✅ 已强制切换到默认视图', tag: 'HomeController');
}
});
@ -303,7 +295,6 @@ class KRHomeController extends GetxController with WidgetsBindingObserver {
// 🔧 Android 15 3
Timer(const Duration(seconds: 3), () {
if (kr_currentListStatus.value == KRHomeViewsListStatus.kr_loading) {
_initLog.logWarning('⚠️ 订阅服务已加载3秒网络可能较慢', tag: 'Subscribe');
KRLogUtil.kr_w('⚠️ 订阅服务初始化已耗时3秒可能网络较慢', tag: 'HomeController');
}
});

View File

@ -66,22 +66,12 @@ class KRHomeBottomPanel extends GetView<KRHomeController> {
final isNotLoggedIn = controller.kr_currentViewStatus.value ==
KRHomeViewsStatus.kr_notLoggedIn;
KRLogUtil.kr_i('=' * 60, tag: 'HomeBottomPanel');
KRLogUtil.kr_i('🎨 构建默认视图', tag: 'HomeBottomPanel');
KRLogUtil.kr_i('构建默认视图', tag: 'HomeBottomPanel');
KRLogUtil.kr_i('是否未登录: $isNotLoggedIn', tag: 'HomeBottomPanel');
KRLogUtil.kr_i('是否有有效订阅: $hasValidSubscription', tag: 'HomeBottomPanel');
KRLogUtil.kr_i('订阅列表数量: ${controller.kr_subscribeService.kr_availableSubscribes.length}', tag: 'HomeBottomPanel');
KRLogUtil.kr_i('当前选中订阅: ${controller.kr_subscribeService.kr_currentSubscribe.value?.name ?? "null"}', tag: 'HomeBottomPanel');
KRLogUtil.kr_i('是否试用: $isTrial', tag: 'HomeBottomPanel');
KRLogUtil.kr_i('当前高度: ${controller.kr_bottomPanelHeight.value}', tag: 'HomeBottomPanel');
// 🔧 UI
if (hasValidSubscription) {
KRLogUtil.kr_i('✅ 将渲染: 连接信息卡片 (KRHomeConnectionInfoView)', tag: 'HomeBottomPanel');
} else {
KRLogUtil.kr_i('✅ 将渲染: 订阅卡片 (KRSubscriptionCard) - 开通会员界面', tag: 'HomeBottomPanel');
}
KRLogUtil.kr_i('=' * 60, tag: 'HomeBottomPanel');
KRLogUtil.kr_i('当前高度: ${controller.kr_bottomPanelHeight.value}',
tag: 'HomeBottomPanel');
// 🔧 UI
return Column(
@ -96,41 +86,35 @@ class KRHomeBottomPanel extends GetView<KRHomeController> {
// 🔧
if (hasValidSubscription)
//
Builder(builder: (context) {
KRLogUtil.kr_i('🔹 渲染连接信息卡片margin top: ${12}', tag: 'HomeBottomPanel');
return Container(
margin: EdgeInsets.only(top: 12),
child: const KRHomeConnectionInfoView(),
);
})
Container(
margin: EdgeInsets.only(top: 12.h),
child: const KRHomeConnectionInfoView(),
)
else
//
Builder(builder: (context) {
KRLogUtil.kr_i('🔹 渲染订阅卡片margin: top=${12}, left=${12}, right=${12}', tag: 'HomeBottomPanel');
return Container(
margin: EdgeInsets.only(top: 12, left: 12, right: 12),
child: const KRSubscriptionCard(),
);
}),
Container(
margin: EdgeInsets.only(top: 12.h, left: 12.w, right: 12.w),
child: const KRSubscriptionCard(),
),
// 2.
if (hasValidSubscription && isTrial)
Container(
margin: EdgeInsets.only(top: 12),
margin: EdgeInsets.only(top: 12.h),
child: const KRHomeTrialCard(),
),
// 3.
if (hasValidSubscription && isLastDay && !isTrial)
Container(
margin: EdgeInsets.only(top: 12),
margin: EdgeInsets.only(top: 12.h),
child: const KRHomeLastDayCard(),
),
// 4. -
const Padding(
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 12),
child: KRHomeConnectionOptionsView(),
Padding(
padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 12.h),
child: const KRHomeConnectionOptionsView(),
),
],
),
@ -157,7 +141,7 @@ class KRHomeBottomPanel extends GetView<KRHomeController> {
//
Center(
child: Container(
padding: EdgeInsets.all(16),
padding: EdgeInsets.all(16.w),
decoration: BoxDecoration(
color: Get.context!.theme.cardColor,
borderRadius: BorderRadius.circular(12.r),
@ -176,7 +160,7 @@ class KRHomeBottomPanel extends GetView<KRHomeController> {
color: Colors.green,
strokeWidth: 3.0,
),
SizedBox(height: 12),
SizedBox(height: 12.h),
Text(
'正在加载...',
style: TextStyle(
@ -194,18 +178,18 @@ class KRHomeBottomPanel extends GetView<KRHomeController> {
Widget _kr_buildErrorView(BuildContext context) {
return Container(
height: 200,
padding: EdgeInsets.all(16),
height: 200.h,
padding: EdgeInsets.all(16.w),
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(
Icons.error_outline,
size: 48,
size: 48.w,
color: Theme.of(context).colorScheme.error,
),
SizedBox(height: 16),
SizedBox(height: 16.h),
Text(
AppTranslations.kr_home.error,
style: KrAppTextStyle(
@ -214,7 +198,7 @@ class KRHomeBottomPanel extends GetView<KRHomeController> {
color: Theme.of(context).textTheme.bodyMedium?.color,
),
),
SizedBox(height: 8),
SizedBox(height: 8.h),
Text(
AppTranslations.kr_home.checkNetwork,
style: KrAppTextStyle(
@ -222,10 +206,10 @@ class KRHomeBottomPanel extends GetView<KRHomeController> {
color: Theme.of(context).textTheme.bodySmall?.color,
),
),
SizedBox(height: 24),
SizedBox(height: 24.h),
SizedBox(
width: 200,
height: 44,
width: 200.w,
height: 44.h,
child: ElevatedButton(
onPressed: () => controller.kr_refreshAll(),
style: ElevatedButton.styleFrom(

View File

@ -25,17 +25,17 @@ class KRHomeConnectionInfoView extends GetView<KRHomeController> {
Widget _buildConnectCard(BuildContext context) {
return Obx(() {
return Container(
margin: EdgeInsets.symmetric(horizontal: 16),
margin: EdgeInsets.symmetric(horizontal: 16.w),
width: double.infinity,
height: 116,
height: 116.h,
decoration: ShapeDecoration(
color: Theme.of(context).cardColor,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16),
borderRadius: BorderRadius.circular(16.w),
),
),
child: Padding(
padding: EdgeInsets.all(14),
padding: EdgeInsets.all(14.w),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@ -66,7 +66,7 @@ class KRHomeConnectionInfoView extends GetView<KRHomeController> {
),
Icon(
Icons.arrow_forward_ios,
size: 12,
size: 12.w,
color: Theme.of(context).textTheme.bodySmall?.color,
),
],
@ -74,7 +74,7 @@ class KRHomeConnectionInfoView extends GetView<KRHomeController> {
),
],
),
SizedBox(height: 10),
SizedBox(height: 10.h),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
@ -90,7 +90,7 @@ class KRHomeConnectionInfoView extends GetView<KRHomeController> {
countryCode: countryCode,
);
}),
SizedBox(width: 10),
SizedBox(width: 10.w),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@ -102,7 +102,7 @@ class KRHomeConnectionInfoView extends GetView<KRHomeController> {
fontWeight: FontWeight.w500,
),
),
SizedBox(height: 6),
SizedBox(height: 6.h),
Row(
children: [
Obx(() {
@ -147,10 +147,10 @@ class KRHomeConnectionInfoView extends GetView<KRHomeController> {
children: [
KRSimpleLoading(
color: Colors.green,
size: 12,
size: 12.w,
duration: const Duration(milliseconds: 800),
),
SizedBox(width: 2),
SizedBox(width: 2.w),
Text(
AppTranslations.kr_home.connecting,
style: TextStyle(
@ -166,7 +166,7 @@ class KRHomeConnectionInfoView extends GetView<KRHomeController> {
return Row(
children: [
Icon(Icons.signal_cellular_alt,
size: 12,
size: 12.w,
color: getLatencyColor(delay)),
SizedBox(width: 2),
Text(
@ -188,9 +188,9 @@ class KRHomeConnectionInfoView extends GetView<KRHomeController> {
}
return Row(
children: [
SizedBox(width: 10),
SizedBox(width: 10.w),
Icon(Icons.arrow_upward,
size: 12,
size: 12.w,
color: Theme.of(context).textTheme.bodySmall?.color),
Text(
controller.kr_formatBytes(KRSingBoxImp.instance.kr_stats.value.uplink),
@ -200,9 +200,9 @@ class KRHomeConnectionInfoView extends GetView<KRHomeController> {
fontWeight: FontWeight.w400,
),
),
SizedBox(width: 10),
SizedBox(width: 10.w),
Icon(Icons.arrow_downward,
size: 12,
size: 12.w,
color: Theme.of(context).textTheme.bodySmall?.color),
Text(
controller.kr_formatBytes(KRSingBoxImp.instance.kr_stats.value.downlink),

View File

@ -14,23 +14,19 @@ class KRHomeConnectionOptionsView extends GetView<KRHomeController> {
@override
Widget build(BuildContext context) {
print('🔌 [ConnectionOptions] 开始构建连接选项组件');
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text(
AppTranslations.kr_home.connectionSectionTitle,
style: TextStyle(
style: KrAppTextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
color: Theme.of(context).brightness == Brightness.dark
? Colors.white
: Colors.black87,
color: Theme.of(context).textTheme.bodyMedium?.color,
),
),
const SizedBox(height: 12),
SizedBox(height: 8.h),
_buildConnectionOption(
"home_ct",
AppTranslations.kr_home.countryRegion,
@ -45,11 +41,8 @@ class KRHomeConnectionOptionsView extends GetView<KRHomeController> {
Widget _buildConnectionOption(String icon, String label, BuildContext context,
{VoidCallback? onTap}) {
print('🔌 [ConnectionOptions] 构建连接选项: $label');
return GestureDetector(
onTap: () {
print('🔌 [ConnectionOptions] 选项被点击: $label');
if (controller.kr_subscribeService.kr_currentSubscribe.value == null) {
// 使
KRSubscribeNavigationUtil.navigateToPurchase(tag: 'ConnectionOptions');
@ -59,34 +52,30 @@ class KRHomeConnectionOptionsView extends GetView<KRHomeController> {
}
},
child: Container(
padding: const EdgeInsets.all(16),
padding: EdgeInsets.all(16.w),
decoration: BoxDecoration(
color: Theme.of(context).cardColor,
borderRadius: BorderRadius.circular(12),
borderRadius: BorderRadius.circular(12.r),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
KrLocalImage(
imageName: icon,
width: 36,
height: 36,
color: Theme.of(context).brightness == Brightness.dark
? Colors.white70
: Colors.black87,
width: 32.w,
height: 32.w,
color: Theme.of(context).textTheme.bodyMedium?.color,
),
const SizedBox(height: 12),
SizedBox(height: 12.h),
Row(
children: [
Expanded(
child: Text(
label,
style: TextStyle(
fontSize: 14,
style: KrAppTextStyle(
fontSize: 13,
fontWeight: FontWeight.w500,
color: Theme.of(context).brightness == Brightness.dark
? Colors.white
: Colors.black87,
color: Theme.of(context).textTheme.bodyMedium?.color,
),
maxLines: 2,
overflow: TextOverflow.ellipsis,
@ -94,10 +83,8 @@ class KRHomeConnectionOptionsView extends GetView<KRHomeController> {
),
Icon(
Icons.arrow_forward_ios,
size: 14,
color: Theme.of(context).brightness == Brightness.dark
? Colors.white54
: Colors.black45,
size: 12.w,
color: Theme.of(context).textTheme.bodySmall?.color,
),
],
),

View File

@ -15,16 +15,16 @@ class KRHomeLastDayCard extends GetView<KRHomeController> {
@override
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.symmetric(horizontal: 16),
margin: EdgeInsets.symmetric(horizontal: 16.w),
width: double.infinity,
decoration: ShapeDecoration(
color: Theme.of(context).cardColor,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16),
borderRadius: BorderRadius.circular(16.w),
),
),
child: Padding(
padding: EdgeInsets.all(14),
padding: EdgeInsets.all(14.w),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
@ -54,7 +54,7 @@ class KRHomeLastDayCard extends GetView<KRHomeController> {
),
Icon(
Icons.arrow_forward_ios,
size: 12,
size: 12.w,
color: Colors.blue,
),
],
@ -64,14 +64,14 @@ class KRHomeLastDayCard extends GetView<KRHomeController> {
),
//
SizedBox(height: 10),
SizedBox(height: 10.h),
Row(
children: [
Container(
padding: EdgeInsets.all(8),
padding: EdgeInsets.all(8.w),
decoration: BoxDecoration(
color: Colors.blue.withOpacity(0.1),
borderRadius: BorderRadius.circular(8),
borderRadius: BorderRadius.circular(8.w),
),
child: Row(
mainAxisSize: MainAxisSize.min,
@ -79,9 +79,9 @@ class KRHomeLastDayCard extends GetView<KRHomeController> {
Icon(
Icons.timer_outlined,
color: Colors.blue,
size: 16,
size: 16.w,
),
SizedBox(width: 4),
SizedBox(width: 4.w),
Text(
AppTranslations.kr_home.lastDaySubscriptionMessage,
style: KrAppTextStyle(
@ -93,7 +93,7 @@ class KRHomeLastDayCard extends GetView<KRHomeController> {
],
),
),
SizedBox(width: 12),
SizedBox(width: 12.w),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,

View File

@ -16,16 +16,16 @@ class KRHomeTrialCard extends GetView<KRHomeController> {
@override
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.symmetric(horizontal: 16),
margin: EdgeInsets.symmetric(horizontal: 16.w),
width: double.infinity,
decoration: ShapeDecoration(
color: Theme.of(context).cardColor,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16),
borderRadius: BorderRadius.circular(16.w),
),
),
child: Padding(
padding: EdgeInsets.all(14),
padding: EdgeInsets.all(14.w),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
@ -55,7 +55,7 @@ class KRHomeTrialCard extends GetView<KRHomeController> {
),
Icon(
Icons.arrow_forward_ios,
size: 12,
size: 12.w,
color: Colors.blue,
),
],
@ -65,14 +65,14 @@ class KRHomeTrialCard extends GetView<KRHomeController> {
),
//
SizedBox(height: 10),
SizedBox(height: 10.h),
Row(
children: [
Container(
padding: EdgeInsets.all(8),
padding: EdgeInsets.all(8.w),
decoration: BoxDecoration(
color: Colors.blue.withOpacity(0.1),
borderRadius: BorderRadius.circular(8),
borderRadius: BorderRadius.circular(8.w),
),
child: Row(
mainAxisSize: MainAxisSize.min,
@ -80,9 +80,9 @@ class KRHomeTrialCard extends GetView<KRHomeController> {
Icon(
Icons.timer_outlined,
color: Colors.blue,
size: 16,
size: 16.w,
),
SizedBox(width: 4),
SizedBox(width: 4.w),
Text(
AppTranslations.kr_home.trialing,
style: KrAppTextStyle(
@ -94,7 +94,7 @@ class KRHomeTrialCard extends GetView<KRHomeController> {
],
),
),
SizedBox(width: 12),
SizedBox(width: 12.w),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,

View File

@ -24,80 +24,63 @@ class KRSubscriptionCard extends StatelessWidget {
//
Widget _kr_buildSubscriptionCard(BuildContext context) {
// 🔧
print('🎴 [SubscriptionCard] 开始构建订阅卡片');
print('🎴 [SubscriptionCard] 卡片颜色: ${Theme.of(context).cardColor}');
print('🎴 [SubscriptionCard] 主题亮度: ${Theme.of(context).brightness}');
print('🎴 [SubscriptionCard] 文本颜色: ${Theme.of(context).textTheme.bodyMedium?.color}');
print('🎴 [SubscriptionCard] ScreenUtil 测试 - 12.w=${12.w}, 16.h=${16.h}, 44.w=${44.w}');
// 🔧 ScreenUtil使
return Container(
//
constraints: const BoxConstraints(minHeight: 200),
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: Theme.of(context).cardColor,
borderRadius: BorderRadius.circular(12),
borderRadius: BorderRadius.circular(12.w),
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
//
Container(
width: 48,
height: 48,
width: 44.w,
height: 44.w,
margin: EdgeInsets.only(top: 16.h),
decoration: BoxDecoration(
color: Colors.blue.withOpacity(0.1),
shape: BoxShape.circle,
),
child: const Icon(
child: Icon(
Icons.language,
color: Colors.blue,
size: 28,
size: 26.w,
),
),
const SizedBox(height: 16),
//
SizedBox(height: 12.h),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
padding: EdgeInsets.symmetric(horizontal: 16.w),
child: Text(
AppTranslations.kr_home.subscriptionDescription,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 15,
style: KrAppTextStyle(
fontSize: 14,
fontWeight: FontWeight.w400,
height: 1.5,
// 🔧
color: Theme.of(context).brightness == Brightness.dark
? Colors.white
: Colors.black87,
color: Theme.of(context).textTheme.bodyMedium?.color,
),
),
),
const SizedBox(height: 20),
//
SizedBox(
width: double.infinity,
height: 46,
child: ElevatedButton(
onPressed: () {
print('🎴 [SubscriptionCard] 订阅按钮被点击');
KRSubscribeNavigationUtil.navigateToPurchase(tag: 'SubscriptionCard');
},
style: ElevatedButton.styleFrom(
backgroundColor: Colors.blue,
elevation: 0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
SizedBox(height: 16.h),
Padding(
padding: EdgeInsets.fromLTRB(16.w, 0, 16.w, 16.h),
child: SizedBox(
width: double.infinity,
height: 42.h,
child: ElevatedButton(
onPressed: () => KRSubscribeNavigationUtil.navigateToPurchase(tag: 'SubscriptionCard'),
style: ElevatedButton.styleFrom(
backgroundColor: Colors.blue,
elevation: 0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.r),
),
),
),
child: Text(
AppTranslations.kr_home.subscribe,
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
color: Colors.white,
child: Text(
AppTranslations.kr_home.subscribe,
style: KrAppTextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
color: Colors.white,
),
),
),
),

View File

@ -1,5 +1,4 @@
import 'package:get/get.dart';
import 'package:flutter/foundation.dart' show kDebugMode;
import 'package:kaer_with_panels/app/modules/kr_home/controllers/kr_home_controller.dart';
import 'package:kaer_with_panels/app/modules/kr_invite/controllers/kr_invite_controller.dart';
import 'package:kaer_with_panels/app/modules/kr_login/controllers/kr_login_controller.dart';
@ -11,40 +10,15 @@ import '../controllers/kr_main_controller.dart';
class KRMainBinding extends Bindings {
@override
void dependencies() {
if (kDebugMode) {
print('🔧 KRMainBinding.dependencies 被调用');
}
// 🔧 MainController 使 lazyPut MainView
Get.lazyPut<KRMainController>(
() {
if (kDebugMode) {
print('🏗️ 创建 KRMainController 实例');
}
return KRMainController();
},
);
// 🔧 使 lazyPut
// fenix: true
// 使 lazyPut HomeController
Get.lazyPut<KRHomeController>(
() {
if (kDebugMode) {
print('🏗️ 创建 KRHomeController 实例(仅此一次)');
}
return KRHomeController();
},
fenix: true,
() => KRMainController(),
);
Get.lazyPut(() => KRHomeController());
Get.lazyPut(() => KRLoginController());
Get.lazyPut(() => KRInviteController());
Get.lazyPut(() => KRUserInfoController());
Get.lazyPut(() => KRStatisticsController());
if (kDebugMode) {
print('✅ KRMainBinding.dependencies 完成');
}
}
}

View File

@ -1,5 +1,4 @@
import 'package:flutter/widgets.dart';
import 'package:flutter/foundation.dart' show kDebugMode;
import 'package:get/get.dart';
import 'package:kaer_with_panels/app/modules/kr_home/views/kr_home_view.dart';
import 'package:kaer_with_panels/app/modules/kr_invite/views/kr_invite_view.dart';
@ -31,33 +30,19 @@ class KRMainController extends GetxController {
static KRMainController get to => Get.find();
DateTime? lastPopTime;
var kr_currentIndex = 0.obs;
late final List<Widget> widgets;
final List<Widget> widgets = [
KRKeepAliveWrapper(KRHomeView()),
KRKeepAliveWrapper(KRInviteView()),
KRKeepAliveWrapper(KRStatisticsView()),
KRKeepAliveWrapper(KRUserInfoView()),
];
///
PageController pageController = PageController(keepPage: true);
@override
void onInit() {
super.onInit();
// 🔧 onInit widgets
if (kDebugMode) {
print('🎬 KRMainController.onInit 被调用');
print('📝 开始创建 widgets 列表...');
}
widgets = [
KRKeepAliveWrapper(KRHomeView()),
KRKeepAliveWrapper(KRInviteView()),
KRKeepAliveWrapper(KRStatisticsView()),
KRKeepAliveWrapper(KRUserInfoView()),
];
if (kDebugMode) {
print('✅ widgets 列表创建完成,包含 ${widgets.length} 个页面');
}
}

View File

@ -555,11 +555,11 @@ class KRPurchaseMembershipView extends GetView<KRPurchaseMembershipController> {
//
Widget _kr_buildAccountSection(BuildContext context) {
return Container(
margin: EdgeInsets.all(16),
padding: EdgeInsets.all(16),
margin: EdgeInsets.all(16.r),
padding: EdgeInsets.all(16.r),
decoration: BoxDecoration(
color: Theme.of(context).cardColor,
borderRadius: BorderRadius.circular(12),
borderRadius: BorderRadius.circular(12.r),
),
child: Row(
children: [

View File

@ -517,12 +517,10 @@ class KRSplashController extends GetxController {
_initLog.log('Token存在: $hasToken', tag: 'Splash');
_initLog.logSuccess('正常初始化流程完成', tag: 'Splash');
// 🔧
// HomeController
// HomeController
// await _initLog.finalize(); //
//
await _initLog.finalize();
if (kDebugMode && _initLog.getLogFilePath() != null) {
print('📁 初始化日志文件(保持打开): ${_initLog.getLogFilePath()}');
print('📁 初始化日志文件: ${_initLog.getLogFilePath()}');
}
//
@ -551,8 +549,8 @@ class KRSplashController extends GetxController {
kr_hasError.value = true;
kr_errorMessage.value = '${AppTranslations.kr_splash.kr_initializationFailed}$e';
// 🔧
// await _initLog.finalize(); //
//
await _initLog.finalize();
}
}

View File

@ -66,7 +66,7 @@ class AppPages {
),
GetPage(
name: _Paths.KR_HOME,
page: () => KRHomeView(),
page: () => const KRHomeView(),
binding: KRHomeBinding(),
arguments: {'showSubscriptionButton': true}, //
customTransition: SlideOutOnlyTransition(

View File

@ -42,20 +42,7 @@ class KRSubscribeNavigationUtil {
} else {
// -
KRLogUtil.kr_i('普通用户,跳转到购买页面', tag: tag);
try {
// 🔧
Get.toNamed(Routes.KR_PURCHASE_MEMBERSHIP);
} catch (e) {
KRLogUtil.kr_e('跳转购买页面失败: $e', tag: tag);
//
KRDialog.show(
title: AppTranslations.kr_dialog.error,
message: AppTranslations.kr_home.checkNetwork,
confirmText: AppTranslations.kr_dialog.kr_ok,
onConfirm: () => Get.back(),
);
}
Get.toNamed(Routes.KR_PURCHASE_MEMBERSHIP);
}
}
}