Merge branch 'staging' into xmr-sync

This commit is contained in:
julian-CStack 2022-12-31 12:02:14 -06:00 committed by GitHub
commit bdab241d7e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 95 additions and 73 deletions
lib
pages
exchange_view
settings_views/wallet_settings_view/wallet_settings_wallet_settings
pages_desktop_specific/my_stack_view/wallet_view/sub_widgets
pubspec.yaml

View file

@ -69,17 +69,21 @@ class _ExchangeFormState extends ConsumerState<ExchangeForm> {
bool _swapLock = false;
void sendFieldOnChanged(String value) async {
final newFromAmount = Decimal.tryParse(value);
if (_sendFocusNode.hasFocus) {
final newFromAmount = Decimal.tryParse(value);
ref.read(exchangeFormStateProvider).fromAmount =
newFromAmount ?? Decimal.zero;
await ref
.read(exchangeFormStateProvider)
.setFromAmountAndCalculateToAmount(
newFromAmount ?? Decimal.zero, true);
if (newFromAmount == null) {
_receiveController.text =
ref.read(prefsChangeNotifierProvider).exchangeRateType ==
ExchangeRateType.estimated
? "-"
: "";
if (newFromAmount == null) {
_receiveController.text =
ref.read(prefsChangeNotifierProvider).exchangeRateType ==
ExchangeRateType.estimated
? "-"
: "";
}
}
}
@ -138,7 +142,9 @@ class _ExchangeFormState extends ConsumerState<ExchangeForm> {
);
await Future<void>.delayed(const Duration(milliseconds: 300));
Navigator.of(context, rootNavigator: true).pop();
} else {
final toTicker = ref.read(exchangeFormStateProvider).toTicker ?? "";
final fromTicker = ref.read(exchangeFormStateProvider).fromTicker ?? "";
@ -1140,38 +1146,43 @@ class _ExchangeFormState extends ConsumerState<ExchangeForm> {
: ref.read(exchangeFormStateProvider).toAmountString;
}
_sendFocusNode.addListener(() async {
if (!_sendFocusNode.hasFocus) {
final newFromAmount = Decimal.tryParse(_sendController.text);
await ref
.read(exchangeFormStateProvider)
.setFromAmountAndCalculateToAmount(
newFromAmount ?? Decimal.zero, true);
if (newFromAmount == null) {
_receiveController.text =
ref.read(prefsChangeNotifierProvider).exchangeRateType ==
ExchangeRateType.estimated
? "-"
: "";
}
}
});
_receiveFocusNode.addListener(() async {
if (!_receiveFocusNode.hasFocus) {
final newToAmount = Decimal.tryParse(_receiveController.text);
if (ref.read(prefsChangeNotifierProvider).exchangeRateType !=
ExchangeRateType.estimated) {
await ref
.read(exchangeFormStateProvider)
.setToAmountAndCalculateFromAmount(
newToAmount ?? Decimal.zero, true);
}
if (newToAmount == null) {
_sendController.text = "";
}
}
});
// _sendFocusNode.addListener(() async {
// if (!_sendFocusNode.hasFocus) {
// final newFromAmount = Decimal.tryParse(_sendController.text);
// await ref
// .read(exchangeFormStateProvider)
// .setFromAmountAndCalculateToAmount(
// newFromAmount ?? Decimal.zero, true);
//
// debugPrint("SendFocusNode has fired");
//
// if (newFromAmount == null) {
// _receiveController.text =
// ref.read(prefsChangeNotifierProvider).exchangeRateType ==
// ExchangeRateType.estimated
// ? "-"
// : "";
// }
// }
// });
//
// _receiveFocusNode.addListener(() async {
// if (!_receiveFocusNode.hasFocus) {
// final newToAmount = Decimal.tryParse(_receiveController.text);
// if (ref.read(prefsChangeNotifierProvider).exchangeRateType !=
// ExchangeRateType.estimated) {
// await ref
// .read(exchangeFormStateProvider)
// .setToAmountAndCalculateFromAmount(
// newToAmount ?? Decimal.zero, true);
//
// debugPrint("ReceiveFocusNode has fired");
// }
// if (newToAmount == null) {
// _sendController.text = "";
// }
// }
// });
super.initState();
}
@ -1187,6 +1198,7 @@ class _ExchangeFormState extends ConsumerState<ExchangeForm> {
Widget build(BuildContext context) {
debugPrint("BUILD: $runtimeType");
// provider for simpleswap; not called rn
ref.listen<String>(currentExchangeNameStateProvider, (previous, next) {
ref.read(exchangeFormStateProvider).exchange = ref.read(exchangeProvider);
});
@ -1380,13 +1392,15 @@ class _ExchangeFormState extends ConsumerState<ExchangeForm> {
onChanged: onRateTypeChanged,
),
),
if (ref.read(exchangeFormStateProvider).fromAmount != null &&
ref.read(exchangeFormStateProvider).fromAmount != Decimal.zero)
// these reads should be watch
if (ref.watch(exchangeFormStateProvider).fromAmount != null &&
ref.watch(exchangeFormStateProvider).fromAmount != Decimal.zero)
SizedBox(
height: isDesktop ? 20 : 12,
),
if (ref.read(exchangeFormStateProvider).fromAmount != null &&
ref.read(exchangeFormStateProvider).fromAmount != Decimal.zero)
// these reads should be watch
if (ref.watch(exchangeFormStateProvider).fromAmount != null &&
ref.watch(exchangeFormStateProvider).fromAmount != Decimal.zero)
ExchangeProviderOptions(
from: ref.watch(exchangeFormStateProvider).fromTicker,
to: ref.watch(exchangeFormStateProvider).toTicker,

View file

@ -77,35 +77,43 @@ class ExchangeProviderOptions extends ConsumerWidget {
SizedBox(
width: 20,
height: 20,
child: Radio(
activeColor: Theme.of(context)
.extension<StackColors>()!
.radioButtonIconEnabled,
value: ChangeNowExchange.exchangeName,
groupValue: ref
.watch(currentExchangeNameStateProvider.state)
.state,
onChanged: (value) {
if (value is String) {
ref
.read(currentExchangeNameStateProvider.state)
.state = value;
ref.read(exchangeFormStateProvider).exchange =
Exchange.fromName(ref
.read(currentExchangeNameStateProvider
.state)
.state);
}
},
child: Padding(
padding:
EdgeInsets.only(top: isDesktop ? 20.0 : 15.0),
child: Radio(
activeColor: Theme.of(context)
.extension<StackColors>()!
.radioButtonIconEnabled,
value: ChangeNowExchange.exchangeName,
groupValue: ref
.watch(currentExchangeNameStateProvider.state)
.state,
onChanged: (value) {
if (value is String) {
ref
.read(
currentExchangeNameStateProvider.state)
.state = value;
ref.read(exchangeFormStateProvider).exchange =
Exchange.fromName(ref
.read(currentExchangeNameStateProvider
.state)
.state);
}
},
),
),
),
const SizedBox(
width: 14,
),
SvgPicture.asset(
Assets.exchange.changeNow,
width: isDesktop ? 32 : 24,
height: isDesktop ? 32 : 24,
Padding(
padding: const EdgeInsets.only(top: 5.0),
child: SvgPicture.asset(
Assets.exchange.changeNow,
width: isDesktop ? 32 : 24,
height: isDesktop ? 32 : 24,
),
),
const SizedBox(
width: 10,

View file

@ -57,7 +57,7 @@ class DeleteWalletWarningView extends ConsumerWidget {
.extension<StackColors>()!
.warningBackground,
child: Text(
"You are going to permanently delete you wallet.\n\nIf you delete your wallet, the only way you can have access to your funds is by using your backup key.\n\nStack Wallet does not keep nor is able to restore your backup key or your wallet.\n\nPLEASE SAVE YOUR BACKUP KEY.",
"You are going to permanently delete your wallet.\n\nIf you delete your wallet, the only way you can have access to your funds is by using your backup key.\n\nStack Wallet does not keep nor is able to restore your backup key or your wallet.\n\nPLEASE SAVE YOUR BACKUP KEY.",
style: STextStyles.baseXS(context).copyWith(
color: Theme.of(context)
.extension<StackColors>()!

View file

@ -66,7 +66,7 @@ class _DesktopAttentionDeleteWallet
child: Padding(
padding: const EdgeInsets.all(10.0),
child: Text(
"You are going to permanently delete you wallet.\n\nIf you delete your wallet, "
"You are going to permanently delete your wallet.\n\nIf you delete your wallet, "
"the only way you can have access to your funds is by using your backup key."
"\n\nStack Wallet does not keep nor is able to restore your backup key or your wallet."
"\n\nPLEASE SAVE YOUR BACKUP KEY.",
@ -74,7 +74,7 @@ class _DesktopAttentionDeleteWallet
.copyWith(
color: Theme.of(context)
.extension<StackColors>()!
.textDark3,
.snackBarTextError,
),
),
),

View file

@ -11,7 +11,7 @@ description: Stack Wallet
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.5.26+99
version: 1.5.27+100
environment:
sdk: ">=2.17.0 <3.0.0"