CW-942-New-Swap-UI-Flow (#2036)

* feat: Implement New Swap UI including fee items and coin control and extract common fee logic to a feeViewModel, use that in SendViewModel and ExchangeViewModel

* feat: Implement New Swap UI with fee items and coin control and extract common fee logic to a feeViewModel for use in SendViewModel and ExchangeViewModel

* Update colors

* Show warning if user choose a below default transaction priority

* fix: Add warning when user select less than default transaction priority and add condition to show extraId

* Complete Swap UI flow

* Handle edgecases for XRP

* Switch swap page button texts

* Handle edgecases for XLM

* Switch prompt text and handle edgecases

---------

Co-authored-by: tuxpizza <tuxsudo@tux.pizza>
Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
This commit is contained in:
David Adegoke 2025-03-14 17:31:31 +01:00 committed by GitHub
parent 0f301a71a2
commit 9f3078740e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
48 changed files with 1048 additions and 327 deletions

View file

@ -576,11 +576,11 @@ abstract class TransactionDetailsViewModelBase with Store {
}
final priorities = priorityForWalletType(wallet.type);
final selectedItem = priorities.indexOf(sendViewModel.transactionPriority);
final customItem = priorities
.firstWhereOrNull((element) => element == sendViewModel.bitcoinTransactionPriorityCustom);
final selectedItem = priorities.indexOf(sendViewModel.feesViewModel.transactionPriority);
final customItem = priorities.firstWhereOrNull(
(element) => element == sendViewModel.feesViewModel.bitcoinTransactionPriorityCustom);
final customItemIndex = customItem != null ? priorities.indexOf(customItem) : null;
final maxCustomFeeRate = sendViewModel.maxCustomFeeRate?.toDouble();
final maxCustomFeeRate = sendViewModel.feesViewModel.maxCustomFeeRate?.toDouble();
RBFListItems.add(
StandardPickerListItem(
@ -594,7 +594,7 @@ abstract class TransactionDetailsViewModelBase with Store {
selectedIdx: selectedItem,
customItemIndex: customItemIndex ?? 0,
displayItem: (dynamic priority, double sliderValue) =>
sendViewModel.displayFeeRate(priority, sliderValue.round()),
sendViewModel.feesViewModel.displayFeeRate(priority, sliderValue.round()),
onSliderChanged: (double newValue) =>
setNewFee(value: newValue, priority: transactionPriority!),
onItemSelected: (dynamic item, double sliderValue) {
@ -788,7 +788,8 @@ abstract class TransactionDetailsViewModelBase with Store {
final comment = tx.additionalInfo['comment'] as String?;
items.addAll([
StandartListItem(title: S.current.transaction_details_transaction_id, value: tx.id),
StandartListItem(title: 'Asset ID', value: tx.additionalInfo['assetId'] as String? ?? "Unknown asset id"),
StandartListItem(
title: 'Asset ID', value: tx.additionalInfo['assetId'] as String? ?? "Unknown asset id"),
StandartListItem(
title: S.current.transaction_details_date, value: dateFormat.format(tx.date)),
StandartListItem(title: S.current.transaction_details_height, value: '${tx.height}'),
@ -798,5 +799,5 @@ abstract class TransactionDetailsViewModelBase with Store {
if (comment != null && comment.isNotEmpty)
StandartListItem(title: S.current.transaction_details_title, value: comment),
]);
}
}
}