Improve payment term edit screen
This commit is contained in:
parent
37c2623c4c
commit
87cbb792b9
|
|
@ -70,6 +70,16 @@ class _PaymentTermEditState extends State<PaymentTermEdit> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _onSavePressed() {
|
||||||
|
final bool isValid = _formKey.currentState.validate();
|
||||||
|
|
||||||
|
if (!isValid) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
widget.viewModel.onSavePressed(context);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final viewModel = widget.viewModel;
|
final viewModel = widget.viewModel;
|
||||||
|
|
@ -81,15 +91,7 @@ class _PaymentTermEditState extends State<PaymentTermEdit> {
|
||||||
? localization.newPaymentTerm
|
? localization.newPaymentTerm
|
||||||
: localization.editPaymentTerm,
|
: localization.editPaymentTerm,
|
||||||
onCancelPressed: (context) => viewModel.onCancelPressed(context),
|
onCancelPressed: (context) => viewModel.onCancelPressed(context),
|
||||||
onSavePressed: (context) {
|
onSavePressed: (context) => _onSavePressed(),
|
||||||
final bool isValid = _formKey.currentState.validate();
|
|
||||||
|
|
||||||
if (!isValid) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
viewModel.onSavePressed(context);
|
|
||||||
},
|
|
||||||
body: Form(
|
body: Form(
|
||||||
key: _formKey,
|
key: _formKey,
|
||||||
child: Builder(builder: (BuildContext context) {
|
child: Builder(builder: (BuildContext context) {
|
||||||
|
|
@ -105,6 +107,7 @@ class _PaymentTermEditState extends State<PaymentTermEdit> {
|
||||||
validator: (value) => value == null || value.isEmpty
|
validator: (value) => value == null || value.isEmpty
|
||||||
? localization.pleaseEnterAValue
|
? localization.pleaseEnterAValue
|
||||||
: null,
|
: null,
|
||||||
|
onSavePressed: (context) => _onSavePressed(),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue