安卓15部分机型出现界面不兼容并且UI库有BUG,MD
Some checks failed
Build Android APK / 编译 libcore.aar (push) Has been cancelled
Build Android APK / 编译 Android APK (release) (push) Has been cancelled
Build Android APK / 创建 GitHub Release (push) Has been cancelled
Build Multi-Platform / 编译 libcore (iOS/tvOS) (push) Has been cancelled
Build Multi-Platform / 编译 libcore (Android) (push) Has been cancelled
Build Multi-Platform / 编译 libcore (Windows) (push) Has been cancelled
Build Multi-Platform / 编译 libcore (macOS) (push) Has been cancelled
Build Multi-Platform / 编译 libcore (Linux) (push) Has been cancelled
Build Multi-Platform / 构建 Android APK (push) Has been cancelled
Build Multi-Platform / 构建 Windows (push) Has been cancelled
Build Multi-Platform / 构建 macOS (push) Has been cancelled
Build Multi-Platform / 构建 Linux (push) Has been cancelled
Build Multi-Platform / 构建 iOS (push) Has been cancelled
Build Multi-Platform / 创建 Release (push) Has been cancelled
Build Windows / 编译 libcore (Windows) (push) Has been cancelled
Build Windows / build (push) Has been cancelled

(cherry picked from commit 010405edda74bdb0251dcff2e32482edae2c9976)
This commit is contained in:
Rust 2025-11-02 02:38:07 -08:00 committed by speakeloudest
parent 0ec2f72a93
commit 7a223d614b
7 changed files with 96 additions and 314 deletions

View File

