added comment for payment, changed intent and added amount ui in operations
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user