mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-12-02 12:14:09 +01:00
fix: Fix QR Code Icons (#2517)
* fix: Fix QR Code Icons * Update QR Code images * fix: QR Codes Wallet Type Images - Added missing solana qr code image to receive page - Added wallet type image to QR on AnonPay invoice and donation pages - Added a getQRImage util for easy access to the qr images * fix: Update eth_pol image for receive page
This commit is contained in:
@@ -4,6 +4,7 @@ import 'package:cake_wallet/di.dart';
|
||||
import 'package:cake_wallet/src/screens/base_page.dart';
|
||||
import 'package:cake_wallet/anonpay/anonpay_donation_link_info.dart';
|
||||
import 'package:cake_wallet/entities/preferences_key.dart';
|
||||
import 'package:cake_wallet/src/screens/receive/anonpay_receive_page.dart';
|
||||
import 'package:cake_wallet/src/widgets/cake_image_widget.dart';
|
||||
import 'package:cw_core/receive_page_option.dart';
|
||||
import 'package:cake_wallet/src/screens/dashboard/widgets/present_receive_option_picker.dart';
|
||||
@@ -188,6 +189,7 @@ class AddressPage extends BasePage {
|
||||
imageUrl: addressListViewModel.monoImage,
|
||||
height: 16,
|
||||
width: 16,
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
),
|
||||
SizedBox(width: 10),
|
||||
Text(
|
||||
@@ -211,17 +213,31 @@ class AddressPage extends BasePage {
|
||||
Center(
|
||||
child: SizedBox(
|
||||
height: 40,
|
||||
width: addressListViewModel.walletImages.length * 30.0,
|
||||
width: addressListViewModel.walletImages.length * 32.0,
|
||||
child: Stack(
|
||||
children: [
|
||||
for (int i = addressListViewModel.walletImages.length - 1; i >= 0; i--)
|
||||
Positioned(
|
||||
left: i * 25.0,
|
||||
child: ClipOval(
|
||||
child: CakeImageWidget(
|
||||
height: 35,
|
||||
width: 35,
|
||||
imageUrl: addressListViewModel.walletImages[i],
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: Theme.of(context).colorScheme.surfaceContainer,
|
||||
width: 3,
|
||||
),
|
||||
color: Theme.of(context).colorScheme.surfaceContainer,
|
||||
borderRadius: BorderRadius.circular(24),
|
||||
),
|
||||
child: ClipOval(
|
||||
child: CakeImageWidget(
|
||||
height: 35,
|
||||
width: 35,
|
||||
imageUrl: addressListViewModel.walletImages[i],
|
||||
color: addressListViewModel.walletImages.last ==
|
||||
addressListViewModel.walletImages[i]
|
||||
? Theme.of(context).colorScheme.onSurfaceVariant
|
||||
: null,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -273,10 +289,13 @@ class AddressPage extends BasePage {
|
||||
Navigator.pushNamed(
|
||||
context,
|
||||
Routes.anonPayReceivePage,
|
||||
arguments: AnonpayDonationLinkInfo(
|
||||
clearnetUrl: clearnetUrl,
|
||||
onionUrl: onionUrl,
|
||||
address: addressListViewModel.address.address,
|
||||
arguments: AnonPayReceivePageArgs(
|
||||
invoiceInfo: AnonpayDonationLinkInfo(
|
||||
clearnetUrl: clearnetUrl,
|
||||
onionUrl: onionUrl,
|
||||
address: addressListViewModel.address.address,
|
||||
),
|
||||
qrImage: addressListViewModel.qrImage,
|
||||
),
|
||||
);
|
||||
} else {
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import 'package:cake_wallet/entities/qr_view_data.dart';
|
||||
import 'package:cake_wallet/routes.dart';
|
||||
import 'package:cake_wallet/src/screens/exchange_trade/widgets/exchange_trade_card_item_widget.dart';
|
||||
import 'package:cake_wallet/src/screens/receive/widgets/qr_image.dart';
|
||||
import 'package:cake_wallet/utils/brightness_util.dart';
|
||||
import 'package:flutter_mobx/flutter_mobx.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
@@ -61,20 +64,39 @@ class ExchangeTradeExternalSendPage extends BasePage {
|
||||
Spacer(flex: 3),
|
||||
Flexible(
|
||||
flex: 6,
|
||||
child: Center(
|
||||
child: AspectRatio(
|
||||
aspectRatio: 1.0,
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(5),
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
width: 3,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
BrightnessUtil.changeBrightnessForFunction(
|
||||
() async {
|
||||
await Navigator.pushNamed(
|
||||
context,
|
||||
Routes.fullscreenQR,
|
||||
arguments: QrViewData(
|
||||
embeddedImagePath: exchangeTradeViewModel.qrImage,
|
||||
data: exchangeTradeViewModel.trade.inputAddress ??
|
||||
fetchingLabel,
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
child: Center(
|
||||
child: AspectRatio(
|
||||
aspectRatio: 1.0,
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(5),
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
width: 3,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
),
|
||||
child: QrImage(
|
||||
data: exchangeTradeViewModel.trade.inputAddress ??
|
||||
fetchingLabel,
|
||||
embeddedImagePath: exchangeTradeViewModel.qrImage,
|
||||
size: 230,
|
||||
),
|
||||
),
|
||||
child: QrImage(
|
||||
data:
|
||||
exchangeTradeViewModel.trade.inputAddress ?? fetchingLabel,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -88,7 +110,8 @@ class ExchangeTradeExternalSendPage extends BasePage {
|
||||
.where((item) => item.isExternalSendDetail)
|
||||
.map(
|
||||
(item) => TradeItemRowWidget(
|
||||
key: ValueKey('exchange_trade_external_send_page_send_item_${item.title}_key'),
|
||||
key: ValueKey(
|
||||
'exchange_trade_external_send_page_send_item_${item.title}_key'),
|
||||
currentTheme: currentTheme,
|
||||
title: item.title,
|
||||
value: item.data,
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import 'package:cake_wallet/anonpay/anonpay_donation_link_info.dart';
|
||||
import 'package:cake_wallet/anonpay/anonpay_invoice_info.dart';
|
||||
import 'package:cake_wallet/core/execution_state.dart';
|
||||
import 'package:cake_wallet/di.dart';
|
||||
import 'package:cake_wallet/entities/preferences_key.dart';
|
||||
import 'package:cake_wallet/src/screens/receive/anonpay_receive_page.dart';
|
||||
import 'package:cw_core/receive_page_option.dart';
|
||||
import 'package:cake_wallet/routes.dart';
|
||||
import 'package:cake_wallet/src/screens/dashboard/widgets/present_receive_option_picker.dart';
|
||||
@@ -200,12 +202,18 @@ class AnonPayInvoicePage extends BasePage {
|
||||
if (clearnetUrl != null &&
|
||||
onionUrl != null &&
|
||||
anonInvoicePageViewModel.currentWalletName == donationWalletName) {
|
||||
Navigator.pushReplacementNamed(context, Routes.anonPayReceivePage,
|
||||
arguments: AnonpayDonationLinkInfo(
|
||||
Navigator.pushReplacementNamed(
|
||||
context,
|
||||
Routes.anonPayReceivePage,
|
||||
arguments: AnonPayReceivePageArgs(
|
||||
invoiceInfo: AnonpayDonationLinkInfo(
|
||||
clearnetUrl: clearnetUrl,
|
||||
onionUrl: onionUrl,
|
||||
address: anonInvoicePageViewModel.address,
|
||||
));
|
||||
),
|
||||
qrImage: anonInvoicePageViewModel.qrImage,
|
||||
),
|
||||
);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -214,7 +222,14 @@ class AnonPayInvoicePage extends BasePage {
|
||||
|
||||
reaction((_) => anonInvoicePageViewModel.state, (ExecutionState state) {
|
||||
if (state is ExecutedSuccessfullyState) {
|
||||
Navigator.pushNamed(context, Routes.anonPayReceivePage, arguments: state.payload);
|
||||
Navigator.pushNamed(
|
||||
context,
|
||||
Routes.anonPayReceivePage,
|
||||
arguments: AnonPayReceivePageArgs(
|
||||
invoiceInfo: state.payload as AnonpayInvoiceInfo,
|
||||
qrImage: anonInvoicePageViewModel.qrImage,
|
||||
),
|
||||
);
|
||||
}
|
||||
if (state is FailureState) {
|
||||
showPopUp<void>(
|
||||
|
||||
@@ -13,10 +13,18 @@ import 'package:cake_wallet/utils/brightness_util.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:qr_flutter/qr_flutter.dart' as qr;
|
||||
|
||||
class AnonPayReceivePage extends BasePage {
|
||||
class AnonPayReceivePageArgs {
|
||||
final AnonpayInfoBase invoiceInfo;
|
||||
final String? qrImage;
|
||||
|
||||
AnonPayReceivePage({required this.invoiceInfo});
|
||||
AnonPayReceivePageArgs({required this.invoiceInfo, this.qrImage});
|
||||
}
|
||||
|
||||
class AnonPayReceivePage extends BasePage {
|
||||
AnonPayReceivePage({required this.args}) : invoiceInfo = args.invoiceInfo;
|
||||
|
||||
final AnonPayReceivePageArgs args;
|
||||
final AnonpayInfoBase invoiceInfo;
|
||||
|
||||
@override
|
||||
String get title => S.current.receive;
|
||||
@@ -104,6 +112,7 @@ class AnonPayReceivePage extends BasePage {
|
||||
arguments: QrViewData(
|
||||
data: invoiceInfo.clearnetUrl,
|
||||
version: qr.QrVersions.auto,
|
||||
embeddedImagePath: args.qrImage,
|
||||
));
|
||||
});
|
||||
},
|
||||
@@ -123,6 +132,8 @@ class AnonPayReceivePage extends BasePage {
|
||||
child: QrImage(
|
||||
data: invoiceInfo.clearnetUrl,
|
||||
version: qr.QrVersions.auto,
|
||||
embeddedImagePath: args.qrImage,
|
||||
size: 230,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -71,6 +71,7 @@ class FullscreenQRPage extends BasePage {
|
||||
),
|
||||
),
|
||||
child: QrImage(
|
||||
size: 360,
|
||||
data: qrViewData.data,
|
||||
version: qrViewData.version,
|
||||
embeddedImagePath: qrViewData.embeddedImagePath,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:qr_flutter/qr_flutter.dart' as qr;
|
||||
|
||||
class QrImage extends StatelessWidget {
|
||||
@@ -22,15 +23,43 @@ class QrImage extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return qr.QrImageView(
|
||||
data: data,
|
||||
errorCorrectionLevel: errorCorrectionLevel,
|
||||
version: version ?? qr.QrVersions.auto,
|
||||
size: size,
|
||||
foregroundColor: foregroundColor,
|
||||
backgroundColor: backgroundColor,
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
embeddedImage: AssetImage(embeddedImagePath ?? 'assets/images/qr-cake.png'),
|
||||
);
|
||||
final imagePath = embeddedImagePath ?? 'assets/images/qr-cake.png';
|
||||
final isSvg = imagePath.endsWith('.svg');
|
||||
|
||||
if (isSvg) {
|
||||
final qrSize = size ?? 100.0;
|
||||
final logoSize = qrSize * 0.30;
|
||||
|
||||
return Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
qr.QrImageView(
|
||||
data: data,
|
||||
errorCorrectionLevel: errorCorrectionLevel,
|
||||
version: version ?? qr.QrVersions.auto,
|
||||
size: qrSize,
|
||||
foregroundColor: foregroundColor,
|
||||
backgroundColor: backgroundColor,
|
||||
padding: const EdgeInsets.all(12.0),
|
||||
),
|
||||
SvgPicture.asset(
|
||||
imagePath,
|
||||
width: logoSize * 0.8,
|
||||
height: logoSize * 0.8,
|
||||
),
|
||||
],
|
||||
);
|
||||
} else {
|
||||
return qr.QrImageView(
|
||||
data: data,
|
||||
errorCorrectionLevel: errorCorrectionLevel,
|
||||
version: version ?? qr.QrVersions.auto,
|
||||
size: size,
|
||||
foregroundColor: foregroundColor,
|
||||
backgroundColor: backgroundColor,
|
||||
padding: const EdgeInsets.all(12.0),
|
||||
embeddedImage: AssetImage(imagePath),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,17 +97,14 @@ class QRWidget extends StatelessWidget {
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
clipBehavior: Clip.hardEdge,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(12.5),
|
||||
),
|
||||
padding: EdgeInsets.all(3),
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(12.5),
|
||||
child: AspectRatio(
|
||||
aspectRatio: 1.0,
|
||||
child: QrImage(
|
||||
embeddedImagePath: addressListViewModel.qrImage,
|
||||
data: addressUri.toString(),
|
||||
size: 230,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -199,32 +196,29 @@ class QRWidget extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
Observer(
|
||||
builder: (_) => Padding(
|
||||
padding: EdgeInsets.only(top: 10),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Form(
|
||||
key: formKey,
|
||||
child: CurrencyAmountTextField(
|
||||
hasUnderlineBorder: true,
|
||||
borderWidth: 0.0,
|
||||
selectedCurrency: _currencyName,
|
||||
selectedCurrencyDecimals:
|
||||
addressListViewModel.selectedCurrency.decimals,
|
||||
amountFocusNode: amountTextFieldFocusNode,
|
||||
amountController: amountController,
|
||||
padding: EdgeInsets.only(top: 20, left: _width / 4),
|
||||
currentThemeType: currentTheme.type,
|
||||
isAmountEditable: true,
|
||||
tag: addressListViewModel.selectedCurrency.tag,
|
||||
onTapPicker: () => _presentPicker(context),
|
||||
isPickerEnable: true,
|
||||
),
|
||||
builder: (_) => Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Form(
|
||||
key: formKey,
|
||||
child: CurrencyAmountTextField(
|
||||
hasUnderlineBorder: true,
|
||||
borderWidth: 0.0,
|
||||
selectedCurrency: _currencyName,
|
||||
selectedCurrencyDecimals:
|
||||
addressListViewModel.selectedCurrency.decimals,
|
||||
amountFocusNode: amountTextFieldFocusNode,
|
||||
amountController: amountController,
|
||||
padding: EdgeInsets.only(top: 20, left: _width / 4),
|
||||
currentThemeType: currentTheme.type,
|
||||
isAmountEditable: true,
|
||||
tag: addressListViewModel.selectedCurrency.tag,
|
||||
onTapPicker: () => _presentPicker(context),
|
||||
isPickerEnable: true,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
)),
|
||||
Divider(height: 1, color: Theme.of(context).colorScheme.outlineVariant),
|
||||
Padding(
|
||||
|
||||
@@ -39,6 +39,7 @@ class CakeImageWidget extends StatelessWidget {
|
||||
imageUrl!,
|
||||
height: height,
|
||||
width: width,
|
||||
color: color,
|
||||
fit: fit ?? BoxFit.contain,
|
||||
)
|
||||
: Image.asset(
|
||||
@@ -54,6 +55,7 @@ class CakeImageWidget extends StatelessWidget {
|
||||
imageUrl!,
|
||||
height: height,
|
||||
width: width,
|
||||
color: color,
|
||||
fit: fit ?? BoxFit.contain,
|
||||
placeholderBuilder: (_) {
|
||||
return loadingWidget ?? const Center(child: CircularProgressIndicator());
|
||||
|
||||
Reference in New Issue
Block a user