fix: 更新诸多bug
This commit is contained in:
@@ -106,7 +106,7 @@ class _HIDialogState extends State<HIDialog> {
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(23.r),
|
||||
),
|
||||
minimumSize: Size.fromHeight(40.w),
|
||||
minimumSize: Size(85.w, 40.w),
|
||||
padding: EdgeInsets.zero,
|
||||
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||
),
|
||||
@@ -120,7 +120,7 @@ class _HIDialogState extends State<HIDialog> {
|
||||
),
|
||||
)
|
||||
: Text(
|
||||
widget.confirmText ?? AppTranslations.kr_dialog.kr_confirm,
|
||||
widget.confirmText ?? (widget.cancelText == null ? '好的' : AppTranslations.kr_dialog.kr_confirm),
|
||||
style: TextStyle(
|
||||
fontSize: 16.sp,
|
||||
fontWeight: FontWeight.w600,
|
||||
@@ -136,96 +136,106 @@ class _HIDialogState extends State<HIDialog> {
|
||||
final dialog = Dialog(
|
||||
backgroundColor: Colors.transparent,
|
||||
insetPadding: EdgeInsets.all(20.w),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(34.r),
|
||||
child: BackdropFilter(
|
||||
filter: ImageFilter.blur(sigmaX: 26, sigmaY: 26), // 毛玻璃模糊
|
||||
child: Container(
|
||||
width: 245.w,
|
||||
padding: EdgeInsets.fromLTRB(30.w, 16.w, 30.w, 16.w),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xF5F5F5).withOpacity(0.6), // 半透明底色
|
||||
borderRadius: BorderRadius.circular(34.r),
|
||||
border: Border.all(
|
||||
color: Colors.white.withOpacity(0.2), // 高光边框
|
||||
width: 1.5,
|
||||
child: Transform.translate(
|
||||
offset: Offset(0, -30.w),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(34.r),
|
||||
child: BackdropFilter(
|
||||
filter: ImageFilter.blur(sigmaX: 26, sigmaY: 26), // 毛玻璃模糊
|
||||
child: Container(
|
||||
width: 245.w,
|
||||
padding: EdgeInsets.fromLTRB(30.w, 16.w, 30.w, 16.w),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFFDEDEDE), // 半透明底色
|
||||
borderRadius: BorderRadius.circular(34.r),
|
||||
border: Border.all(
|
||||
color: Colors.white.withOpacity(0.2), // 高光边框
|
||||
width: 1.5,
|
||||
),
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
if (widget.title != null) ...[
|
||||
Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
widget.title!,
|
||||
style: TextStyle(
|
||||
fontSize: 14.sp,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.black,
|
||||
fontFamily: 'AlibabaPuHuiTi-Medium',
|
||||
height: 1.3,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
if (widget.title != null) ...[
|
||||
Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
widget.title!,
|
||||
style: TextStyle(
|
||||
fontSize: 14.sp,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.black,
|
||||
height: 1.3,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 4.w),
|
||||
],
|
||||
if (widget.message != null || widget.customMessageWidget != null) ...[
|
||||
Container(
|
||||
constraints: BoxConstraints(maxHeight: 200.h),
|
||||
child: SingleChildScrollView(
|
||||
child: widget.customMessageWidget ??
|
||||
Text(
|
||||
widget.message!,
|
||||
textAlign: TextAlign.left,
|
||||
style: TextStyle(
|
||||
fontSize: 14.sp,
|
||||
color: Colors.black,
|
||||
height: 1.4,
|
||||
fontFamily: 'AlibabaPuHuiTi-Medium',
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
if (widget.confirmText != null || widget.cancelText != null) ...[
|
||||
SizedBox(height: 28.w),
|
||||
Row(
|
||||
children: [
|
||||
if (widget.confirmText != null) Expanded(child: _buildConfirmButton()),
|
||||
if (widget.cancelText != null && widget.confirmText != null)
|
||||
SizedBox(width: 12.w),
|
||||
if (widget.cancelText != null)
|
||||
Expanded(
|
||||
child: TextButton(
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
widget.onCancel?.call();
|
||||
},
|
||||
style: TextButton.styleFrom(
|
||||
backgroundColor: const Color(0xFFFF00B7),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(23.r),
|
||||
),
|
||||
minimumSize: Size.fromHeight(40.w),
|
||||
padding: EdgeInsets.zero,
|
||||
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||
),
|
||||
child: Text(
|
||||
widget.cancelText!,
|
||||
SizedBox(height: 4.w),
|
||||
],
|
||||
if (widget.message != null || widget.customMessageWidget != null) ...[
|
||||
Container(
|
||||
constraints: BoxConstraints(maxHeight: 200.h),
|
||||
child: SingleChildScrollView(
|
||||
child: widget.customMessageWidget ??
|
||||
Text(
|
||||
widget.message!,
|
||||
textAlign: TextAlign.left,
|
||||
style: TextStyle(
|
||||
fontSize: 16.sp,
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 14.sp,
|
||||
color: Colors.black,
|
||||
height: 1.4,
|
||||
fontFamily: 'AlibabaPuHuiTi-Medium',
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
if (widget.confirmText != null || widget.cancelText != null || (widget.confirmText == null && widget.cancelText == null)) ...[
|
||||
SizedBox(height: 12.w),
|
||||
if (widget.confirmText == null && widget.cancelText == null)
|
||||
Center(
|
||||
child: SizedBox(
|
||||
width: 85.w,
|
||||
child: _buildConfirmButton(),
|
||||
),
|
||||
],
|
||||
),
|
||||
]
|
||||
],
|
||||
)
|
||||
else
|
||||
Row(
|
||||
children: [
|
||||
if (widget.confirmText != null) Expanded(child: _buildConfirmButton()),
|
||||
if (widget.cancelText != null && widget.confirmText != null)
|
||||
SizedBox(width: 12.w),
|
||||
if (widget.cancelText != null)
|
||||
Expanded(
|
||||
child: TextButton(
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
widget.onCancel?.call();
|
||||
},
|
||||
style: TextButton.styleFrom(
|
||||
backgroundColor: const Color(0xFFFF00B7),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(23.r),
|
||||
),
|
||||
minimumSize: Size(85.w, 40.w),
|
||||
padding: EdgeInsets.zero,
|
||||
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||
),
|
||||
child: Text(
|
||||
widget.cancelText!,
|
||||
style: TextStyle(
|
||||
fontSize: 16.sp,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.black,
|
||||
fontFamily: 'AlibabaPuHuiTi-Medium',
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
]
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -6,7 +6,8 @@ import 'package:kaer_with_panels/app/widgets/kr_local_image.dart';
|
||||
import 'dart:math' as math; // 导入 math 库以使用 pi
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:get/get.dart';
|
||||
import '../routes/app_pages.dart';
|
||||
import 'package:kaer_with_panels/app/routes/app_pages.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
/// 可折叠列表项的数据模型
|
||||
class HICollapsibleItem {
|
||||
@@ -61,15 +62,11 @@ class _HICollapsibleItemWidgetState extends State<HICollapsibleItemWidget> {
|
||||
color: const Color(0xFFADFF5B), // 链接颜色
|
||||
),
|
||||
recognizer: TapGestureRecognizer()
|
||||
..onTap = () {
|
||||
// 在这里处理点击事件,例如打开一个网页
|
||||
// 注意:您需要添加 url_launcher 依赖
|
||||
Get.toNamed(
|
||||
Routes.KR_WEBVIEW,
|
||||
arguments: {
|
||||
'url': 'https://www.baidu.com',
|
||||
},
|
||||
);
|
||||
..onTap = () async {
|
||||
final Uri url = Uri.parse('https://hifastvpn.com/help');
|
||||
if (!await launchUrl(url, mode: LaunchMode.externalApplication)) {
|
||||
Get.snackbar('错误', '无法打开链接: $url');
|
||||
}
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
@@ -1,117 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:kaer_with_panels/app/localization/kr_language_utils.dart';
|
||||
import 'package:kaer_with_panels/app/widgets/kr_app_text_style.dart';
|
||||
import 'package:kaer_with_panels/app/widgets/kr_local_image.dart';
|
||||
|
||||
/// 语言切换弹框组件
|
||||
class KRLanguageSwitchDialog extends StatelessWidget {
|
||||
const KRLanguageSwitchDialog({super.key});
|
||||
|
||||
/// 显示语言切换弹框的静态方法
|
||||
static Future<void> kr_show() async {
|
||||
final isChineseRegion = await KRLanguageUtils.checkInitialLanguage();
|
||||
if (isChineseRegion) {
|
||||
await Get.dialog(
|
||||
const KRLanguageSwitchDialog(),
|
||||
barrierDismissible: false,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Dialog(
|
||||
backgroundColor: Colors.transparent,
|
||||
child: Container(
|
||||
width: 280.w,
|
||||
padding: EdgeInsets.symmetric(horizontal: 24.w, vertical: 24.h),
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).cardColor,
|
||||
borderRadius: BorderRadius.circular(24.r),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
// 图标
|
||||
KrLocalImage(
|
||||
imageName: 'language_switch',
|
||||
width: 120.w,
|
||||
height: 120.h,
|
||||
),
|
||||
SizedBox(height: 16.h),
|
||||
// 标题
|
||||
Text(
|
||||
'根据您所在地区以及您的语言设置是否切换到中文语言?',
|
||||
textAlign: TextAlign.center,
|
||||
style: KrAppTextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context).textTheme.bodyMedium?.color,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 24.h),
|
||||
// 切换按钮
|
||||
_kr_buildButton(
|
||||
context: context,
|
||||
text: '切换',
|
||||
isPrimary: true,
|
||||
onTap: () async {
|
||||
final zhLanguage = KRLanguage.values.firstWhere(
|
||||
(lang) => lang.countryCode == 'zh',
|
||||
orElse: () => KRLanguage.zh,
|
||||
);
|
||||
await KRLanguageUtils.switchLanguage(zhLanguage);
|
||||
Get.back();
|
||||
},
|
||||
),
|
||||
SizedBox(height: 12.h),
|
||||
// 不切换按钮
|
||||
_kr_buildButton(
|
||||
context: context,
|
||||
text: '不切换',
|
||||
isPrimary: false,
|
||||
onTap: () => Get.back(),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// 构建按钮
|
||||
Widget _kr_buildButton({
|
||||
required BuildContext context,
|
||||
required String text,
|
||||
required bool isPrimary,
|
||||
required VoidCallback onTap,
|
||||
}) {
|
||||
return InkWell(
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
height: 44.h,
|
||||
decoration: BoxDecoration(
|
||||
color: isPrimary ? Colors.blue : Colors.transparent,
|
||||
borderRadius: BorderRadius.circular(22.r),
|
||||
border: isPrimary
|
||||
? null
|
||||
: Border.all(
|
||||
color: Colors.blue,
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
text,
|
||||
style: KrAppTextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: isPrimary ? Colors.white : Colors.blue,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -42,9 +42,8 @@ class KRSubscriptionExpiryText extends StatelessWidget {
|
||||
final day = expireDateTime.day.toString().padLeft(2, '0');
|
||||
final hour = expireDateTime.hour.toString().padLeft(2, '0');
|
||||
final minute = expireDateTime.minute.toString().padLeft(2, '0');
|
||||
final second = expireDateTime.second.toString().padLeft(2, '0');
|
||||
|
||||
final formattedDateTime = '$year/$month/$day $hour:$minute:$second';
|
||||
final formattedDateTime = '$year/$month/$day $hour:$minute';
|
||||
expiryText = '到期时间:$formattedDateTime';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user