mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-19 05:58:50 +02:00
The big one. Touches 760+ files. Locks in the user's decision to break import-line compatibility with upstream cake-tech/cake_wallet in exchange for a binary named hash_wallet on every platform. Changes: - pubspec_description.yaml: project name cake_wallet -> hash_wallet - 762 Dart files: every 'package:cake_wallet/...' import rewritten to 'package:hash_wallet/...' (lib/, cw_*/lib/, tool/, test/, integration_test/) - linux/CMakeLists.txt: BINARY_NAME cake_wallet -> hash_wallet - windows/CMakeLists.txt: project + BINARY_NAME (CakeWallet -> HashWallet) - windows/runner/Runner.rc: company / file / product strings to Hash Wallet + Such Software LLC copyright - macos/Runner.xcodeproj/project_base.pbxproj: cake_wallet_new.app refs -> hash_wallet.app (macOS output bundle name) - com.suchsoftware.HashWallet.yml (Flatpak): all binary path refs cake_wallet -> hash_wallet (e.g. /app/hash_wallet/hash_wallet) - linux/com.suchsoftware.HashWallet.desktop: Exec=hash_wallet - scripts/android/copy_monero_deps.sh: CW_DIR target path - configure_hash_wallet.sh: error message typo (old filename) INTENTIONALLY UNCHANGED: - cw_* subpackage names (cw_core, cw_bitcoin, cw_wownero, etc.) — they remain as the historical 'cake wallet' naming; renaming them would cascade through every sub-package's internal structure - Method channel name 'com.cake_wallet/native_utils' in iOS/macOS/Android AppDelegates and MainActivity — it's a string identifier that has to match the Dart side exactly. Renaming requires both-sides change; it's internal-only and not user-visible. - ghcr.io/cake-tech/cake_wallet:debian13-... docker image references in build scripts — that's Cake Labs' published image we use as the build environment, not ours. User data directory now follows the new binary name: ~/.local/share/hash_wallet/ (was ~/.local/share/cake_wallet/) ~/.config/hash_wallet/ (was ~/.config/cake_wallet/) Existing users on the old name will need migration if any exist.
102 lines
3.5 KiB
Dart
102 lines
3.5 KiB
Dart
import 'package:hash_wallet/generated/i18n.dart';
|
|
import 'package:hash_wallet/new-ui/widgets/modern_button.dart';
|
|
import 'package:cw_core/crypto_amount_format.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_mobx/flutter_mobx.dart';
|
|
|
|
class FiatAmountBar extends StatelessWidget {
|
|
const FiatAmountBar(
|
|
{super.key,
|
|
required this.fiatInputMode,
|
|
required this.onSwitchButtonPressed,
|
|
this.onAllButtonPressed,
|
|
required this.cryptoAmount,
|
|
required this.fiatAmount,
|
|
required this.cryptoCurrency,
|
|
required this.fiatCurrency,
|
|
this.allAmount,
|
|
this.foregroundElementColor,
|
|
this.textColor, this.allAmountColor, this.allAmountTextColor});
|
|
|
|
final bool fiatInputMode;
|
|
final VoidCallback onSwitchButtonPressed;
|
|
final VoidCallback? onAllButtonPressed;
|
|
|
|
final String cryptoAmount;
|
|
final String fiatAmount;
|
|
final String cryptoCurrency;
|
|
final String fiatCurrency;
|
|
final String? allAmount;
|
|
final Color? foregroundElementColor;
|
|
final Color? textColor;
|
|
final Color? allAmountColor;
|
|
final Color? allAmountTextColor;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Row(
|
|
spacing: 8,
|
|
children: [
|
|
ModernButton.svg(
|
|
backgroundColor: foregroundElementColor,
|
|
size: 28,
|
|
svgPath: "assets/new-ui/switch.svg",
|
|
iconSize: 18,
|
|
onPressed: onSwitchButtonPressed,
|
|
),
|
|
Observer(
|
|
builder: (_) => GestureDetector(
|
|
onTap: onSwitchButtonPressed,
|
|
child: Text(
|
|
fiatInputMode
|
|
? "${cryptoAmount.isEmpty ? "0" : cryptoAmount.withMaxDecimals(8)} ${cryptoCurrency}"
|
|
: "${fiatAmount.isEmpty ? "0" : fiatAmount} ${fiatCurrency}",
|
|
style: TextStyle(color: textColor ?? Theme.of(context).colorScheme.onSurface),
|
|
),
|
|
)),
|
|
],
|
|
),
|
|
if (allAmount != null && allAmount!.isNotEmpty)
|
|
Row(
|
|
spacing: 8,
|
|
children: [
|
|
Text(
|
|
"${S.of(context).max}.",
|
|
style: TextStyle(color: textColor ?? Theme.of(context).colorScheme.onSurface),
|
|
),
|
|
Container(
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(999999)),
|
|
child: Material(
|
|
color: allAmountColor ?? foregroundElementColor ?? Theme.of(context).colorScheme.surfaceContainer,
|
|
borderRadius: BorderRadius.circular(99999),
|
|
child: InkWell(
|
|
borderRadius: BorderRadius.circular(99999),
|
|
onTap: onAllButtonPressed,
|
|
child: Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 4),
|
|
child: Text(
|
|
formatAmount(allAmount!),
|
|
style: TextStyle(color: allAmountTextColor ?? Theme.of(context).colorScheme.primary),
|
|
),
|
|
),
|
|
)),
|
|
)
|
|
],
|
|
)
|
|
],
|
|
);
|
|
}
|
|
|
|
String formatAmount(String amount) {
|
|
try {
|
|
return double.parse(amount).toStringAsPrecision(8).replaceFirst(RegExp(r"\.?0+$"), "");
|
|
} catch(e) {
|
|
return amount;
|
|
}
|
|
}
|
|
}
|