added comment for payment, changed intent and added amount ui in operations

This commit is contained in:
Arseni
2026-03-12 00:09:38 +03:00
parent ddc2f1facc
commit 13b84e1e0f
26 changed files with 271 additions and 298 deletions

View File

@@ -8,6 +8,7 @@ import 'package:pshared/utils/money.dart';
import 'package:pweb/models/payment/amount/mode.dart';
class PaymentAmountFieldController extends ChangeNotifier {
static const String _settlementCurrencyCode = 'RUB';
@@ -19,9 +20,9 @@ class PaymentAmountFieldController extends ChangeNotifier {
bool _isSyncingText = false;
PaymentAmountMode _mode = PaymentAmountMode.debit;
PaymentAmountFieldController({required double initialAmount})
PaymentAmountFieldController({required double? initialAmount})
: textController = TextEditingController(
text: amountToString(initialAmount),
text: initialAmount == null ? '' : amountToString(initialAmount),
);
PaymentAmountMode get mode => _mode;
@@ -57,9 +58,7 @@ class PaymentAmountFieldController extends ChangeNotifier {
void handleChanged(String value) {
if (_isSyncingText) return;
final parsed = _parseAmount(value);
if (parsed != null) {
_provider?.setAmount(parsed);
}
_provider?.setAmount(parsed);
}
void handleModeChanged(PaymentAmountMode value) {
@@ -130,11 +129,11 @@ class PaymentAmountFieldController extends ChangeNotifier {
return parsed.isNaN ? null : parsed;
}
void _syncTextWithAmount(double amount) {
void _syncTextWithAmount(double? amount) {
final parsedText = _parseAmount(textController.text);
if (parsedText != null && parsedText == amount) return;
if (parsedText == amount) return;
final nextText = amountToString(amount);
final nextText = amount == null ? '' : amountToString(amount);
_isSyncingText = true;
textController.value = TextEditingValue(
text: nextText,