feat: 更新代码仓库全部修改
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 (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 / 创建 Release (push) Has been cancelled
Build Windows / build (push) Has been cancelled
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 (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 / 创建 Release (push) Has been cancelled
Build Windows / build (push) Has been cancelled
This commit is contained in:
@@ -13,7 +13,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:kaer_with_panels/app/widgets/kr_app_text_style.dart';
|
||||
import 'package:kaer_with_panels/app/modules/kr_main/controllers/kr_main_controller.dart';
|
||||
import 'package:easy_refresh/easy_refresh.dart';
|
||||
import 'package:kaer_with_panels/app/widgets/dialogs/kr_dialog.dart';
|
||||
import 'package:kaer_with_panels/app/common/app_run_data.dart';
|
||||
|
||||
/// 邀请进度状态
|
||||
class KRInviteProgress {
|
||||
@@ -47,23 +47,15 @@ class KRInviteController extends GetxController {
|
||||
final kr_isLoading = false.obs;
|
||||
final count = 0.obs;
|
||||
final EasyRefreshController refreshController = EasyRefreshController();
|
||||
|
||||
// 用于标记是否已经显示过对话框(避免重复弹出)
|
||||
bool _hasShownDialog = false;
|
||||
final otherInviteCodeController = TextEditingController();
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
|
||||
final appRunData = KRAppRunData.getInstance();
|
||||
|
||||
// 监听登录状态变化
|
||||
ever(appRunData.kr_isLogin, (value) {
|
||||
// 只有账号密码登录才获取数据
|
||||
if (value && !appRunData.isDeviceLogin()) {
|
||||
ever(KRAppRunData.getInstance().kr_isLogin, (value) {
|
||||
if (value) {
|
||||
_kr_fetchUserInfo();
|
||||
_kr_fetchAffiliateCount();
|
||||
_hasShownDialog = false; // 重置对话框标记
|
||||
} else {
|
||||
kr_progress.value = KRInviteProgress(
|
||||
pending: 0,
|
||||
@@ -76,68 +68,12 @@ class KRInviteController extends GetxController {
|
||||
kr_referCode.value = '';
|
||||
}
|
||||
});
|
||||
|
||||
// 如果已经是正常登录状态,加载数据
|
||||
if (appRunData.kr_isLogin.value && !appRunData.isDeviceLogin()) {
|
||||
if (KRAppRunData.getInstance().kr_isLogin.value) {
|
||||
_kr_fetchUserInfo();
|
||||
_kr_fetchAffiliateCount();
|
||||
}
|
||||
}
|
||||
|
||||
/// 当页面进入视图时调用(从视图层调用)
|
||||
void kr_onPageEnter() {
|
||||
final appRunData = KRAppRunData.getInstance();
|
||||
final isDeviceLogin = appRunData.isDeviceLogin();
|
||||
|
||||
KRLogUtil.kr_i('📄 [InviteController] 页面进入', tag: 'InviteController');
|
||||
KRLogUtil.kr_i(' - kr_isLogin: ${appRunData.kr_isLogin.value}', tag: 'InviteController');
|
||||
KRLogUtil.kr_i(' - isDeviceLogin: $isDeviceLogin', tag: 'InviteController');
|
||||
KRLogUtil.kr_i(' - _hasShownDialog: $_hasShownDialog', tag: 'InviteController');
|
||||
|
||||
// 如果未登录或设备登录,且还没显示过对话框
|
||||
if ((!appRunData.kr_isLogin.value || isDeviceLogin) && !_hasShownDialog) {
|
||||
_hasShownDialog = true; // 标记已显示
|
||||
|
||||
KRLogUtil.kr_i('🔒 [InviteController] 未登录或设备登录,显示绑定提示对话框', tag: 'InviteController');
|
||||
|
||||
// 延迟执行,确保页面加载完成
|
||||
Future.delayed(const Duration(milliseconds: 100), () {
|
||||
KRLogUtil.kr_i('💬 [InviteController] 准备显示对话框...', tag: 'InviteController');
|
||||
try {
|
||||
KRDialog.show(
|
||||
title: AppTranslations.kr_dialog.deviceLoginBindingTitle,
|
||||
message: AppTranslations.kr_dialog.deviceLoginBindingMessage,
|
||||
confirmText: AppTranslations.kr_dialog.kr_ok,
|
||||
cancelText: AppTranslations.kr_dialog.kr_cancel,
|
||||
onConfirm: () {
|
||||
KRLogUtil.kr_i('✅ [InviteController] 用户点击确定,跳转到登录页', tag: 'InviteController');
|
||||
Get.back(); // 关闭对话框
|
||||
// 等待对话框完全关闭后再跳转到登录页面
|
||||
Future.delayed(const Duration(milliseconds: 300), () {
|
||||
// 先跳转到首页,确保登录后返回到首页而不是邀请页面
|
||||
Get.find<KRMainController>().kr_setPage(0);
|
||||
Future.delayed(const Duration(milliseconds: 100), () {
|
||||
Get.toNamed(Routes.MR_LOGIN);
|
||||
});
|
||||
});
|
||||
},
|
||||
onCancel: () {
|
||||
KRLogUtil.kr_i('❌ [InviteController] 用户点击取消,返回首页', tag: 'InviteController');
|
||||
Get.back(); // 关闭对话框
|
||||
// 等待对话框完全关闭后再跳转到首页
|
||||
Future.delayed(const Duration(milliseconds: 100), () {
|
||||
Get.find<KRMainController>().kr_setPage(0);
|
||||
});
|
||||
},
|
||||
);
|
||||
KRLogUtil.kr_i('✅ [InviteController] 对话框已显示', tag: 'InviteController');
|
||||
} catch (e) {
|
||||
KRLogUtil.kr_e('❌ [InviteController] 显示对话框失败: $e', tag: 'InviteController');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// ⚠️ 已废弃:新版本后端不再提供 kr_getUserInfo 接口
|
||||
// 从 AppRunData 获取邀请码(登录后自动获取)
|
||||
Future<void> _kr_fetchUserInfo() async {
|
||||
@@ -171,9 +107,7 @@ class KRInviteController extends GetxController {
|
||||
}
|
||||
|
||||
Future<bool> kr_checkLoginStatus() async {
|
||||
final appRunData = KRAppRunData.getInstance();
|
||||
// 只有账号密码登录才算登录,设备登录不算
|
||||
return appRunData.kr_isLogin.value && !appRunData.isDeviceLogin();
|
||||
return KRAppRunData.getInstance().kr_isLogin.value;
|
||||
}
|
||||
|
||||
/// 获取分享链接
|
||||
@@ -351,6 +285,30 @@ class KRInviteController extends GetxController {
|
||||
await _kr_copyToClipboard(kr_referCode.value);
|
||||
}
|
||||
|
||||
/// 处理绑定邀请码
|
||||
Future<void> kr_handleBindInviteCode() async {
|
||||
final text = otherInviteCodeController.text;
|
||||
print('输入的邀请码是: $text');
|
||||
if (text.isEmpty) {
|
||||
KRCommonUtil.kr_showToast('请输入邀请码');
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
final either = await KRUserApi().hi_inviteCode(text);
|
||||
either.fold(
|
||||
(error) => KRCommonUtil.kr_showToast(error.msg),
|
||||
(affiliateCount) {
|
||||
KRCommonUtil.kr_showToast('绑定成功: $text');
|
||||
otherInviteCodeController.text = '';
|
||||
},
|
||||
);
|
||||
} catch (e) {
|
||||
KRCommonUtil.kr_showToast(e.toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// 获取邀请统计信息
|
||||
Future<void> _kr_fetchAffiliateCount() async {
|
||||
try {
|
||||
@@ -374,13 +332,11 @@ class KRInviteController extends GetxController {
|
||||
}
|
||||
|
||||
Future<void> kr_onRefresh() async {
|
||||
final appRunData = KRAppRunData.getInstance();
|
||||
// 只有账号密码登录才允许刷新
|
||||
if (!appRunData.kr_isLogin.value || appRunData.isDeviceLogin()) {
|
||||
if (!KRAppRunData.getInstance().kr_isLogin.value) {
|
||||
refreshController.finishRefresh();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
await _kr_fetchUserInfo();
|
||||
await _kr_fetchAffiliateCount();
|
||||
|
||||
@@ -1,468 +1,206 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:kaer_with_panels/app/common/app_config.dart';
|
||||
import 'package:kaer_with_panels/app/common/app_run_data.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_local_image.dart';
|
||||
import '../controllers/kr_invite_controller.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:kaer_with_panels/app/utils/kr_common_util.dart';
|
||||
import 'package:easy_refresh/easy_refresh.dart';
|
||||
|
||||
class _KRSliverPersistentHeaderDelegate extends SliverPersistentHeaderDelegate {
|
||||
final Widget child;
|
||||
final double maxHeight;
|
||||
final double minHeight;
|
||||
|
||||
_KRSliverPersistentHeaderDelegate({
|
||||
required this.child,
|
||||
required this.maxHeight,
|
||||
required this.minHeight,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(
|
||||
BuildContext context, double shrinkOffset, bool overlapsContent) {
|
||||
return SizedBox.expand(child: child);
|
||||
}
|
||||
|
||||
@override
|
||||
double get maxExtent => maxHeight;
|
||||
|
||||
@override
|
||||
double get minExtent => minHeight;
|
||||
|
||||
@override
|
||||
bool shouldRebuild(_KRSliverPersistentHeaderDelegate oldDelegate) {
|
||||
return maxHeight != oldDelegate.maxHeight ||
|
||||
minHeight != oldDelegate.minHeight ||
|
||||
child != oldDelegate.child;
|
||||
}
|
||||
}
|
||||
import 'package:kaer_with_panels/app/widgets/hi_base_scaffold.dart';
|
||||
import 'package:kaer_with_panels/app/widgets/hi_help_entrance.dart';
|
||||
|
||||
class KRInviteView extends GetView<KRInviteController> {
|
||||
const KRInviteView({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: Theme.of(context).primaryColor,
|
||||
body: Obx(() {
|
||||
// 使用 Obx 响应式监听登录状态
|
||||
final appRunData = KRAppRunData.getInstance();
|
||||
final isDeviceLogin = appRunData.isDeviceLogin();
|
||||
final isLoggedIn = appRunData.kr_isLogin.value && !isDeviceLogin;
|
||||
|
||||
if (!isLoggedIn) {
|
||||
// 未登录或设备登录,显示空白页面并触发对话框
|
||||
// 使用 WidgetsBinding 确保在构建完成后调用
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
controller.kr_onPageEnter();
|
||||
});
|
||||
return Container(); // 空白容器
|
||||
}
|
||||
final isKeyboardVisible = MediaQuery.of(context).viewInsets.bottom > 0;
|
||||
|
||||
// 正常登录用户显示邀请页面内容
|
||||
return EasyRefresh(
|
||||
controller: controller.refreshController,
|
||||
onRefresh: controller.kr_onRefresh,
|
||||
header: DeliveryHeader(
|
||||
triggerOffset: 50.0,
|
||||
springRebound: true,
|
||||
),
|
||||
child: CustomScrollView(
|
||||
physics: const BouncingScrollPhysics(),
|
||||
slivers: [
|
||||
SliverAppBar(
|
||||
expandedHeight: 150.w,
|
||||
floating: false,
|
||||
pinned: true,
|
||||
stretch: true,
|
||||
backgroundColor: Colors.transparent,
|
||||
automaticallyImplyLeading: false,
|
||||
flexibleSpace: FlexibleSpaceBar(
|
||||
background: Stack(
|
||||
fit: StackFit.expand,
|
||||
children: [
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
colors: [
|
||||
Colors.blue,
|
||||
Colors.blue.shade400,
|
||||
Colors.blue.shade200,
|
||||
Theme.of(context).primaryColor,
|
||||
],
|
||||
stops: const [0.0, 0.3, 0.7, 1.0],
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
bottom: -50.w,
|
||||
child: KrLocalImage(
|
||||
imageName: "invite_top_bg",
|
||||
width: 344.w,
|
||||
height: 233.w,
|
||||
fit: BoxFit.contain,
|
||||
imageType: ImageType.png,
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: MediaQuery.of(context).padding.top + 16.w,
|
||||
left: 16.w,
|
||||
child: Text(
|
||||
AppTranslations.kr_invite.title,
|
||||
style: KrAppTextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
SliverPersistentHeader(
|
||||
delegate: _KRSliverPersistentHeaderDelegate(
|
||||
maxHeight: 120.w,
|
||||
minHeight: 120.w,
|
||||
child: Container(
|
||||
color: Theme.of(context).primaryColor,
|
||||
padding: EdgeInsets.symmetric(horizontal: 16.w),
|
||||
child: _kr_buildProgressCard(context),
|
||||
),
|
||||
),
|
||||
pinned: true,
|
||||
),
|
||||
SliverToBoxAdapter(
|
||||
child: SingleChildScrollView(
|
||||
child: Container(
|
||||
color: Theme.of(context).primaryColor,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_kr_buildInviteSteps(context),
|
||||
_kr_buildShareButtons(context),
|
||||
_kr_buildInviteRules(context),
|
||||
SizedBox(height: 20.w),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}), // 闭合 Obx
|
||||
);
|
||||
}
|
||||
|
||||
Widget _kr_buildProgressCard(BuildContext context) {
|
||||
return Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 12.w),
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).cardColor,
|
||||
borderRadius: BorderRadius.circular(12.w),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.05),
|
||||
blurRadius: 8.w,
|
||||
offset: Offset(0, 2.w),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
return HIBaseScaffold(
|
||||
resizeToAvoidBottomInset: true,
|
||||
// 1. child 的根组件使用 Stack,以允许绝对定位的组件(如 HIHelpEntrance)正常工作
|
||||
child: Stack(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
AppTranslations.kr_invite.inviteStats,
|
||||
style: KrAppTextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context).textTheme.bodyMedium?.color,
|
||||
),
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 4.w),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.blue.withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(4.w),
|
||||
),
|
||||
child: Obx(() => Text(
|
||||
controller.kr_progress.value.registers.toString(),
|
||||
style: KrAppTextStyle(
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.blue,
|
||||
),
|
||||
)),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 12.w),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
AppTranslations.kr_invite.registers,
|
||||
style: KrAppTextStyle(
|
||||
fontSize: 13,
|
||||
color: Theme.of(context).textTheme.bodySmall?.color,
|
||||
),
|
||||
SingleChildScrollView(
|
||||
keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.onDrag,
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 40.w),
|
||||
// 3. 使用一个内层 Column 来组织内容
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// 🟢 第一行:奖励说明
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 20.w),
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).primaryColor,
|
||||
borderRadius: BorderRadius.circular(25.r),
|
||||
),
|
||||
SizedBox(height: 4.w),
|
||||
Obx(() => Text(
|
||||
controller.kr_progress.value.registers.toString(),
|
||||
style: KrAppTextStyle(
|
||||
fontSize: 17,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context).textTheme.bodyMedium?.color,
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.min, // 由内容撑开
|
||||
children: [
|
||||
KrLocalImage(
|
||||
imageName: 'hi-home-logo',
|
||||
imageType: ImageType.svg,
|
||||
width: 54.w,
|
||||
color: Colors.black,
|
||||
),
|
||||
SizedBox(width: 16.w),
|
||||
Flexible(
|
||||
child: Text(
|
||||
'受邀用户首次付款时,他将与您分别获得3天免费使用时长',
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
fontSize: 14.sp,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
)),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(width: 16.w),
|
||||
Expanded(
|
||||
child: Visibility(
|
||||
visible: AppConfig().kr_is_daytime,
|
||||
child: Column(
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
SizedBox(height: 26.w),
|
||||
// 🟢 第二行:我的邀请码
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 4.w, vertical: 2.w),
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: Colors.white, width: 2.0),
|
||||
borderRadius: BorderRadius.circular(1000.r),
|
||||
),
|
||||
child: Obx(
|
||||
() => Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Container(
|
||||
width: 100.w,
|
||||
height: 40.w,
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).primaryColor,
|
||||
borderRadius: BorderRadius.circular(1000.r),
|
||||
),
|
||||
child: Text(
|
||||
'邀请码',
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
fontSize: 16.sp,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Text(
|
||||
controller.kr_referCode.value,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 20.sp,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
icon: const KrLocalImage(
|
||||
imageName: 'share-icon',
|
||||
imageType: ImageType.svg,
|
||||
color: Colors.white,
|
||||
),
|
||||
onPressed: () {
|
||||
if (controller.kr_referCode.value.isNotEmpty) {
|
||||
Clipboard.setData(
|
||||
ClipboardData(text: controller.kr_referCode.value),
|
||||
);
|
||||
KRCommonUtil.kr_showToast(
|
||||
AppTranslations.kr_invite.inviteCodeCopied,
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 160.w),
|
||||
// 🟢 第三部分:接受他人邀请
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
AppTranslations.kr_invite.totalCommission,
|
||||
style: KrAppTextStyle(
|
||||
fontSize: 13,
|
||||
color: Theme.of(context).textTheme.bodySmall?.color,
|
||||
'接受他人邀请',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 14.sp,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 4.w),
|
||||
Text(
|
||||
controller.kr_progress.value.totalCommission.toString(),
|
||||
style: KrAppTextStyle(
|
||||
fontSize: 17,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.blue,
|
||||
SizedBox(height: 8.h),
|
||||
TextField(
|
||||
controller: controller.otherInviteCodeController,
|
||||
textAlign: TextAlign.center,
|
||||
style: const TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
|
||||
decoration: InputDecoration(
|
||||
hintText: '填入邀请人邀请码兑换免费时长...',
|
||||
hintStyle: const TextStyle(color: Color(0xFFA6A6A6)),
|
||||
filled: true,
|
||||
fillColor: Colors.transparent,
|
||||
contentPadding: EdgeInsets.symmetric(horizontal: 22.w),
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(1000.r),
|
||||
borderSide: const BorderSide(color: Colors.white, width: 2.0),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(1000.r),
|
||||
borderSide: const BorderSide(color: Colors.white, width: 2.0),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(1000.r),
|
||||
borderSide: const BorderSide(color: Colors.white, width: 2.0),
|
||||
),
|
||||
constraints: BoxConstraints(maxHeight: 50.h),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 10.w),
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
height: 50.w,
|
||||
child: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Theme.of(context).primaryColor,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(1000.r),
|
||||
),
|
||||
),
|
||||
onPressed: () {
|
||||
controller.kr_handleBindInviteCode();
|
||||
},
|
||||
child: Text(
|
||||
'保存',
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
fontSize: 16.sp,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
// 4. 在可滚动区域的末尾添加一个占位边距,防止内容被 HIHelpEntrance 遮挡
|
||||
SizedBox(height: 80.w), // 这个高度可以根据 HIHelpEntrance 的实际高度进行微调
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _kr_buildInviteSteps(BuildContext context) {
|
||||
return Padding(
|
||||
padding: EdgeInsets.fromLTRB(16.w, 32.w, 16.w, 16.w),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
AppTranslations.kr_invite.steps,
|
||||
style: KrAppTextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context).textTheme.bodyMedium?.color,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 16.w),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
_kr_buildStepCard(context, Icons.person_add, AppTranslations.kr_invite.inviteFriend),
|
||||
_kr_buildStepCard(context, Icons.mail, AppTranslations.kr_invite.acceptInvite),
|
||||
_kr_buildStepCard(context, Icons.card_giftcard, AppTranslations.kr_invite.getReward),
|
||||
],
|
||||
),
|
||||
// 5. 将 HIHelpEntrance 作为 Stack 的直接子元素,它将恢复其原有的绝对定位能力
|
||||
if (!isKeyboardVisible)
|
||||
const HIHelpEntrance(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _kr_buildStepCard(BuildContext context, IconData icon, String text) {
|
||||
return Container(
|
||||
width: 100.w,
|
||||
padding: EdgeInsets.all(12.r),
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).cardColor,
|
||||
borderRadius: BorderRadius.circular(12.r),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.05),
|
||||
blurRadius: 10.r,
|
||||
offset: Offset(0, 2.w),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
width: 48.r,
|
||||
height: 48.r,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.blue.withOpacity(0.1),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: Icon(icon, color: Colors.blue, size: 24.r),
|
||||
),
|
||||
SizedBox(height: 8.w),
|
||||
Text(
|
||||
text,
|
||||
textAlign: TextAlign.center,
|
||||
style: KrAppTextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context).textTheme.bodyMedium?.color,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _kr_buildShareButtons(BuildContext context) {
|
||||
return Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 16.w),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: ElevatedButton.icon(
|
||||
onPressed: controller.kr_handleLinkShare,
|
||||
icon: Icon(Icons.link, size: 20.r, color: Colors.white),
|
||||
label: FittedBox(
|
||||
fit: BoxFit.scaleDown,
|
||||
child: Text(
|
||||
AppTranslations.kr_invite.shareLink,
|
||||
style: TextStyle(
|
||||
fontSize: 14.sp,
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: const Color(0xFF2196F3),
|
||||
padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 12.w),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(24.r),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 16.w),
|
||||
Expanded(
|
||||
child: ElevatedButton.icon(
|
||||
onPressed: controller.kr_handleQRShare,
|
||||
icon: Icon(Icons.qr_code, size: 20.r, color: Colors.white),
|
||||
label: FittedBox(
|
||||
fit: BoxFit.scaleDown,
|
||||
child: Text(
|
||||
AppTranslations.kr_invite.shareQR,
|
||||
style: TextStyle(
|
||||
fontSize: 14.sp,
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: const Color(0xFF2196F3),
|
||||
padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 12.w),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(24.r),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 16.w),
|
||||
Obx(() {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
'${AppTranslations.kr_invite.myInviteCode}: ${controller.kr_referCode.value}',
|
||||
style: KrAppTextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context).textTheme.bodyMedium?.color,
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
icon: Icon(Icons.copy, size: 20.r, color: Colors.blue),
|
||||
onPressed: () {
|
||||
Clipboard.setData(ClipboardData(text: controller.kr_referCode.value));
|
||||
KRCommonUtil.kr_showToast(
|
||||
AppTranslations.kr_invite.inviteCodeCopied,
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
}),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _kr_buildInviteRules(BuildContext context) {
|
||||
return Padding(
|
||||
padding: EdgeInsets.all(16.r),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
AppTranslations.kr_invite.rules,
|
||||
style: KrAppTextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context).textTheme.bodyMedium?.color,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 16.w),
|
||||
Text(
|
||||
AppTranslations.kr_invite.rule1,
|
||||
style: KrAppTextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: Theme.of(context).textTheme.bodySmall?.color,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 8.w),
|
||||
Text(
|
||||
AppTranslations.kr_invite.rule2,
|
||||
style: KrAppTextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: Theme.of(context).textTheme.bodySmall?.color,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user