Web
This commit is contained in:
parent
ebfa67a817
commit
eed7c920b0
|
|
@ -13,12 +13,10 @@ import 'package:invoiceninja_flutter/utils/localization.dart';
|
|||
class InvoiceEdit extends StatefulWidget {
|
||||
const InvoiceEdit({
|
||||
Key key,
|
||||
@required this.formKey,
|
||||
@required this.viewModel,
|
||||
}) : super(key: key);
|
||||
|
||||
final EntityEditVM viewModel;
|
||||
final GlobalKey<FormState> formKey;
|
||||
|
||||
@override
|
||||
_InvoiceEditState createState() => _InvoiceEditState();
|
||||
|
|
@ -28,6 +26,9 @@ class _InvoiceEditState extends State<InvoiceEdit>
|
|||
with SingleTickerProviderStateMixin {
|
||||
TabController _controller;
|
||||
|
||||
static final GlobalKey<FormState> _formKey =
|
||||
GlobalKey<FormState>(debugLabel: '_invoiceEdit');
|
||||
|
||||
static const kDetailsScreen = 0;
|
||||
static const kContactScreen = 1;
|
||||
static const kItemScreen = 2;
|
||||
|
|
@ -71,7 +72,7 @@ class _InvoiceEditState extends State<InvoiceEdit>
|
|||
title: invoice.isNew ? localization.newInvoice : localization.editInvoice,
|
||||
onCancelPressed: (context) => viewModel.onCancelPressed(context),
|
||||
onSavePressed: (context) {
|
||||
if (!widget.formKey.currentState.validate()) {
|
||||
if (!_formKey.currentState.validate()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -98,7 +99,7 @@ class _InvoiceEditState extends State<InvoiceEdit>
|
|||
],
|
||||
),
|
||||
body: Form(
|
||||
key: widget.formKey,
|
||||
key: _formKey,
|
||||
child: state.prefState.isDesktop
|
||||
? InvoiceEditDetailsScreen()
|
||||
: TabBarView(
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ class InvoiceEditDesktopState extends State<InvoiceEditDesktop>
|
|||
|
||||
FocusNode _focusNode;
|
||||
static final GlobalKey<FormState> _formKey =
|
||||
GlobalKey<FormState>(debugLabel: '_invoicesEdit');
|
||||
GlobalKey<FormState>(debugLabel: '_invoiceDesktopEdit');
|
||||
|
||||
final _invoiceNumberController = TextEditingController();
|
||||
final _poNumberController = TextEditingController();
|
||||
|
|
|
|||
|
|
@ -18,9 +18,6 @@ class InvoiceEditScreen extends StatelessWidget {
|
|||
|
||||
static const String route = '/invoice/edit';
|
||||
|
||||
static final GlobalKey<FormState> _formKey =
|
||||
GlobalKey<FormState>(debugLabel: '_invoiceEdit');
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return StoreConnector<AppState, InvoiceEditVM>(
|
||||
|
|
@ -30,7 +27,6 @@ class InvoiceEditScreen extends StatelessWidget {
|
|||
builder: (context, viewModel) {
|
||||
return InvoiceEdit(
|
||||
viewModel: viewModel,
|
||||
formKey: _formKey,
|
||||
);
|
||||
},
|
||||
);
|
||||
|
|
|
|||
|
|
@ -19,9 +19,6 @@ class QuoteEditScreen extends StatelessWidget {
|
|||
|
||||
static const String route = '/quote/edit';
|
||||
|
||||
static final GlobalKey<FormState> _formKey =
|
||||
GlobalKey<FormState>(debugLabel: '_quoteEdit');
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return StoreConnector<AppState, QuoteEditVM>(
|
||||
|
|
@ -31,7 +28,6 @@ class QuoteEditScreen extends StatelessWidget {
|
|||
builder: (context, viewModel) {
|
||||
return QuoteEdit(
|
||||
viewModel: viewModel,
|
||||
formKey: _formKey,
|
||||
);
|
||||
},
|
||||
);
|
||||
|
|
|
|||
|
|
@ -12,12 +12,10 @@ import 'package:invoiceninja_flutter/utils/localization.dart';
|
|||
class QuoteEdit extends StatefulWidget {
|
||||
const QuoteEdit({
|
||||
Key key,
|
||||
@required this.formKey,
|
||||
@required this.viewModel,
|
||||
}) : super(key: key);
|
||||
|
||||
final EntityEditVM viewModel;
|
||||
final GlobalKey<FormState> formKey;
|
||||
|
||||
@override
|
||||
_QuoteEditState createState() => _QuoteEditState();
|
||||
|
|
@ -27,6 +25,10 @@ class _QuoteEditState extends State<QuoteEdit>
|
|||
with SingleTickerProviderStateMixin {
|
||||
TabController _controller;
|
||||
|
||||
static final GlobalKey<FormState> _formKey =
|
||||
GlobalKey<FormState>(debugLabel: '_quoteEdit');
|
||||
|
||||
|
||||
static const kDetailsScreen = 0;
|
||||
static const kItemScreen = 1;
|
||||
static const kNotesScreen = 2;
|
||||
|
|
@ -69,7 +71,7 @@ class _QuoteEditState extends State<QuoteEdit>
|
|||
title: invoice.isNew ? localization.newQuote : localization.editQuote,
|
||||
onCancelPressed: (context) => viewModel.onCancelPressed(context),
|
||||
onSavePressed: (context) {
|
||||
if (!widget.formKey.currentState.validate()) {
|
||||
if (!_formKey.currentState.validate()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -93,7 +95,7 @@ class _QuoteEditState extends State<QuoteEdit>
|
|||
],
|
||||
),
|
||||
body: Form(
|
||||
key: widget.formKey,
|
||||
key: _formKey,
|
||||
child: state.prefState.isDesktop
|
||||
? QuoteEditDetailsScreen()
|
||||
: TabBarView(
|
||||
|
|
|
|||
Loading…
Reference in New Issue