| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191 |
- import 'package:flutter/material.dart';
- import 'package:flutter/services.dart';
- import '../../../core/l10n/app_localizations.dart';
- import '../../../core/theme/app_colors.dart';
- import '../../../data/models/asset/recharge_record.dart';
- class DepositDetailScreen extends StatelessWidget {
- const DepositDetailScreen({super.key, required this.record});
- final RechargeRecord record;
- @override
- Widget build(BuildContext context) {
- final cs = Theme.of(context).colorScheme;
- final isDark = Theme.of(context).brightness == Brightness.dark;
- return Scaffold(
- appBar: AppBar(
- title: Text(AppLocalizations.of(context)!.depositDetail, style: const TextStyle(fontSize: 18, fontWeight: FontWeight.w600)),
- centerTitle: true,
- ),
- body: SingleChildScrollView(
- padding: const EdgeInsets.all(16),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- // ── 金额部分 ──────────────────────────────
- Container(
- padding: const EdgeInsets.all(20),
- decoration: BoxDecoration(
- color: isDark ? AppColors.darkBgSecondary : AppColors.lightBgSecondary,
- borderRadius: BorderRadius.circular(12),
- ),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- AppLocalizations.of(context)!.amountLabel,
- style: TextStyle(
- color: cs.onSurface.withAlpha(120),
- fontSize: 13,
- ),
- ),
- const SizedBox(height: 8),
- Row(
- crossAxisAlignment: CrossAxisAlignment.baseline,
- textBaseline: TextBaseline.alphabetic,
- children: [
- Text(
- '+${record.amount}',
- style: TextStyle(
- color: AppColors.rise,
- fontSize: 28,
- fontWeight: FontWeight.w700,
- ),
- ),
- const SizedBox(width: 8),
- Text(
- 'USDT',
- style: TextStyle(
- color: cs.onSurface.withAlpha(120),
- fontSize: 14,
- ),
- ),
- ],
- ),
- const SizedBox(height: 12),
- Text(
- AppLocalizations.of(context)!.completed,
- style: TextStyle(
- color: AppColors.rise,
- fontSize: 12,
- fontWeight: FontWeight.w500,
- ),
- ),
- ],
- ),
- ),
- const SizedBox(height: 24),
- // ── 详情信息 ──────────────────────────────
- Container(
- padding: const EdgeInsets.all(16),
- decoration: BoxDecoration(
- color: isDark ? AppColors.darkBgSecondary : AppColors.lightBgSecondary,
- borderRadius: BorderRadius.circular(12),
- ),
- child: Column(
- children: [
- _DetailRow(
- label: AppLocalizations.of(context)!.depositCurrency,
- value: 'USDT',
- cs: cs,
- ),
- const SizedBox(height: 16),
- _DetailRow(
- label: AppLocalizations.of(context)!.depositAddress,
- value: record.address,
- cs: cs,
- isCopyable: true,
- copyValue: record.address,
- ),
- const SizedBox(height: 16),
- _DetailRow(
- label: AppLocalizations.of(context)!.txHash,
- value: record.txId,
- cs: cs,
- isCopyable: record.txId.isNotEmpty,
- copyValue: record.txId,
- truncate: true,
- ),
- const SizedBox(height: 16),
- _DetailRow(
- label: AppLocalizations.of(context)!.applyTime,
- value: record.createTime,
- cs: cs,
- ),
- ],
- ),
- ),
- ],
- ),
- ),
- );
- }
- }
- class _DetailRow extends StatelessWidget {
- const _DetailRow({
- required this.label,
- required this.value,
- required this.cs,
- this.isCopyable = false,
- this.copyValue,
- this.truncate = false,
- });
- final String label;
- final String value;
- final ColorScheme cs;
- final bool isCopyable;
- final String? copyValue;
- final bool truncate;
- @override
- Widget build(BuildContext context) {
- final displayValue = truncate && value.length > 16
- ? '${value.substring(0, 8)}...${value.substring(value.length - 8)}'
- : value;
- return GestureDetector(
- onTap: isCopyable
- ? () {
- if (copyValue != null && copyValue!.isNotEmpty) {
- Clipboard.setData(ClipboardData(text: copyValue!));
- ScaffoldMessenger.of(context).showSnackBar(
- SnackBar(content: Text(AppLocalizations.of(context)!.copied), duration: const Duration(seconds: 1)),
- );
- }
- }
- : null,
- child: Row(
- children: [
- Expanded(
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- label,
- style: TextStyle(color: cs.onSurface.withAlpha(120), fontSize: 12),
- ),
- const SizedBox(height: 4),
- Text(
- displayValue,
- style: TextStyle(color: cs.onSurface, fontSize: 14, fontWeight: FontWeight.w500),
- maxLines: 2,
- overflow: TextOverflow.ellipsis,
- ),
- ],
- ),
- ),
- if (isCopyable) ...[
- const SizedBox(width: 8),
- Icon(Icons.content_copy_outlined, size: 16, color: cs.onSurface.withAlpha(120)),
- ],
- ],
- ),
- );
- }
- }
|