Adjust validation behavior
This commit is contained in:
parent
4934f6c8cd
commit
5901473a4f
|
|
@ -51,9 +51,18 @@ class _ClientEditState extends State<ClientEdit>
|
|||
title: client.isNew ? localization.newClient : localization.editClient,
|
||||
onCancelPressed: (context) => viewModel.onCancelPressed(context),
|
||||
onSavePressed: (context) {
|
||||
if (!_formKey.currentState.validate()) {
|
||||
final bool isValid = _formKey.currentState.validate();
|
||||
|
||||
/*
|
||||
setState(() {
|
||||
autoValidate = !isValid ?? false;
|
||||
});
|
||||
*/
|
||||
|
||||
if (!isValid) {
|
||||
return;
|
||||
}
|
||||
|
||||
viewModel.onSavePressed(context);
|
||||
},
|
||||
appBarBottom: TabBar(
|
||||
|
|
|
|||
|
|
@ -73,11 +73,19 @@ class _CreditEditState extends State<CreditEdit>
|
|||
title: invoice.isNew ? localization.newCredit : localization.editCredit,
|
||||
onCancelPressed: (context) => viewModel.onCancelPressed(context),
|
||||
onSavePressed: (context) {
|
||||
if (!_formKey.currentState.validate()) {
|
||||
final bool isValid = _formKey.currentState.validate();
|
||||
|
||||
/*
|
||||
setState(() {
|
||||
autoValidate = !isValid ?? false;
|
||||
});
|
||||
*/
|
||||
|
||||
if (!isValid) {
|
||||
return;
|
||||
}
|
||||
|
||||
widget.viewModel.onSavePressed(context);
|
||||
viewModel.onSavePressed(context);
|
||||
},
|
||||
appBarBottom: state.prefState.isDesktop
|
||||
? null
|
||||
|
|
|
|||
|
|
@ -75,9 +75,18 @@ class _DocumentEditState extends State<DocumentEdit> {
|
|||
title:
|
||||
document.isNew ? localization.newDocument : localization.editDocument,
|
||||
onSavePressed: (context) {
|
||||
if (!_formKey.currentState.validate()) {
|
||||
final bool isValid = _formKey.currentState.validate();
|
||||
|
||||
/*
|
||||
setState(() {
|
||||
autoValidate = !isValid ?? false;
|
||||
});
|
||||
*/
|
||||
|
||||
if (!isValid) {
|
||||
return;
|
||||
}
|
||||
|
||||
viewModel.onSavePressed(context);
|
||||
},
|
||||
body: Form(
|
||||
|
|
|
|||
|
|
@ -48,9 +48,18 @@ class _ExpenseEditState extends State<ExpenseEdit>
|
|||
title: expense.isNew ? localization.newExpense : localization.editExpense,
|
||||
onCancelPressed: (context) => viewModel.onCancelPressed(context),
|
||||
onSavePressed: (context) {
|
||||
if (!_formKey.currentState.validate()) {
|
||||
final bool isValid = _formKey.currentState.validate();
|
||||
|
||||
/*
|
||||
setState(() {
|
||||
autoValidate = !isValid ?? false;
|
||||
})
|
||||
*/
|
||||
|
||||
if (!isValid) {
|
||||
return;
|
||||
}
|
||||
|
||||
viewModel.onSavePressed(context);
|
||||
},
|
||||
appBarBottom: TabBar(
|
||||
|
|
|
|||
|
|
@ -79,9 +79,16 @@ class _GroupEditState extends State<GroupEdit> {
|
|||
onCancelPressed: (context) => viewModel.onCancelPressed(context),
|
||||
title: group.isNew ? localization.newGroup : localization.editGroup,
|
||||
onSavePressed: (context) {
|
||||
if (!_formKey.currentState.validate()) {
|
||||
final bool isValid = _formKey.currentState.validate();
|
||||
|
||||
setState(() {
|
||||
autoValidate = !isValid ?? false;
|
||||
});
|
||||
|
||||
if (!isValid) {
|
||||
return;
|
||||
}
|
||||
|
||||
viewModel.onSavePressed(context);
|
||||
},
|
||||
body: Form(
|
||||
|
|
|
|||
|
|
@ -78,11 +78,19 @@ class _InvoiceEditState extends State<InvoiceEdit>
|
|||
title: invoice.isNew ? localization.newInvoice : localization.editInvoice,
|
||||
onCancelPressed: (context) => viewModel.onCancelPressed(context),
|
||||
onSavePressed: (context) {
|
||||
if (!_formKey.currentState.validate()) {
|
||||
final bool isValid = _formKey.currentState.validate();
|
||||
|
||||
/*
|
||||
setState(() {
|
||||
autoValidate = !isValid ?? false;
|
||||
});
|
||||
*/
|
||||
|
||||
if (!isValid) {
|
||||
return;
|
||||
}
|
||||
|
||||
widget.viewModel.onSavePressed(context);
|
||||
viewModel.onSavePressed(context);
|
||||
},
|
||||
appBarBottom: state.prefState.isDesktop
|
||||
? null
|
||||
|
|
|
|||
|
|
@ -73,11 +73,19 @@ class _QuoteEditState extends State<QuoteEdit>
|
|||
title: invoice.isNew ? localization.newQuote : localization.editQuote,
|
||||
onCancelPressed: (context) => viewModel.onCancelPressed(context),
|
||||
onSavePressed: (context) {
|
||||
if (!_formKey.currentState.validate()) {
|
||||
final bool isValid = _formKey.currentState.validate();
|
||||
|
||||
/*
|
||||
setState(() {
|
||||
autoValidate = !isValid ?? false;
|
||||
});
|
||||
*/
|
||||
|
||||
if (!isValid) {
|
||||
return;
|
||||
}
|
||||
|
||||
widget.viewModel.onSavePressed(context);
|
||||
viewModel.onSavePressed(context);
|
||||
},
|
||||
appBarBottom: state.prefState.isDesktop
|
||||
? null
|
||||
|
|
|
|||
|
|
@ -74,11 +74,19 @@ class _TaskEditState extends State<TaskEdit>
|
|||
title: task.isNew ? localization.newTask : localization.editTask,
|
||||
onCancelPressed: (context) => viewModel.onCancelPressed(context),
|
||||
onSavePressed: (context) {
|
||||
if (!_formKey.currentState.validate()) {
|
||||
final bool isValid = _formKey.currentState.validate();
|
||||
|
||||
/*
|
||||
setState(() {
|
||||
autoValidate = !isValid ?? false;
|
||||
});
|
||||
*/
|
||||
|
||||
if (!isValid) {
|
||||
return;
|
||||
}
|
||||
|
||||
widget.viewModel.onSavePressed(context);
|
||||
viewModel.onSavePressed(context);
|
||||
},
|
||||
appBarBottom: TabBar(
|
||||
controller: _controller,
|
||||
|
|
|
|||
|
|
@ -138,9 +138,16 @@ class _UserEditState extends State<UserEdit>
|
|||
),
|
||||
onCancelPressed: (context) => viewModel.onCancelPressed(context),
|
||||
onSavePressed: (context) {
|
||||
if (!_formKey.currentState.validate()) {
|
||||
final bool isValid = _formKey.currentState.validate();
|
||||
|
||||
setState(() {
|
||||
autoValidate = !isValid ?? false;
|
||||
});
|
||||
|
||||
if (!isValid) {
|
||||
return;
|
||||
}
|
||||
|
||||
viewModel.onSavePressed(context);
|
||||
},
|
||||
body: AppTabForm(
|
||||
|
|
|
|||
|
|
@ -49,9 +49,18 @@ class _VendorEditState extends State<VendorEdit>
|
|||
title: vendor.isNew ? localization.newVendor : localization.editVendor,
|
||||
onCancelPressed: (context) => viewModel.onCancelPressed(context),
|
||||
onSavePressed: (context) {
|
||||
if (!_formKey.currentState.validate()) {
|
||||
final bool isValid = _formKey.currentState.validate();
|
||||
|
||||
/*
|
||||
setState(() {
|
||||
autoValidate = !isValid ?? false;
|
||||
});
|
||||
*/
|
||||
|
||||
if (!isValid) {
|
||||
return;
|
||||
}
|
||||
|
||||
viewModel.onSavePressed(context);
|
||||
},
|
||||
appBarBottom: TabBar(
|
||||
|
|
|
|||
Loading…
Reference in New Issue