mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-11-22 10:34:17 +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.
157 lines
7.0 KiB
Dart
157 lines
7.0 KiB
Dart
import 'dart:math';
|
|
|
|
import 'package:hash_wallet/di.dart';
|
|
import 'package:hash_wallet/generated/i18n.dart';
|
|
import 'package:hash_wallet/src/widgets/hash_image_widget.dart';
|
|
import 'package:hash_wallet/themes/core/theme_store.dart';
|
|
import 'package:hash_wallet/view_model/wallet_address_list/wallet_address_list_view_model.dart';
|
|
import 'package:cw_core/crypto_currency.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_mobx/flutter_mobx.dart';
|
|
|
|
import '../../../src/screens/receive/widgets/qr_image.dart';
|
|
|
|
class ReceiveQrCode extends StatelessWidget {
|
|
ReceiveQrCode({
|
|
super.key,
|
|
required this.onTap,
|
|
required this.largeQrMode,
|
|
required this.addressListViewModel,
|
|
});
|
|
|
|
final VoidCallback onTap;
|
|
final bool largeQrMode;
|
|
final WalletAddressListViewModel addressListViewModel;
|
|
|
|
static const double largeQrModeBottomPadding = 140;
|
|
static const Duration animDuration = Duration(milliseconds: 500);
|
|
final bool isLightMode = !(getIt.get<ThemeStore>().currentTheme.isDark);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final double targetY = largeQrMode ? largeQrModeBottomPadding + 50 : 0;
|
|
final double resolvedSize =
|
|
min(MediaQuery.of(context).size.width, MediaQuery.of(context).size.height) * 0.5;
|
|
final double resolvedScale = largeQrMode ? 1.7 : 1;
|
|
|
|
return Stack(
|
|
alignment: Alignment.topCenter,
|
|
children: [
|
|
AnimatedSlide(
|
|
curve: Curves.easeOutCubic,
|
|
duration: animDuration,
|
|
offset: largeQrMode ? Offset(0, -1) : Offset.zero,
|
|
child: AnimatedOpacity(
|
|
duration: animDuration,
|
|
opacity: largeQrMode ? 1 : 0,
|
|
child: HashImageWidget(
|
|
imageUrl: isLightMode
|
|
? "assets/new-ui/hash-wordmark-light.svg"
|
|
: "assets/new-ui/hash-wordmark.svg",
|
|
height: 45,
|
|
)),
|
|
),
|
|
// The QR, and the payjoin badge below it, share one tap target, so they
|
|
// are merged into a single button node named by the QR's own label
|
|
// rather than each becoming a separate focus stop.
|
|
MergeSemantics(
|
|
child: Semantics(
|
|
hint: largeQrMode ? S.of(context).qr_close_fullscreen : S.of(context).qr_fullscreen,
|
|
button: true,
|
|
enabled: true,
|
|
child: GestureDetector(
|
|
onTap: onTap,
|
|
behavior: HitTestBehavior.opaque,
|
|
child: TweenAnimationBuilder<double>(
|
|
tween: Tween<double>(begin: 0, end: targetY),
|
|
duration: animDuration,
|
|
curve: Curves.easeOutCubic,
|
|
builder: (context, value, child) {
|
|
return Transform.translate(
|
|
offset: Offset(0, value),
|
|
child: child,
|
|
);
|
|
},
|
|
child: Observer(
|
|
builder: (_) => Column(
|
|
children: [
|
|
AnimatedScale(
|
|
curve: Curves.easeOutCubic,
|
|
alignment: Alignment.bottomCenter,
|
|
scale: resolvedScale,
|
|
duration: animDuration,
|
|
child: AnimatedContainer(
|
|
duration: animDuration,
|
|
curve: Curves.easeOutCubic,
|
|
width: resolvedSize,
|
|
height: resolvedSize,
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(20),
|
|
color: Colors.white,
|
|
),
|
|
child: Container(
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.vertical(top: Radius.circular(20)),
|
|
color: addressListViewModel.hasPayjoin && !largeQrMode
|
|
? Theme.of(context).colorScheme.surfaceContainer
|
|
: Colors.transparent),
|
|
child: ClipRRect(
|
|
borderRadius: BorderRadius.circular(20),
|
|
child: Observer(
|
|
builder: (_) => QrImage(
|
|
data: addressListViewModel.uri.toString(),
|
|
size: resolvedSize,
|
|
semanticsLabel: S.of(context).qr_code_receive_address,
|
|
embeddedImagePath:
|
|
addressListViewModel.tokenCurrency != null
|
|
? addressListViewModel.tokenCurrency ==
|
|
CryptoCurrency.btcln
|
|
? addressListViewModel.qrImage
|
|
: addressListViewModel
|
|
.tokenCurrency!.iconPath
|
|
: addressListViewModel.qrImage,
|
|
))),
|
|
),
|
|
),
|
|
),
|
|
if (addressListViewModel.hasPayjoin)
|
|
// Hidden but still mounted in large-QR mode, so keep it
|
|
// out of the semantics tree there.
|
|
ExcludeSemantics(
|
|
excluding: largeQrMode,
|
|
child: Opacity(
|
|
opacity: largeQrMode ? 0 : 1,
|
|
child: Container(
|
|
width: resolvedSize,
|
|
decoration: BoxDecoration(
|
|
borderRadius:
|
|
BorderRadius.vertical(bottom: Radius.circular(16)),
|
|
color: Theme.of(context).colorScheme.surfaceContainer),
|
|
child: Padding(
|
|
padding: const EdgeInsets.symmetric(vertical: 2.0),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
spacing: 4,
|
|
children: [
|
|
HashImageWidget(imageUrl: "assets/new-ui/payjoin.svg"),
|
|
Text(S.of(context).payjoin_enabled)
|
|
],
|
|
),
|
|
))),
|
|
),
|
|
AnimatedSize(
|
|
duration: animDuration,
|
|
curve: Curves.easeOutCubic,
|
|
child: SizedBox(height: largeQrMode ? largeQrModeBottomPadding + 40 : 0))
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|