quote requests are paused while the payout amount is being edited

This commit is contained in:
Arseni
2025-12-30 19:08:53 +03:00
parent c3ec50c8e4
commit d9a605ce21
3 changed files with 36 additions and 4 deletions

View File

@@ -33,6 +33,7 @@ class _PaymentAmountWidgetState extends State<PaymentAmountWidget> {
void dispose() {
_focusNode.removeListener(_handleFocusChange);
_focusNode.dispose();
context.read<PaymentAmountProvider>().setEditing(false);
_controller.dispose();
super.dispose();
}
@@ -62,11 +63,13 @@ class _PaymentAmountWidgetState extends State<PaymentAmountWidget> {
}
void _handleFocusChange() {
if (_focusNode.hasFocus) return;
final quotationProvider = context.read<QuotationProvider>();
if (quotationProvider.canRequestQuote) {
quotationProvider.refreshNow(force: false);
final amountProvider = context.read<PaymentAmountProvider>();
if (_focusNode.hasFocus) {
amountProvider.setEditing(true);
return;
}
amountProvider.setEditing(false);
}
@override
@@ -83,6 +86,7 @@ class _PaymentAmountWidgetState extends State<PaymentAmountWidget> {
border: const OutlineInputBorder(),
),
onChanged: _onChanged,
onEditingComplete: () => _focusNode.unfocus(),
);
}
}