@ -1255,7 +1255,7 @@ class AppConfig {
/// ///
/// - Beta true /// - Beta true
/// - false /// - false
static const bool enableInitLogCollection = true; static const bool enableInitLogCollection = false;
/// ///
/// ///

View File

@ -528,8 +528,7 @@ class KRHomeController extends GetxController with WidgetsBindingObserver {
// //
ever(KRSingBoxImp.instance.kr_status, (status) { ever(KRSingBoxImp.instance.kr_status, (status) {
if (kDebugMode) { if (kDebugMode) {
print('🔵 Controller 收到状态变化: ${status.runtimeType}'); }
}
KRLogUtil.kr_i('🔄 连接状态变化: $status', tag: 'HomeController'); KRLogUtil.kr_i('🔄 连接状态变化: $status', tag: 'HomeController');
KRLogUtil.kr_i('📊 当前状态类型: ${status.runtimeType}', tag: 'HomeController'); KRLogUtil.kr_i('📊 当前状态类型: ${status.runtimeType}', tag: 'HomeController');
@ -558,8 +557,7 @@ class KRHomeController extends GetxController with WidgetsBindingObserver {
case SingboxStarted(): case SingboxStarted():
KRLogUtil.kr_i('🟢 状态: 已启动', tag: 'HomeController'); KRLogUtil.kr_i('🟢 状态: 已启动', tag: 'HomeController');
if (kDebugMode) { if (kDebugMode) {
print('🔵 状态变为 Started, 当前延迟=${kr_currentNodeLatency.value}'); }
}
// //
_cancelConnectionTimeout(); _cancelConnectionTimeout();
@ -572,13 +570,11 @@ class KRHomeController extends GetxController with WidgetsBindingObserver {
// 🔧 -1(),0() // 🔧 -1(),0()
if (kr_currentNodeLatency.value == -1) { if (kr_currentNodeLatency.value == -1) {
if (kDebugMode) { if (kDebugMode) {
print('🔵 强制将延迟从 -1 更新为 0'); }
}
kr_currentNodeLatency.value = 0; kr_currentNodeLatency.value = 0;
kr_currentNodeLatency.refresh(); // kr_currentNodeLatency.refresh(); //
if (kDebugMode) { if (kDebugMode) {
print('🔵 延迟值已刷新'); }
}
} }
// 🔧 // 🔧
@ -589,8 +585,7 @@ class KRHomeController extends GetxController with WidgetsBindingObserver {
// UI // UI
update(); update();
if (kDebugMode) { if (kDebugMode) {
print('🔵 状态更新完成,当前延迟=${kr_currentNodeLatency.value}'); }
}
break; break;
case SingboxStopping(): case SingboxStopping():
KRLogUtil.kr_i('🟠 状态: 正在停止', tag: 'HomeController'); KRLogUtil.kr_i('🟠 状态: 正在停止', tag: 'HomeController');
@ -677,15 +672,13 @@ class KRHomeController extends GetxController with WidgetsBindingObserver {
KRLogUtil.kr_i('🔵 toggleSwitch 被调用: value=$value, currentStatus=$currentStatus', tag: 'HomeController'); KRLogUtil.kr_i('🔵 toggleSwitch 被调用: value=$value, currentStatus=$currentStatus', tag: 'HomeController');
if (kDebugMode) { if (kDebugMode) {
print('🔵 toggleSwitch: value=$value, currentStatus=$currentStatus'); }
}
// 🔧 : hiddify-app "switching status, debounce" // 🔧 : hiddify-app "switching status, debounce"
if (currentStatus is SingboxStarting || currentStatus is SingboxStopping) { if (currentStatus is SingboxStarting || currentStatus is SingboxStopping) {
KRLogUtil.kr_i('🔄 正在切换中,忽略本次操作 (当前状态: $currentStatus)', tag: 'HomeController'); KRLogUtil.kr_i('🔄 正在切换中,忽略本次操作 (当前状态: $currentStatus)', tag: 'HomeController');
if (kDebugMode) { if (kDebugMode) {
print('🔵 忽略操作:正在切换中'); }
}
return; return;
} }
@ -694,13 +687,11 @@ class KRHomeController extends GetxController with WidgetsBindingObserver {
// //
KRLogUtil.kr_i('🔄 开始连接...', tag: 'HomeController'); KRLogUtil.kr_i('🔄 开始连接...', tag: 'HomeController');
if (kDebugMode) { if (kDebugMode) {
print('🔵 执行 kr_start()'); }
}
await KRSingBoxImp.instance.kr_start(); await KRSingBoxImp.instance.kr_start();
KRLogUtil.kr_i('✅ 连接命令已发送', tag: 'HomeController'); KRLogUtil.kr_i('✅ 连接命令已发送', tag: 'HomeController');
if (kDebugMode) { if (kDebugMode) {
print('🔵 kr_start() 完成'); }
}
// 🔧 : 3 // 🔧 : 3
await _waitForStatus(SingboxStarted, maxSeconds: 3); await _waitForStatus(SingboxStarted, maxSeconds: 3);
@ -708,8 +699,7 @@ class KRHomeController extends GetxController with WidgetsBindingObserver {
// //
KRLogUtil.kr_i('🛑 开始断开连接...', tag: 'HomeController'); KRLogUtil.kr_i('🛑 开始断开连接...', tag: 'HomeController');
if (kDebugMode) { if (kDebugMode) {
print('🔵 执行 kr_stop()'); }
}
await KRSingBoxImp.instance.kr_stop().timeout( await KRSingBoxImp.instance.kr_stop().timeout(
const Duration(seconds: 10), const Duration(seconds: 10),
onTimeout: () { onTimeout: () {
@ -719,8 +709,7 @@ class KRHomeController extends GetxController with WidgetsBindingObserver {
); );
KRLogUtil.kr_i('✅ 断开命令已发送', tag: 'HomeController'); KRLogUtil.kr_i('✅ 断开命令已发送', tag: 'HomeController');
if (kDebugMode) { if (kDebugMode) {
print('🔵 kr_stop() 完成'); }
}
// 🔧 : 2 // 🔧 : 2
await _waitForStatus(SingboxStopped, maxSeconds: 2); await _waitForStatus(SingboxStopped, maxSeconds: 2);
@ -728,34 +717,29 @@ class KRHomeController extends GetxController with WidgetsBindingObserver {
} catch (e) { } catch (e) {
KRLogUtil.kr_e('❌ 切换失败: $e', tag: 'HomeController'); KRLogUtil.kr_e('❌ 切换失败: $e', tag: 'HomeController');
if (kDebugMode) { if (kDebugMode) {
print('🔵 切换失败: $e'); }
}
// //
kr_forceSyncConnectionStatus(); kr_forceSyncConnectionStatus();
} }
if (kDebugMode) { if (kDebugMode) {
print('🔵 toggleSwitch 完成,当前 kr_isConnected=${kr_isConnected.value}'); }
}
} }
/// 🔧 /// 🔧
Future<void> _waitForStatus(Type expectedType, {int maxSeconds = 3}) async { Future<void> _waitForStatus(Type expectedType, {int maxSeconds = 3}) async {
if (kDebugMode) { if (kDebugMode) {
print('🔵 等待状态变为: $expectedType'); }
}
final startTime = DateTime.now(); final startTime = DateTime.now();
while (DateTime.now().difference(startTime).inSeconds < maxSeconds) { while (DateTime.now().difference(startTime).inSeconds < maxSeconds) {
final currentStatus = KRSingBoxImp.instance.kr_status.value; final currentStatus = KRSingBoxImp.instance.kr_status.value;
if (kDebugMode) { if (kDebugMode) {
print('🔵 当前状态: ${currentStatus.runtimeType}'); }
}
if (currentStatus.runtimeType == expectedType) { if (currentStatus.runtimeType == expectedType) {
if (kDebugMode) { if (kDebugMode) {
print('🔵 状态已达到: $expectedType'); }
}
// kr_isConnected // kr_isConnected
kr_forceSyncConnectionStatus(); kr_forceSyncConnectionStatus();
return; return;
@ -765,8 +749,7 @@ class KRHomeController extends GetxController with WidgetsBindingObserver {
} }
if (kDebugMode) { if (kDebugMode) {
print('🔵 等待超时,强制同步状态'); }
}
kr_forceSyncConnectionStatus(); kr_forceSyncConnectionStatus();
} }

View File

@ -12,8 +12,6 @@ import '../widgets/kr_subscription_card.dart';
import 'kr_home_trial_card.dart'; import 'kr_home_trial_card.dart';
import 'kr_home_last_day_card.dart'; import 'kr_home_last_day_card.dart';
import '../../../utils/kr_log_util.dart'; import '../../../utils/kr_log_util.dart';
import 'dart:io';
import 'package:path_provider/path_provider.dart';
class KRHomeBottomPanel extends GetView<KRHomeController> { class KRHomeBottomPanel extends GetView<KRHomeController> {
const KRHomeBottomPanel({super.key}); const KRHomeBottomPanel({super.key});
@ -109,25 +107,6 @@ class KRHomeBottomPanel extends GetView<KRHomeController> {
Builder(builder: (context) { Builder(builder: (context) {
KRLogUtil.kr_i('🔹 渲染订阅卡片margin: top=${12}, left=${12}, right=${12}', tag: 'HomeBottomPanel'); KRLogUtil.kr_i('🔹 渲染订阅卡片margin: top=${12}, left=${12}, right=${12}', tag: 'HomeBottomPanel');
// 🔧 UI
Future.microtask(() async {
try {
final dir = await getApplicationDocumentsDirectory();
final debugFile = File('${dir.path}/SUBSCRIPTION_CARD_RENDER_DEBUG.txt');
await debugFile.writeAsString(
'=' * 60 + '\n'
'🔹 订阅卡片正在渲染!\n'
'时间: ${DateTime.now()}\n'
'版本标识: Android15_Fix_v6_Final\n'
'=' * 60 + '\n',
mode: FileMode.append,
);
print('🔹 [BottomPanel] ✅ 订阅卡片渲染日志已写入文件: ${debugFile.path}');
} catch (e) {
print('🔹 [BottomPanel] ❌ 写入订阅卡片渲染日志失败: $e');
}
});
return Container( return Container(
margin: EdgeInsets.only(top: 12, left: 12, right: 12), margin: EdgeInsets.only(top: 12, left: 12, right: 12),
child: const KRSubscriptionCard(), child: const KRSubscriptionCard(),

View File

@ -1,7 +1,6 @@
import 'dart:math'; import 'dart:math';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:kaer_with_panels/app/localization/app_translations.dart'; import 'package:kaer_with_panels/app/localization/app_translations.dart';
import 'package:kaer_with_panels/app/widgets/kr_app_text_style.dart'; import 'package:kaer_with_panels/app/widgets/kr_app_text_style.dart';
import 'package:kaer_with_panels/app/widgets/kr_country_flag.dart'; import 'package:kaer_with_panels/app/widgets/kr_country_flag.dart';
@ -71,20 +70,20 @@ class KRHomeNodeListView extends GetView<KRHomeController> {
/// ///
Widget _buildServerList(BuildContext context) { Widget _buildServerList(BuildContext context) {
return Container( return Container(
width: ScreenUtil().screenWidth, width: MediaQuery.of(context).size.width,
height: 360.h, // height: 360, //
decoration: BoxDecoration( decoration: BoxDecoration(
color: Theme.of(context).primaryColor, color: Theme.of(context).primaryColor,
borderRadius: BorderRadius.only( borderRadius: BorderRadius.only(
topLeft: Radius.circular(20.w), topLeft: Radius.circular(20),
topRight: Radius.circular(20.w), topRight: Radius.circular(20),
), ),
), ),
child: Column( child: Column(
children: [ children: [
// //
Padding( Padding(
padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 12.h), padding: EdgeInsets.symmetric(horizontal: 16, vertical: 12),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
@ -103,7 +102,7 @@ class KRHomeNodeListView extends GetView<KRHomeController> {
}, },
child: Icon( child: Icon(
Icons.close, Icons.close,
size: 24.w, size: 24,
color: Theme.of(context).textTheme.bodyMedium?.color, color: Theme.of(context).textTheme.bodyMedium?.color,
), ),
), ),
@ -125,19 +124,19 @@ class KRHomeNodeListView extends GetView<KRHomeController> {
); );
} }
return ListView.builder( return ListView.builder(
padding: EdgeInsets.symmetric(horizontal: 16.w), padding: EdgeInsets.symmetric(horizontal: 16),
itemCount: controller.kr_subscribeService.groupOutboundList.length, itemCount: controller.kr_subscribeService.groupOutboundList.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
final group = final group =
controller.kr_subscribeService.groupOutboundList[index]; controller.kr_subscribeService.groupOutboundList[index];
return Container( return Container(
margin: EdgeInsets.only(bottom: 8.w), margin: EdgeInsets.only(bottom: 8),
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( border: Border.all(
color: Theme.of(context).dividerColor.withOpacity(0.1), color: Theme.of(context).dividerColor.withOpacity(0.1),
width: 1.w, width: 1,
), ),
), ),
child: InkWell( child: InkWell(
@ -146,18 +145,18 @@ class KRHomeNodeListView extends GetView<KRHomeController> {
controller.kr_currentListStatus.value = controller.kr_currentListStatus.value =
KRHomeViewsListStatus.kr_serverSubscribeList; KRHomeViewsListStatus.kr_serverSubscribeList;
}, },
borderRadius: BorderRadius.circular(12.w), borderRadius: BorderRadius.circular(12),
child: Padding( child: Padding(
padding: EdgeInsets.all(12.w), padding: EdgeInsets.all(12),
child: Row( child: Row(
children: [ children: [
KRNetworkImage( KRNetworkImage(
kr_imageUrl: group.icon, kr_imageUrl: group.icon,
kr_width: 32.w, kr_width: 32,
kr_height: 32.w, kr_height: 32,
kr_fit: BoxFit.cover, kr_fit: BoxFit.cover,
), ),
SizedBox(width: 12.w), SizedBox(width: 12),
Expanded( Expanded(
child: Text( child: Text(
group.tag, group.tag,
@ -171,7 +170,7 @@ class KRHomeNodeListView extends GetView<KRHomeController> {
), ),
Icon( Icon(
Icons.arrow_forward_ios, Icons.arrow_forward_ios,
size: 16.w, size: 16,
color: Theme.of(context).textTheme.bodySmall?.color, color: Theme.of(context).textTheme.bodySmall?.color,
), ),
], ],
@ -208,7 +207,7 @@ class KRHomeNodeListView extends GetView<KRHomeController> {
return _kr_buildListContainer( return _kr_buildListContainer(
context, context,
child: ListView.builder( child: ListView.builder(
padding: EdgeInsets.fromLTRB(16.w, 8.w, 16.w, 0), padding: EdgeInsets.fromLTRB(16, 8, 16, 0),
itemCount: itemCount:
controller.kr_subscribeService.countryOutboundList.length, controller.kr_subscribeService.countryOutboundList.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
@ -222,15 +221,15 @@ class KRHomeNodeListView extends GetView<KRHomeController> {
country.isExpand.value = !country.isExpand.value; country.isExpand.value = !country.isExpand.value;
}, },
child: Container( child: Container(
padding: EdgeInsets.symmetric(vertical: 12.h), padding: EdgeInsets.symmetric(vertical: 12),
child: Row( child: Row(
children: [ children: [
KRCountryFlag( KRCountryFlag(
countryCode: country.country, countryCode: country.country,
width: 40.w, width: 40,
height: 40.w, height: 40,
), ),
SizedBox(width: 12.w), SizedBox(width: 12),
Expanded( Expanded(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
@ -255,7 +254,7 @@ class KRHomeNodeListView extends GetView<KRHomeController> {
country.isExpand.value country.isExpand.value
? Icons.keyboard_arrow_down ? Icons.keyboard_arrow_down
: Icons.arrow_forward_ios, : Icons.arrow_forward_ios,
size: 16.w, size: 16,
color: color:
Theme.of(context).textTheme.bodySmall?.color, Theme.of(context).textTheme.bodySmall?.color,
); );
@ -272,7 +271,7 @@ class KRHomeNodeListView extends GetView<KRHomeController> {
return ListView.builder( return ListView.builder(
shrinkWrap: true, shrinkWrap: true,
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
padding: EdgeInsets.only(left: 24.w), padding: EdgeInsets.only(left: 24),
itemCount: country.outboundList.length, itemCount: country.outboundList.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
final server = country.outboundList[index]; final server = country.outboundList[index];
@ -311,13 +310,13 @@ class KRHomeNodeListView extends GetView<KRHomeController> {
}, },
child: Container( child: Container(
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
vertical: 8.h, vertical: 8,
horizontal: 16.w, horizontal: 16,
), ),
decoration: BoxDecoration( decoration: BoxDecoration(
// //
color: Theme.of(context).cardColor, color: Theme.of(context).cardColor,
borderRadius: BorderRadius.circular(8.w), borderRadius: BorderRadius.circular(8),
), ),
child: _kr_buildNodeListItem( child: _kr_buildNodeListItem(
context, context,
@ -328,9 +327,9 @@ class KRHomeNodeListView extends GetView<KRHomeController> {
// 线 // 线
if (index < country.outboundList.length - 1) if (index < country.outboundList.length - 1)
Divider( Divider(
height: 1.w, height: 1,
indent: 16.w, indent: 16,
endIndent: 16.w, endIndent: 16,
color: Theme.of(context) color: Theme.of(context)
.dividerColor .dividerColor
.withOpacity(0.1), .withOpacity(0.1),
@ -341,7 +340,7 @@ class KRHomeNodeListView extends GetView<KRHomeController> {
); );
}), }),
Divider( Divider(
height: 1.w, height: 1,
color: Theme.of(context).dividerColor.withOpacity(0.1), color: Theme.of(context).dividerColor.withOpacity(0.1),
), ),
], ],
@ -377,7 +376,7 @@ class KRHomeNodeListView extends GetView<KRHomeController> {
return _kr_buildListContainer( return _kr_buildListContainer(
context, context,
child: ListView.builder( child: ListView.builder(
padding: EdgeInsets.fromLTRB(16.w, 16.w, 16.w, 0), padding: EdgeInsets.fromLTRB(16, 16, 16, 0),
itemCount: servers.length, itemCount: servers.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
final server = servers[index]; final server = servers[index];
@ -406,7 +405,7 @@ class KRHomeNodeListView extends GetView<KRHomeController> {
} }
}, },
child: Container( child: Container(
padding: EdgeInsets.symmetric(vertical: 4.h), padding: EdgeInsets.symmetric(vertical: 4),
child: _kr_buildNodeListItem( child: _kr_buildNodeListItem(
context, context,
item: server, item: server,
@ -415,7 +414,7 @@ class KRHomeNodeListView extends GetView<KRHomeController> {
), ),
if (index < servers.length - 1) if (index < servers.length - 1)
Divider( Divider(
height: 1.w, height: 1,
color: Theme.of(context).dividerColor.withOpacity(0.1), color: Theme.of(context).dividerColor.withOpacity(0.1),
), ),
], ],
@ -435,12 +434,12 @@ class KRHomeNodeListView extends GetView<KRHomeController> {
required Widget listContent, required Widget listContent,
}) { }) {
return Container( return Container(
width: ScreenUtil().screenWidth, width: MediaQuery.of(context).size.width,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Theme.of(context).primaryColor, color: Theme.of(context).primaryColor,
borderRadius: BorderRadius.only( borderRadius: BorderRadius.only(
topLeft: Radius.circular(20.w), topLeft: Radius.circular(20),
topRight: Radius.circular(20.w), topRight: Radius.circular(20),
), ),
), ),
child: Column( child: Column(
@ -453,13 +452,13 @@ class KRHomeNodeListView extends GetView<KRHomeController> {
onClose: () => onClose: () =>
controller.kr_currentListStatus.value = KRHomeViewsListStatus.kr_none, controller.kr_currentListStatus.value = KRHomeViewsListStatus.kr_none,
), ),
SizedBox(height: 16.h), SizedBox(height: 16),
Expanded( Expanded(
child: Column( child: Column(
children: [ children: [
Expanded(child: listContent), Expanded(child: listContent),
// //
SizedBox(height: 12.h), SizedBox(height: 12),
], ],
), ),
), ),
@ -476,7 +475,7 @@ class KRHomeNodeListView extends GetView<KRHomeController> {
VoidCallback? onClose, VoidCallback? onClose,
}) { }) {
return Padding( return Padding(
padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 16.w), padding: EdgeInsets.only(left: 16, right: 16, top: 16),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
@ -487,11 +486,11 @@ class KRHomeNodeListView extends GetView<KRHomeController> {
onTap: onBack, onTap: onBack,
child: Icon( child: Icon(
Icons.arrow_back_ios, Icons.arrow_back_ios,
size: 20.w, size: 20,
color: Theme.of(context).textTheme.bodyMedium?.color, color: Theme.of(context).textTheme.bodyMedium?.color,
), ),
), ),
SizedBox(width: 8.w), SizedBox(width: 8),
], ],
Text( Text(
title, title,
@ -508,7 +507,7 @@ class KRHomeNodeListView extends GetView<KRHomeController> {
onTap: onClose, onTap: onClose,
child: Icon( child: Icon(
Icons.close, Icons.close,
size: 24.w, size: 24,
color: Theme.of(context).textTheme.bodyMedium?.color, color: Theme.of(context).textTheme.bodyMedium?.color,
), ),
), ),
@ -524,10 +523,10 @@ class KRHomeNodeListView extends GetView<KRHomeController> {
required Widget child, required Widget child,
}) { }) {
return Container( return Container(
margin: EdgeInsets.symmetric(horizontal: 16.w), margin: EdgeInsets.symmetric(horizontal: 16),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Theme.of(context).cardColor, color: Theme.of(context).cardColor,
borderRadius: BorderRadius.circular(12.w), borderRadius: BorderRadius.circular(12),
), ),
child: child, child: child,
); );
@ -553,17 +552,17 @@ class KRHomeNodeListView extends GetView<KRHomeController> {
return Container( return Container(
key: ValueKey(item.id), key: ValueKey(item.id),
padding: EdgeInsets.symmetric(vertical: 8.h), padding: EdgeInsets.symmetric(vertical: 8),
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
// 🔧 // 🔧
KRCountryFlag( KRCountryFlag(
countryCode: item.country, countryCode: item.country,
width: 36.w, width: 36,
height: 36.w, height: 36,
), ),
SizedBox(width: 8.w), SizedBox(width: 8),
Expanded( Expanded(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
@ -582,12 +581,12 @@ class KRHomeNodeListView extends GetView<KRHomeController> {
Obx( Obx(
() => controller.kr_cutTag.value == item.tag () => controller.kr_cutTag.value == item.tag
? Container( ? Container(
margin: EdgeInsets.only(left: 4.w), margin: EdgeInsets.only(left: 4),
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
horizontal: 4.w, vertical: 1.h), horizontal: 4, vertical: 1),
decoration: BoxDecoration( decoration: BoxDecoration(
color: krModernGreenLight.withOpacity(0.1), color: krModernGreenLight.withOpacity(0.1),
borderRadius: BorderRadius.circular(4.w), borderRadius: BorderRadius.circular(4),
), ),
child: Text( child: Text(
AppTranslations.kr_home.selected, AppTranslations.kr_home.selected,
@ -602,7 +601,7 @@ class KRHomeNodeListView extends GetView<KRHomeController> {
), ),
], ],
), ),
SizedBox(height: 2.h), SizedBox(height: 2),
Text( Text(
item.city, item.city,
style: KrAppTextStyle( style: KrAppTextStyle(
@ -669,20 +668,20 @@ class KRHomeNodeListView extends GetView<KRHomeController> {
return _kr_buildListContainer( return _kr_buildListContainer(
context, context,
child: ListView( child: ListView(
padding: EdgeInsets.fromLTRB(16.w, 0, 16.w, 0), padding: EdgeInsets.fromLTRB(16, 0, 16, 0),
children: [ children: [
// //
InkWell( InkWell(
onTap: () => controller.kr_urlTest(), onTap: () => controller.kr_urlTest(),
child: Container( child: Container(
padding: EdgeInsets.symmetric(vertical: 8.h), padding: EdgeInsets.symmetric(vertical: 8),
margin: EdgeInsets.only(top: 8.w), // margin: EdgeInsets.only(top: 8), //
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Container( Container(
width: 36.w, width: 36,
height: 36.w, height: 36,
decoration: BoxDecoration( decoration: BoxDecoration(
color: krModernGreenLight.withOpacity(0.1), color: krModernGreenLight.withOpacity(0.1),
shape: BoxShape.circle, shape: BoxShape.circle,
@ -691,17 +690,17 @@ class KRHomeNodeListView extends GetView<KRHomeController> {
child: controller.kr_isLatency.value child: controller.kr_isLatency.value
? KRSimpleLoading( ? KRSimpleLoading(
color: krModernGreen, color: krModernGreen,
size: 24.w, size: 24,
duration: const Duration(milliseconds: 800), duration: const Duration(milliseconds: 800),
) )
: Icon( : Icon(
Icons.speed, Icons.speed,
size: 24.w, size: 24,
color: krModernGreen, color: krModernGreen,
), ),
), ),
), ),
SizedBox(width: 8.w), SizedBox(width: 8),
Expanded( Expanded(
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
@ -728,7 +727,7 @@ class KRHomeNodeListView extends GetView<KRHomeController> {
), ),
), ),
if (!controller.kr_isLatency.value) ...[ if (!controller.kr_isLatency.value) ...[
SizedBox(height: 2.h), SizedBox(height: 2),
Text( Text(
AppTranslations.kr_home.refreshLatencyDesc, AppTranslations.kr_home.refreshLatencyDesc,
style: KrAppTextStyle( style: KrAppTextStyle(
@ -746,7 +745,7 @@ class KRHomeNodeListView extends GetView<KRHomeController> {
if (!controller.kr_isLatency.value) if (!controller.kr_isLatency.value)
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,
), ),
], ],
@ -755,7 +754,7 @@ class KRHomeNodeListView extends GetView<KRHomeController> {
), ),
// 线 // 线
Divider( Divider(
height: 16.w, height: 16,
color: Theme.of(context).dividerColor.withOpacity(0.1), color: Theme.of(context).dividerColor.withOpacity(0.1),
), ),
// Auto // Auto
@ -775,19 +774,19 @@ class KRHomeNodeListView extends GetView<KRHomeController> {
} }
}, },
child: Container( child: Container(
padding: EdgeInsets.symmetric(vertical: 8.h), padding: EdgeInsets.symmetric(vertical: 8),
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
KrLocalImage( KrLocalImage(
imageName: "home_list_location", imageName: "home_list_location",
width: 36.w, width: 36,
height: 36.w, height: 36,
color: controller.kr_cutTag.value == 'auto' color: controller.kr_cutTag.value == 'auto'
? Colors.green ? Colors.green
: null, : null,
), ),
SizedBox(width: 8.w), SizedBox(width: 8),
Expanded( Expanded(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
@ -808,13 +807,13 @@ class KRHomeNodeListView extends GetView<KRHomeController> {
), ),
if (controller.kr_cutTag.value == 'auto') if (controller.kr_cutTag.value == 'auto')
Container( Container(
margin: EdgeInsets.only(left: 4.w), margin: EdgeInsets.only(left: 4),
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
horizontal: 4.w, vertical: 1.h), horizontal: 4, vertical: 1),
decoration: BoxDecoration( decoration: BoxDecoration(
color: color:
krModernGreenLight.withOpacity(0.1), krModernGreenLight.withOpacity(0.1),
borderRadius: BorderRadius.circular(4.w), borderRadius: BorderRadius.circular(4),
), ),
child: Text( child: Text(
AppTranslations.kr_home.selected, AppTranslations.kr_home.selected,
@ -827,7 +826,7 @@ class KRHomeNodeListView extends GetView<KRHomeController> {
), ),
], ],
), ),
SizedBox(height: 2.h), SizedBox(height: 2),
Obx(() { Obx(() {
// //
String selectedNode = String selectedNode =
@ -903,7 +902,7 @@ class KRHomeNodeListView extends GetView<KRHomeController> {
), ),
// 线 // 线
Divider( Divider(
height: 16.w, height: 16,
color: Theme.of(context).dividerColor.withOpacity(0.1), color: Theme.of(context).dividerColor.withOpacity(0.1),
), ),
// //
@ -929,7 +928,7 @@ class KRHomeNodeListView extends GetView<KRHomeController> {
} }
}, },
child: Container( child: Container(
padding: EdgeInsets.symmetric(vertical: 4.h), padding: EdgeInsets.symmetric(vertical: 4),
child: _kr_buildNodeListItem( child: _kr_buildNodeListItem(
context, context,
item: node, item: node,
@ -939,7 +938,7 @@ class KRHomeNodeListView extends GetView<KRHomeController> {
if (node != if (node !=
controller.kr_subscribeService.allList.last) controller.kr_subscribeService.allList.last)
Divider( Divider(
height: 1.w, height: 1,
color: Theme.of(context) color: Theme.of(context)
.dividerColor .dividerColor
.withOpacity(0.1), .withOpacity(0.1),

View File

@ -1,12 +1,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:kaer_with_panels/app/localization/app_translations.dart'; import 'package:kaer_with_panels/app/localization/app_translations.dart';
import 'dart:io';
import 'package:path_provider/path_provider.dart';
import 'package:kaer_with_panels/app/routes/app_pages.dart'; import 'package:kaer_with_panels/app/routes/app_pages.dart';
import 'package:kaer_with_panels/app/utils/kr_subscribe_navigation_util.dart'; import 'package:kaer_with_panels/app/utils/kr_subscribe_navigation_util.dart';
import '../../../widgets/kr_app_text_style.dart'; import '../../../widgets/kr_app_text_style.dart';
/// ///
@ -25,12 +21,6 @@ class KRSubscriptionCard extends StatelessWidget {
// //
Widget _kr_buildSubscriptionCard(BuildContext context) { 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}');
// 🔧 ScreenUtil使 // 🔧 ScreenUtil使
return Container( return Container(
// //
@ -82,36 +72,7 @@ class KRSubscriptionCard extends StatelessWidget {
height: 46, height: 46,
child: ElevatedButton( child: ElevatedButton(
onPressed: () { onPressed: () {
print('🎴 [SubscriptionCard] ========== 订阅按钮被点击 =========='); KRSubscribeNavigationUtil.navigateToPurchase(tag: 'SubscriptionCard');
print('🎴 [SubscriptionCard] 当前时间: ${DateTime.now()}');
print('🎴 [SubscriptionCard] 准备调用导航方法...');
// 🔧
Future(() async {
try {
final dir = await getApplicationDocumentsDirectory();
final debugFile = File('${dir.path}/SUBSCRIBE_BUTTON_DEBUG.txt');
await debugFile.writeAsString(
'=' * 60 + '\n'
'🎴 订阅按钮被点击!\n'
'时间: ${DateTime.now()}\n'
'版本标识: Android15_Fix_v6_Final\n'
'=' * 60 + '\n',
mode: FileMode.append,
);
print('🎴 [SubscriptionCard] ✅ 按钮点击日志已写入文件: ${debugFile.path}');
} catch (e) {
print('🎴 [SubscriptionCard] ❌ 写入按钮点击日志失败: $e');
}
});
try {
KRSubscribeNavigationUtil.navigateToPurchase(tag: 'SubscriptionCard');
print('🎴 [SubscriptionCard] 导航方法调用成功');
} catch (e, stackTrace) {
print('🎴 [SubscriptionCard] ❌ 导航方法调用失败: $e');
print('🎴 [SubscriptionCard] StackTrace: $stackTrace');
}
}, },
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
backgroundColor: Colors.blue, backgroundColor: Colors.blue,

View File

@ -4,8 +4,6 @@ import 'package:kaer_with_panels/app/widgets/dialogs/kr_dialog.dart';
import 'package:kaer_with_panels/app/routes/app_pages.dart'; import 'package:kaer_with_panels/app/routes/app_pages.dart';
import 'package:kaer_with_panels/app/utils/kr_log_util.dart'; import 'package:kaer_with_panels/app/utils/kr_log_util.dart';
import 'package:kaer_with_panels/app/localization/app_translations.dart'; import 'package:kaer_with_panels/app/localization/app_translations.dart';
import 'dart:io';
import 'package:path_provider/path_provider.dart';
/// ///
/// ///
@ -16,143 +14,38 @@ class KRSubscribeNavigationUtil {
/// ///
/// [tag] /// [tag]
static void navigateToPurchase({String tag = 'Subscribe'}) { static void navigateToPurchase({String tag = 'Subscribe'}) {
print('🔔 [NavigationUtil] ========== navigateToPurchase 被调用 ==========');
print('🔔 [NavigationUtil] Tag: $tag');
print('🔔 [NavigationUtil] 当前时间: ${DateTime.now()}');
// 🔧
final appRunData = KRAppRunData.getInstance(); final appRunData = KRAppRunData.getInstance();
final isDeviceLogin = appRunData.isDeviceLogin(); final isDeviceLogin = appRunData.isDeviceLogin();
final account = appRunData.kr_account.value; final account = appRunData.kr_account.value;
print('🔔 [NavigationUtil] 账号: $account');
print('🔔 [NavigationUtil] 是否设备登录: $isDeviceLogin');
KRLogUtil.kr_i('=== 订阅按钮点击 ===', tag: tag); KRLogUtil.kr_i('=== 订阅按钮点击 ===', tag: tag);
KRLogUtil.kr_i('账号: $account', tag: tag); KRLogUtil.kr_i('账号: $account', tag: tag);
KRLogUtil.kr_i('是否设备登录: $isDeviceLogin', tag: tag); KRLogUtil.kr_i('是否设备登录: $isDeviceLogin', tag: tag);
// 🔧
Future(() async {
try {
final dir = await getApplicationDocumentsDirectory();
final debugFile = File('${dir.path}/NAVIGATION_DEBUG.txt');
await debugFile.writeAsString(
'=' * 60 + '\n'
'🔔 navigateToPurchase 被调用!\n'
'时间: ${DateTime.now()}\n'
'来源: $tag\n'
'账号: $account\n'
'是否设备登录: $isDeviceLogin\n'
'版本标识: Android15_Fix_v7_DialogFixed\n'
'=' * 60 + '\n',
mode: FileMode.append,
);
} catch (e) {
print('🔔 [NavigationUtil] ❌ 写入导航日志失败: $e');
}
});
// 🔧 v7 -
// v6
// KRDialog ScreenUtil
if (isDeviceLogin) { if (isDeviceLogin) {
// - // -
print('🔔 [NavigationUtil] ⚠️ 检测到设备登录,显示绑定账号提示对话框');
KRLogUtil.kr_i('设备登录用户,显示绑定提示', tag: tag); KRLogUtil.kr_i('设备登录用户,显示绑定提示', tag: tag);
Future(() async {
try {
final dir = await getApplicationDocumentsDirectory();
final debugFile = File('${dir.path}/NAVIGATION_DEBUG.txt');
await debugFile.writeAsString(
'⚠️ 检测到设备登录,准备显示对话框\n'
'账号: $account\n'
'时间: ${DateTime.now()}\n'
'版本标识: Android15_Fix_v7_DialogFixed\n'
'-' * 60 + '\n',
mode: FileMode.append,
);
} catch (e) { /* 忽略 */ }
});
try { try {
print('🔔 [NavigationUtil] 📍 正在调用 KRDialog.show() 显示绑定提示...');
KRDialog.show( KRDialog.show(
title: AppTranslations.kr_dialog.deviceLoginBindingTitle, title: AppTranslations.kr_dialog.deviceLoginBindingTitle,
message: AppTranslations.kr_dialog.deviceLoginBindingMessage, message: AppTranslations.kr_dialog.deviceLoginBindingMessage,
confirmText: AppTranslations.kr_dialog.kr_ok, confirmText: AppTranslations.kr_dialog.kr_ok,
onConfirm: () { onConfirm: () {
print('🔔 [NavigationUtil] 用户点击确认,跳转到登录页面');
Get.toNamed(Routes.MR_LOGIN); Get.toNamed(Routes.MR_LOGIN);
}, },
); );
print('🔔 [NavigationUtil] 📍 KRDialog.show() 调用完成');
} catch (e) { } catch (e) {
KRLogUtil.kr_e('显示绑定提示对话框失败: $e', tag: tag); KRLogUtil.kr_e('显示绑定提示对话框失败: $e', tag: tag);
print('🔔 [NavigationUtil] ❌ 显示对话框异常: $e');
} }
} else { } else {
// - // -
print('🔔 [NavigationUtil] ✅ 普通用户,准备跳转到购买页面');
KRLogUtil.kr_i('普通用户,跳转到购买页面', tag: tag); KRLogUtil.kr_i('普通用户,跳转到购买页面', tag: tag);
Future(() async {
try {
final dir = await getApplicationDocumentsDirectory();
final debugFile = File('${dir.path}/NAVIGATION_DEBUG.txt');
await debugFile.writeAsString(
'✅ 普通用户,准备调用 Get.toNamed\n'
'路由: ${Routes.KR_PURCHASE_MEMBERSHIP}\n'
'时间: ${DateTime.now()}\n'
'版本标识: Android15_Fix_v7_DialogFixed\n'
'-' * 60 + '\n',
mode: FileMode.append,
);
} catch (e) { /* 忽略 */ }
});
try { try {
print('🔔 [NavigationUtil] 📍 步骤1: 正在调用 Get.toNamed(${Routes.KR_PURCHASE_MEMBERSHIP})...'); Get.toNamed(Routes.KR_PURCHASE_MEMBERSHIP);
final result = Get.toNamed(Routes.KR_PURCHASE_MEMBERSHIP);
print('🔔 [NavigationUtil] 📍 步骤2: Get.toNamed 调用完成,返回值: $result');
Future(() async {
try {
final dir = await getApplicationDocumentsDirectory();
final debugFile = File('${dir.path}/NAVIGATION_DEBUG.txt');
await debugFile.writeAsString(
'✅ Get.toNamed 执行完成\n'
'路由: ${Routes.KR_PURCHASE_MEMBERSHIP}\n'
'返回值: $result\n'
'时间: ${DateTime.now()}\n'
'-' * 60 + '\n',
mode: FileMode.append,
);
} catch (e) {
print('🔔 [NavigationUtil] ❌ 写入跳转完成日志失败: $e');
}
});
} catch (e) { } catch (e) {
KRLogUtil.kr_e('跳转购买页面失败: $e', tag: tag); KRLogUtil.kr_e('跳转购买页面失败: $e', tag: tag);
print('🔔 [NavigationUtil] ❌❌❌ 跳转异常: $e');
Future(() async {
try {
final dir = await getApplicationDocumentsDirectory();
final debugFile = File('${dir.path}/NAVIGATION_DEBUG.txt');
await debugFile.writeAsString(
'❌ Get.toNamed 执行失败\n'
'异常: $e\n'
'时间: ${DateTime.now()}\n'
'-' * 60 + '\n',
mode: FileMode.append,
);
} catch (e) {
print('🔔 [NavigationUtil] ❌ 写入跳转失败日志失败: $e');
}
});
// //
KRDialog.show( KRDialog.show(

View File

@ -1,8 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:kaer_with_panels/app/localization/app_translations.dart'; import 'package:kaer_with_panels/app/localization/app_translations.dart';
import 'dart:io';
import 'package:path_provider/path_provider.dart';
class KRDialog extends StatelessWidget { class KRDialog extends StatelessWidget {
final String? title; final String? title;
@ -36,31 +34,6 @@ class KRDialog extends StatelessWidget {
Widget? icon, Widget? icon,
Widget? customMessageWidget, Widget? customMessageWidget,
}) { }) {
// 🔧 Android 15
print('📢 [KRDialog] ========== KRDialog.show() 被调用 ==========');
print('📢 [KRDialog] 标题: $title');
print('📢 [KRDialog] 消息: $message');
print('📢 [KRDialog] 当前时间: ${DateTime.now()}');
Future(() async {
try {
final dir = await getApplicationDocumentsDirectory();
final debugFile = File('${dir.path}/DIALOG_DEBUG.txt');
await debugFile.writeAsString(
'=' * 60 + '\n'
'📢 KRDialog.show() 被调用!\n'
'时间: ${DateTime.now()}\n'
'标题: $title\n'
'消息: $message\n'
'版本标识: Android15_Fix_v7_DialogFixed\n'
'=' * 60 + '\n',
mode: FileMode.append,
);
} catch (e) {
print('📢 [KRDialog] ❌ 写入对话框日志失败: $e');
}
});
return Get.dialog( return Get.dialog(
KRDialog( KRDialog(
title: title, title: title,
@ -91,8 +64,7 @@ class KRDialog extends StatelessWidget {
), ),
child: TextButton( child: TextButton(
onPressed: () { onPressed: () {
print('📢 [KRDialog] 确认按钮被点击'); Get.back();
Get.back();
onConfirm?.call(); onConfirm?.call();
}, },
style: TextButton.styleFrom( style: TextButton.styleFrom(
@ -122,10 +94,6 @@ class KRDialog extends StatelessWidget {
final theme = Theme.of(context); final theme = Theme.of(context);
final isDark = theme.brightness == Brightness.dark; final isDark = theme.brightness == Brightness.dark;
print('📢 [KRDialog] 开始构建对话框 Widget');
print('📢 [KRDialog] 标题: $title');
print('📢 [KRDialog] 主题模式: ${isDark ? "暗色" : "亮色"}');
// 🔧 Android 15 ScreenUtil使 // 🔧 Android 15 ScreenUtil使
return Dialog( return Dialog(
backgroundColor: theme.cardColor, backgroundColor: theme.cardColor,
@ -191,8 +159,7 @@ class KRDialog extends StatelessWidget {
), ),
child: TextButton( child: TextButton(
onPressed: () { onPressed: () {
print('📢 [KRDialog] 取消按钮被点击'); Get.back();
Get.back();
onCancel?.call(); onCancel?.call();
}, },
style: TextButton.styleFrom( style: TextButton.styleFrom(