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