This commit is contained in:
sion
2026-04-07 01:05:05 +08:00
parent edad10ff06
commit 5ca1274607
83 changed files with 1561 additions and 1241 deletions

View File

@@ -17,7 +17,7 @@ import '../../../shared/ui_constants.dart';
// Dialog helpers — shared sub-widgets
// ============================================
/// 信息行 — 用于对话框中示 label/value 键值对
/// 信息行 — 用於對話框中示 label/value 鍵值對
class InfoRow extends StatelessWidget {
final String label;
final String value;
@@ -54,7 +54,7 @@ class InfoRow extends StatelessWidget {
}
}
/// 包地址卡片 — 用充值结果对话框中展示包地址
/// 包地址卡片 — 用充值結果對話框中展示包地址
class WalletAddressCard extends StatelessWidget {
final String address;
final String network;
@@ -94,7 +94,7 @@ class WalletAddressCard extends StatelessWidget {
GestureDetector(
onTap: () {
Clipboard.setData(ClipboardData(text: address));
ToastUtils.show('地址已复制到剪');
ToastUtils.show('地址已複製到剪');
},
child: Container(
padding: const EdgeInsets.all(AppSpacing.xs),
@@ -113,7 +113,7 @@ class WalletAddressCard extends StatelessWidget {
),
const SizedBox(height: AppSpacing.sm),
Text(
'网络: $network',
'網絡: $network',
style: AppTextStyles.bodySmall(context),
),
],
@@ -126,7 +126,7 @@ class WalletAddressCard extends StatelessWidget {
// Dialog functions — kept from original with style updates
// ============================================
/// 充值对话
/// 充值對話
void showDepositDialog(BuildContext context) {
final amountController = TextEditingController();
final formKey = GlobalKey<ShadFormState>();
@@ -183,14 +183,14 @@ void showDepositDialog(BuildContext context) {
child: ShadInputFormField(
id: 'amount',
controller: amountController,
label: const Text('充值金'),
label: const Text('充值金'),
placeholder: const Text('最低 1000 USDT'),
keyboardType: const TextInputType.numberWithOptions(decimal: true),
validator: (v) {
if (v == null || v.isEmpty) return '请输入金';
if (v == null || v.isEmpty) return '請輸入金';
final n = double.tryParse(v);
if (n == null || n <= 0) return '请输入有效金';
if (n < 1000) return '单笔最低充值1000 USDT';
if (n == null || n <= 0) return '請輸入有效金';
if (n < 1000) return '單筆最低充值1000 USDT';
return null;
},
),
@@ -222,7 +222,7 @@ void showDepositDialog(BuildContext context) {
if (response.success && response.data != null) {
showDepositResultDialog(context, response.data!);
} else {
showResultDialog(context, '请失败', response.message);
showResultDialog(context, '請失敗', response.message);
}
}
}
@@ -240,7 +240,7 @@ void showDepositDialog(BuildContext context) {
);
}
/// 充值结果对话框 — 展示包地址和确认打款
/// 充值結果對話框 — 展示包地址和確認打款
void showDepositResultDialog(BuildContext context, Map<String, dynamic> data) {
final orderNo = data['orderNo'] as String? ?? '';
final amount = data['amount']?.toString() ?? '0.00';
@@ -268,7 +268,7 @@ void showDepositResultDialog(BuildContext context, Map<String, dynamic> data) {
),
const SizedBox(width: AppSpacing.sm),
Text(
'充值申成功',
'充值申成功',
style: AppTextStyles.headlineLarge(context).copyWith(
fontWeight: FontWeight.w700,
),
@@ -276,12 +276,12 @@ void showDepositResultDialog(BuildContext context, Map<String, dynamic> data) {
],
),
const SizedBox(height: AppSpacing.lg),
InfoRow(label: '订单号', value: orderNo),
InfoRow(label: '訂單號', value: orderNo),
const SizedBox(height: AppSpacing.sm),
InfoRow(label: '充值金', value: '$amount USDT', isBold: true),
InfoRow(label: '充值金', value: '$amount USDT', isBold: true),
const SizedBox(height: AppSpacing.lg),
Text(
'向以下地址转账:',
'向以下地址轉賬:',
style: AppTextStyles.bodyMedium(context).copyWith(
color: colorScheme.onSurfaceVariant,
),
@@ -304,7 +304,7 @@ void showDepositResultDialog(BuildContext context, Map<String, dynamic> data) {
const SizedBox(width: AppSpacing.sm),
Expanded(
child: Text(
'转账完成后请点击"已打款"按钮确认',
'轉賬完成後請點擊"已打款"按鈕確認',
style: AppTextStyles.bodyMedium(context).copyWith(
color: AppColorScheme.warning,
),
@@ -318,7 +318,7 @@ void showDepositResultDialog(BuildContext context, Map<String, dynamic> data) {
children: [
Expanded(
child: NeonButton(
text: '后确认',
text: '後確認',
type: NeonButtonType.outline,
onPressed: () => Navigator.of(ctx).pop(),
height: 44,
@@ -336,8 +336,8 @@ void showDepositResultDialog(BuildContext context, Map<String, dynamic> data) {
if (context.mounted) {
showResultDialog(
context,
response.success ? '确认成功' : '确认失败',
response.success ? '等待管理员审' : response.message,
response.success ? '確認成功' : '確認失敗',
response.success ? '等待管理員審' : response.message,
);
}
},
@@ -354,13 +354,13 @@ void showDepositResultDialog(BuildContext context, Map<String, dynamic> data) {
);
}
/// 提现对话
/// 提現對話
void showWithdrawDialog(BuildContext context, String? balance) {
final amountController = TextEditingController();
final addressController = TextEditingController();
final contactController = TextEditingController();
final formKey = GlobalKey<ShadFormState>();
final feeNotifier = ValueNotifier<String>('现将扣除10%手续费');
final feeNotifier = ValueNotifier<String>('現將扣除10%手續費');
final networksNotifier = ValueNotifier<List<String>>([]);
final selectedNetworkNotifier = ValueNotifier<String?>(null);
final colorScheme = Theme.of(context).colorScheme;
@@ -370,13 +370,13 @@ void showWithdrawDialog(BuildContext context, String? balance) {
if (amount > 0) {
final fee = amount * 0.1;
final receivable = amount - fee;
feeNotifier.value = '续费(10%): -${fee.toStringAsFixed(2)} USDT | 收款: ${receivable.toStringAsFixed(2)} USDT';
feeNotifier.value = '續費(10%): -${fee.toStringAsFixed(2)} USDT | 收款: ${receivable.toStringAsFixed(2)} USDT';
} else {
feeNotifier.value = '现将扣除10%手续费';
feeNotifier.value = '現將扣除10%手續費';
}
});
// 获取网络列表
// 獲取網絡列表
context.read<AssetProvider>().getWalletNetworks().then((list) {
networksNotifier.value = list;
if (list.isNotEmpty) {
@@ -411,7 +411,7 @@ void showWithdrawDialog(BuildContext context, String? balance) {
),
const SizedBox(width: AppSpacing.sm),
Text(
'',
'',
style: AppTextStyles.headlineLarge(context).copyWith(
fontWeight: FontWeight.w700,
),
@@ -420,7 +420,7 @@ void showWithdrawDialog(BuildContext context, String? balance) {
),
const SizedBox(height: AppSpacing.xs),
Text(
'安全地您的资产转移到外部包地址',
'安全地您的資產轉移到外部包地址',
style: AppTextStyles.bodyMedium(context).copyWith(
color: colorScheme.onSurfaceVariant,
),
@@ -443,7 +443,7 @@ void showWithdrawDialog(BuildContext context, String? balance) {
mainAxisSize: MainAxisSize.min,
children: [
Text(
'可用余额: ',
'可用餘額: ',
style: AppTextStyles.bodySmall(context).copyWith(
color: colorScheme.onSurfaceVariant,
),
@@ -467,13 +467,13 @@ void showWithdrawDialog(BuildContext context, String? balance) {
ShadInputFormField(
id: 'amount',
controller: amountController,
label: const Text('现金额'),
placeholder: const Text('请输入提现金额(USDT)'),
label: const Text('現金額'),
placeholder: const Text('請輸入提現金額(USDT)'),
keyboardType: const TextInputType.numberWithOptions(decimal: true),
validator: Validators.amount,
),
const SizedBox(height: AppSpacing.md),
// 手续费/应收款提示
// 手續費/應收款提示
ValueListenableBuilder<String>(
valueListenable: feeNotifier,
builder: (_, feeText, __) {
@@ -501,7 +501,7 @@ void showWithdrawDialog(BuildContext context, String? balance) {
},
),
const SizedBox(height: AppSpacing.md),
// 提现网络选择
// 提現網絡選擇
ValueListenableBuilder<List<String>>(
valueListenable: networksNotifier,
builder: (_, networks, __) {
@@ -509,7 +509,7 @@ void showWithdrawDialog(BuildContext context, String? balance) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('现网络', style: AppTextStyles.bodyMedium(context).copyWith(
Text('現網絡', style: AppTextStyles.bodyMedium(context).copyWith(
fontWeight: FontWeight.w500,
)),
const SizedBox(height: AppSpacing.xs),
@@ -517,7 +517,7 @@ void showWithdrawDialog(BuildContext context, String? balance) {
valueListenable: selectedNetworkNotifier,
builder: (_, selected, __) {
return ShadSelect<String>(
placeholder: const Text('选择提现网络'),
placeholder: const Text('選擇提現網絡'),
initialValue: selected,
selectedOptionBuilder: (context, val) => Text(val),
onChanged: (value) {
@@ -535,16 +535,16 @@ void showWithdrawDialog(BuildContext context, String? balance) {
ShadInputFormField(
id: 'address',
controller: addressController,
label: const Text('地址'),
placeholder: const Text('请输入提地址'),
validator: (v) => Validators.required(v, '地址'),
label: const Text('地址'),
placeholder: const Text('請輸入提地址'),
validator: (v) => Validators.required(v, '地址'),
),
const SizedBox(height: AppSpacing.md),
ShadInputFormField(
id: 'contact',
controller: contactController,
label: const Text('联系方式(可)'),
placeholder: const Text('联系方式'),
label: const Text('聯繫方式(可)'),
placeholder: const Text('聯繫方式'),
),
],
),
@@ -580,8 +580,8 @@ void showWithdrawDialog(BuildContext context, String? balance) {
if (context.mounted) {
showResultDialog(
context,
response.success ? '成功' : '请失败',
response.success ? '等待管理员审' : response.message,
response.success ? '成功' : '請失敗',
response.success ? '等待管理員審' : response.message,
);
}
}
@@ -612,7 +612,7 @@ void showWithdrawDialog(BuildContext context, String? balance) {
);
}
/// 通用结果对话框 — 展示操作成功/失信息
/// 通用結果對話框 — 展示操作成功/失信息
void showResultDialog(BuildContext context, String title, String? message) {
final colorScheme = Theme.of(context).colorScheme;
@@ -646,7 +646,7 @@ void showResultDialog(BuildContext context, String title, String? message) {
SizedBox(
width: double.infinity,
child: NeonButton(
text: '',
text: '',
type: NeonButtonType.primary,
onPressed: () => Navigator.of(ctx).pop(),
height: 44,