CW-997 coin control enhancements / send ALL fixes (#2114)

* computed sending balance value

* files that didnt get added before

* monero + move unspent calc to view model

* working

* remove old code

* Update lib/view_model/send/send_view_model.dart

---------

Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
This commit is contained in:
Matthew Fosse
2025-03-30 16:52:46 +02:00
committed by GitHub
co-authored by Omar Hatem
parent 7831b421b1
commit 40a0989956
8 changed files with 106 additions and 12 deletions
+13 -7
View File
@@ -244,7 +244,7 @@ class SendCardState extends State<SendCard> with AutomaticKeepAliveClientMixin<S
currencyValueValidator: output.sendAll
? sendViewModel.allAmountValidator
: sendViewModel.amountValidator,
allAmountCallback: () async => output.setSendAll(sendViewModel.balance)),
allAmountCallback: () async => output.setSendAll(sendViewModel.sendingBalance)),
Divider(
height: 1,
color: Theme.of(context).extension<SendPageTheme>()!.textFieldHintColor),
@@ -266,7 +266,7 @@ class SendCardState extends State<SendCard> with AutomaticKeepAliveClientMixin<S
),
),
Text(
sendViewModel.balance,
sendViewModel.sendingBalance,
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w600,
@@ -384,10 +384,16 @@ class SendCardState extends State<SendCard> with AutomaticKeepAliveClientMixin<S
padding: EdgeInsets.only(top: 6),
child: GestureDetector(
key: ValueKey('send_page_unspent_coin_button_key'),
onTap: () => Navigator.of(context).pushNamed(
Routes.unspentCoinsList,
arguments: widget.sendViewModel.coinTypeToSpendFrom,
),
onTap: () async {
await Navigator.of(context).pushNamed(
Routes.unspentCoinsList,
arguments: widget.sendViewModel.coinTypeToSpendFrom,
);
if (mounted) {
// we just got back from the unspent coins list screen, so we need to recompute the sending balance:
sendViewModel.updateSendingBalance();
}
},
child: Container(
color: Colors.transparent,
child: Row(
@@ -505,7 +511,7 @@ class SendCardState extends State<SendCard> with AutomaticKeepAliveClientMixin<S
reaction((_) => sendViewModel.selectedCryptoCurrency, (Currency currency) {
if (output.sendAll) {
output.setSendAll(sendViewModel.balance);
output.setSendAll(sendViewModel.sendingBalance);
}
output.setCryptoAmount(cryptoAmountController.text);