完善游客模式登录 并且新增设备管理
This commit is contained in:
@@ -99,64 +99,115 @@ class KRUserInfoView extends GetView<KRUserInfoController> {
|
||||
|
||||
// 构建绑定提示
|
||||
Widget _kr_buildBindingTip(BuildContext context) {
|
||||
return Obx(() => Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
return Obx(() {
|
||||
final appRunData = KRAppRunData.getInstance();
|
||||
final isLoggedIn = appRunData.kr_isLogin.value;
|
||||
final isDeviceLogin = appRunData.isDeviceLogin();
|
||||
|
||||
// 判断显示文字和颜色
|
||||
String displayText;
|
||||
Color displayColor;
|
||||
IconData displayIcon;
|
||||
bool shouldShowLoginPrompt = false;
|
||||
|
||||
if (!isLoggedIn) {
|
||||
// 未登录
|
||||
displayText = AppTranslations.kr_userInfo.bindingTip;
|
||||
displayColor = Theme.of(context).colorScheme.error;
|
||||
displayIcon = Icons.info_outline;
|
||||
shouldShowLoginPrompt = false;
|
||||
} else if (isDeviceLogin) {
|
||||
// 设备登录(游客模式)
|
||||
displayText = "登录/注册";
|
||||
displayColor = const Color(0xFF1797FF); // 使用蓝色提示可以点击
|
||||
displayIcon = Icons.touch_app;
|
||||
shouldShowLoginPrompt = true;
|
||||
} else {
|
||||
// 正常登录
|
||||
displayText = "${AppTranslations.kr_userInfo.myAccount} ${appRunData.kr_account.value}";
|
||||
displayColor = Theme.of(context).textTheme.bodyMedium?.color ?? Colors.black;
|
||||
displayIcon = Icons.info;
|
||||
shouldShowLoginPrompt = false;
|
||||
}
|
||||
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: shouldShowLoginPrompt
|
||||
? () {
|
||||
// 跳转到登录页面
|
||||
Get.toNamed(Routes.MR_LOGIN);
|
||||
}
|
||||
: null,
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 12.w),
|
||||
decoration: shouldShowLoginPrompt
|
||||
? BoxDecoration(
|
||||
color: const Color(0xFF1797FF).withOpacity(0.05),
|
||||
borderRadius: BorderRadius.circular(8.w),
|
||||
)
|
||||
: null,
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(
|
||||
KRAppRunData.getInstance().kr_isLogin.value
|
||||
? Icons.info
|
||||
: Icons.info_outline,
|
||||
color: !KRAppRunData.getInstance().kr_isLogin.value
|
||||
? Theme.of(context).colorScheme.error
|
||||
: Theme.of(context).textTheme.bodyMedium?.color,
|
||||
displayIcon,
|
||||
color: displayColor,
|
||||
size: 16.w,
|
||||
),
|
||||
SizedBox(width: 8.w),
|
||||
Expanded(
|
||||
child: Text(
|
||||
displayText,
|
||||
style: KrAppTextStyle(
|
||||
color: displayColor,
|
||||
fontSize: 12,
|
||||
fontWeight: shouldShowLoginPrompt ? FontWeight.w600 : FontWeight.normal,
|
||||
),
|
||||
),
|
||||
),
|
||||
if (shouldShowLoginPrompt)
|
||||
Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
size: 14.w,
|
||||
color: displayColor,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
// 余额信息或游客ID
|
||||
Visibility(
|
||||
visible: KRAppRunData.getInstance().kr_isLogin.value &&
|
||||
AppConfig.getInstance().kr_is_daytime,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(left: 16.w, bottom: 16.w),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(
|
||||
appRunData.isDeviceLogin()
|
||||
? Icons.person_outline
|
||||
: Icons.account_balance_wallet_outlined,
|
||||
color: Theme.of(context).textTheme.bodyMedium?.color,
|
||||
size: 16.w,
|
||||
),
|
||||
SizedBox(width: 8.w),
|
||||
Text(
|
||||
KRAppRunData.getInstance().kr_isLogin.value
|
||||
? "${AppTranslations.kr_userInfo.myAccount} ${KRAppRunData().kr_account}"
|
||||
: AppTranslations.kr_userInfo.bindingTip,
|
||||
appRunData.isDeviceLogin()
|
||||
? "游客ID:${(appRunData.kr_userId.value ?? 0) + 10000}"
|
||||
: "${AppTranslations.kr_userInfo.balance} ${controller.kr_balance.value.toString()}",
|
||||
style: KrAppTextStyle(
|
||||
color: !KRAppRunData.getInstance().kr_isLogin.value
|
||||
? Theme.of(context).colorScheme.error
|
||||
: Theme.of(context).textTheme.bodyMedium?.color,
|
||||
fontSize: 12,
|
||||
color: Theme.of(context).textTheme.bodyMedium?.color,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
// 余额信息(写死预览)
|
||||
Visibility(
|
||||
visible: KRAppRunData.getInstance().kr_isLogin.value &&
|
||||
AppConfig.getInstance().kr_is_daytime,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(left: 16.w, bottom: 16.w),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.account_balance_wallet_outlined,
|
||||
color: Theme.of(context).textTheme.bodyMedium?.color,
|
||||
size: 16.w,
|
||||
),
|
||||
SizedBox(width: 8.w),
|
||||
Text(
|
||||
"${AppTranslations.kr_userInfo.balance} ${controller.kr_balance.value.toString()}",
|
||||
style: KrAppTextStyle(
|
||||
fontSize: 12,
|
||||
color: Theme.of(context).textTheme.bodyMedium?.color,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
));
|
||||
),
|
||||
],
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
// 构建订阅卡片
|
||||
@@ -574,49 +625,67 @@ class KRUserInfoView extends GetView<KRUserInfoController> {
|
||||
|
||||
// 构建快捷键区域
|
||||
Widget _kr_buildShortcutSection(BuildContext context) {
|
||||
return Container(
|
||||
margin: EdgeInsets.fromLTRB(16.w, 24.w, 16.w, 16.w),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
AppTranslations.kr_userInfo.shortcuts,
|
||||
style: KrAppTextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context).textTheme.bodyMedium?.color,
|
||||
return Obx(() {
|
||||
final appRunData = KRAppRunData.getInstance();
|
||||
final isLoggedIn = appRunData.kr_isLogin.value;
|
||||
final isDeviceLogin = appRunData.isDeviceLogin();
|
||||
|
||||
// 只有正常登录用户(非游客)才显示设备管理
|
||||
final showDeviceManagement = isLoggedIn && !isDeviceLogin;
|
||||
|
||||
return Container(
|
||||
margin: EdgeInsets.fromLTRB(16.w, 24.w, 16.w, 16.w),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
AppTranslations.kr_userInfo.shortcuts,
|
||||
style: KrAppTextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context).textTheme.bodyMedium?.color,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 12.w),
|
||||
Column(
|
||||
children: [
|
||||
_kr_buildShortcutContainer(
|
||||
icon: "my_ads",
|
||||
title: AppTranslations.kr_userInfo.adBlock,
|
||||
value: controller.kr_isAdBlockEnabled,
|
||||
onChanged: controller.kr_toggleAdBlock,
|
||||
context: context,
|
||||
),
|
||||
_kr_buildShortcutContainer(
|
||||
icon: "my_dns",
|
||||
title: AppTranslations.kr_userInfo.ndsUnlock,
|
||||
value: controller.kr_isNDSUnlockEnabled,
|
||||
onChanged: controller.kr_toggleNDSUnlock,
|
||||
context: context,
|
||||
),
|
||||
_kr_buildShortcutContainer(
|
||||
icon: "my_cn_us",
|
||||
title: AppTranslations.kr_userInfo.contactUs,
|
||||
onTap: () {
|
||||
Get.toNamed(Routes.KR_CRISP);
|
||||
},
|
||||
context: context,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
SizedBox(height: 12.w),
|
||||
Column(
|
||||
children: [
|
||||
_kr_buildShortcutContainer(
|
||||
icon: "my_ads",
|
||||
title: AppTranslations.kr_userInfo.adBlock,
|
||||
value: controller.kr_isAdBlockEnabled,
|
||||
onChanged: controller.kr_toggleAdBlock,
|
||||
context: context,
|
||||
),
|
||||
_kr_buildShortcutContainer(
|
||||
icon: "my_dns",
|
||||
title: AppTranslations.kr_userInfo.ndsUnlock,
|
||||
value: controller.kr_isNDSUnlockEnabled,
|
||||
onChanged: controller.kr_toggleNDSUnlock,
|
||||
context: context,
|
||||
),
|
||||
if (showDeviceManagement)
|
||||
_kr_buildShortcutContainer(
|
||||
icon: "my_dns",
|
||||
title: "设备管理",
|
||||
onTap: () {
|
||||
Get.toNamed(Routes.KR_DEVICE_MANAGEMENT);
|
||||
},
|
||||
context: context,
|
||||
),
|
||||
_kr_buildShortcutContainer(
|
||||
icon: "my_cn_us",
|
||||
title: AppTranslations.kr_userInfo.contactUs,
|
||||
onTap: () {
|
||||
Get.toNamed(Routes.KR_CRISP);
|
||||
},
|
||||
context: context,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
// 构建快捷键容器
|
||||
|
||||
Reference in New Issue
Block a user