mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-11-25 11:03:55 +01:00
Catches up from the May 12 fork point (v6.1.2+23) through v6.5.0: 535 upstream commits, including the Monero silent-open fix, Monero on Trezor, Ledger/Trezor BLE fixes, the new seed and history screens, quick Bitcoin sync, git-pinned dependencies (pubspec_overrides.yaml), frozen Hive adapters (*.part.dart), monero_c v0.18.4.6-RC2 and Flutter 3.41.9. Merged with both sides normalized first (import rename, 100-column format), which took the conflict count from 614 paths to 322. The procedure is now scripts/upstream_sync.sh. Kept from Hash Bags: - WalletType enum order and Hive IDs. SQLite stores WalletType.index and our order differs from upstream's; taking theirs would reread saved wallets as other chains. Our frozen adapter keeps the shipped IDs. - The 1.0.2 legacy PIN and wallet-password decode and self-heal. - Removed chains (Solana, Tron, Zano, Zcash, Decred, Haven) and the new Robinhood chain stay out; Cake Pay and non-Trocador swaps stay out. - Default nodes (node.wownero.org, sethforprivacy, Blockstream, bysh.me), converted to upstream's isDefault node-list key; Wownero is back in the node reset list. - Privacy: address resolvers limited to domain-anchored sources again; prices.neroswap.com for fiat; upstream's charts tab, which reads prices.cakewallet.com, sits behind FeatureFlag.isChartsEnabled = false. - Lightning stays behind FeatureFlag.isLightningEnabled, including upstream's new post-seed Lightning username step. - Our icon pipeline, branding and bundle identifiers. Twelve new upstream widget tests are skipped: test and code are unchanged from v6.5.0 apart from renames (not rerun on a pristine upstream checkout; upstream's top_bar_test does not compile against its own TopBar). flutter analyze lib: 0 errors; flutter test: 345 passed, 12 skipped; flutter build bundle compiles. Built with Flutter 3.41.9.
183 lines
6.4 KiB
Dart
183 lines
6.4 KiB
Dart
import 'package:hash_wallet/entities/bridge_transfer.dart';
|
|
import 'package:hash_wallet/evm/evm.dart';
|
|
import 'package:hash_wallet/src/widgets/hash_image_widget.dart';
|
|
import 'package:hash_wallet/themes/core/custom_theme_colors.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:intl/intl.dart';
|
|
|
|
class TransferHistoryRow extends StatelessWidget {
|
|
const TransferHistoryRow({
|
|
required this.transfer,
|
|
required this.onTap,
|
|
super.key,
|
|
});
|
|
|
|
final BridgeTransfer transfer;
|
|
final VoidCallback onTap;
|
|
|
|
String _statusLabel(String status) {
|
|
switch (status) {
|
|
case 'submitted':
|
|
return "Submitted";
|
|
case 'confirming':
|
|
return "Confirming on source";
|
|
case 'initiated':
|
|
return "Bridge initiated";
|
|
case 'completed':
|
|
return "Completed";
|
|
case 'failed':
|
|
return "Failed";
|
|
default:
|
|
return status;
|
|
}
|
|
}
|
|
|
|
Color _statusColor(BuildContext context, String status) {
|
|
switch (status) {
|
|
case 'completed':
|
|
return CustomThemeColors.syncGreen;
|
|
case 'failed':
|
|
return Theme.of(context).colorScheme.error;
|
|
case 'submitted':
|
|
case 'confirming':
|
|
case 'initiated':
|
|
default:
|
|
return CustomThemeColors.syncYellow;
|
|
}
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final sourceChainName = evm?.getChainInfoByChainId(transfer.sourceChainId)?.name;
|
|
final destChainName = evm?.getChainInfoByChainId(transfer.destinationChainId)?.name;
|
|
final formattedDate = DateFormat('HH:mm').format(transfer.createdAt);
|
|
final statusText = _statusLabel(transfer.status);
|
|
|
|
return InkWell(
|
|
onTap: onTap,
|
|
child: Container(
|
|
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
|
margin: const EdgeInsets.only(bottom: 16),
|
|
width: double.infinity,
|
|
height: 72,
|
|
decoration: BoxDecoration(
|
|
gradient: LinearGradient(
|
|
colors: [
|
|
Theme.of(context).colorScheme.surfaceContainerHigh,
|
|
Theme.of(context).colorScheme.surfaceContainer,
|
|
],
|
|
begin: Alignment.topCenter,
|
|
end: Alignment.bottomCenter,
|
|
),
|
|
borderRadius: BorderRadius.all(Radius.circular(20)),
|
|
border: Border.all(
|
|
color: Theme.of(context).colorScheme.surfaceContainerHighest,
|
|
width: 1,
|
|
),
|
|
),
|
|
child: Row(
|
|
mainAxisSize: MainAxisSize.max,
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: [
|
|
Container(
|
|
height: 42,
|
|
width: 42,
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(16),
|
|
),
|
|
child: Stack(
|
|
children: [
|
|
HashImageWidget(
|
|
imageUrl:
|
|
'assets/new-ui/crypto_full_icons/${sourceChainName?.toLowerCase()}.svg',
|
|
width: 28,
|
|
height: 28,
|
|
),
|
|
Positioned(
|
|
top: 14,
|
|
left: 12,
|
|
child: HashImageWidget(
|
|
imageUrl:
|
|
'assets/new-ui/crypto_full_icons/${destChainName?.toLowerCase()}.svg',
|
|
width: 28,
|
|
height: 28,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
const SizedBox(width: 8),
|
|
Expanded(
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: <Widget>[
|
|
Text(
|
|
'$sourceChainName → $destChainName',
|
|
style: Theme.of(context).textTheme.bodyLarge?.copyWith(
|
|
fontSize: 16,
|
|
fontWeight: FontWeight.w500,
|
|
color: Theme.of(context).colorScheme.onSurface,
|
|
),
|
|
),
|
|
Text(
|
|
'${transfer.amount} ${transfer.tokenSymbol}',
|
|
style: Theme.of(context).textTheme.bodyLarge?.copyWith(
|
|
fontSize: 16,
|
|
fontWeight: FontWeight.w500,
|
|
color: Theme.of(context).colorScheme.onSurface,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
const SizedBox(height: 8),
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: <Widget>[
|
|
Row(
|
|
children: [
|
|
Container(
|
|
height: 8,
|
|
width: 8,
|
|
decoration: BoxDecoration(
|
|
color: _statusColor(context, transfer.status),
|
|
borderRadius: BorderRadius.circular(12),
|
|
border: Border.all(
|
|
color: Theme.of(context).colorScheme.surface,
|
|
width: 1.5,
|
|
),
|
|
),
|
|
),
|
|
SizedBox(width: 8),
|
|
Text(
|
|
statusText,
|
|
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
|
fontWeight: FontWeight.w500,
|
|
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
|
),
|
|
overflow: TextOverflow.ellipsis,
|
|
),
|
|
],
|
|
),
|
|
Text(
|
|
formattedDate,
|
|
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
|
fontWeight: FontWeight.w500,
|
|
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|