Refactor
This commit is contained in:
parent
9e54f08bde
commit
39a73558c3
|
|
@ -126,7 +126,7 @@ Middleware<AppState> _createLoadState(
|
||||||
CompanyState company4State;
|
CompanyState company4State;
|
||||||
CompanyState company5State;
|
CompanyState company5State;
|
||||||
|
|
||||||
return (Store<AppState> store, action, NextDispatcher next) {
|
return (Store<AppState> store, dynamic action, NextDispatcher next) {
|
||||||
authRepository.exists().then((exists) {
|
authRepository.exists().then((exists) {
|
||||||
if (exists) {
|
if (exists) {
|
||||||
authRepository.loadAuthState().then((state) {
|
authRepository.loadAuthState().then((state) {
|
||||||
|
|
@ -233,7 +233,7 @@ Middleware<AppState> _createUserLoggedIn(
|
||||||
PersistenceRepository company4Repository,
|
PersistenceRepository company4Repository,
|
||||||
PersistenceRepository company5Repository,
|
PersistenceRepository company5Repository,
|
||||||
) {
|
) {
|
||||||
return (Store<AppState> store, action, NextDispatcher next) {
|
return (Store<AppState> store, dynamic action, NextDispatcher next) {
|
||||||
next(action);
|
next(action);
|
||||||
|
|
||||||
var state = store.state;
|
var state = store.state;
|
||||||
|
|
@ -250,7 +250,7 @@ Middleware<AppState> _createUserLoggedIn(
|
||||||
}
|
}
|
||||||
|
|
||||||
Middleware<AppState> _createUIChange(PersistenceRepository uiRepository) {
|
Middleware<AppState> _createUIChange(PersistenceRepository uiRepository) {
|
||||||
return (Store<AppState> store, action, NextDispatcher next) {
|
return (Store<AppState> store, dynamic action, NextDispatcher next) {
|
||||||
next(action);
|
next(action);
|
||||||
|
|
||||||
uiRepository.saveUIState(store.state.uiState);
|
uiRepository.saveUIState(store.state.uiState);
|
||||||
|
|
@ -264,7 +264,7 @@ Middleware<AppState> _createDataLoaded(
|
||||||
PersistenceRepository company4Repository,
|
PersistenceRepository company4Repository,
|
||||||
PersistenceRepository company5Repository,
|
PersistenceRepository company5Repository,
|
||||||
) {
|
) {
|
||||||
return (Store<AppState> store, action, NextDispatcher next) {
|
return (Store<AppState> store, dynamic action, NextDispatcher next) {
|
||||||
// first process the action so the data is in the state
|
// first process the action so the data is in the state
|
||||||
next(action);
|
next(action);
|
||||||
|
|
||||||
|
|
@ -300,7 +300,7 @@ Middleware<AppState> _createDeleteState(
|
||||||
PersistenceRepository company4Repository,
|
PersistenceRepository company4Repository,
|
||||||
PersistenceRepository company5Repository,
|
PersistenceRepository company5Repository,
|
||||||
) {
|
) {
|
||||||
return (Store<AppState> store, action, NextDispatcher next) {
|
return (Store<AppState> store, dynamic action, NextDispatcher next) {
|
||||||
authRepository.delete();
|
authRepository.delete();
|
||||||
uiRepository.delete();
|
uiRepository.delete();
|
||||||
staticRepository.delete();
|
staticRepository.delete();
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ import 'package:invoiceninja/redux/static/static_reducer.dart';
|
||||||
import 'package:invoiceninja/redux/company/company_reducer.dart';
|
import 'package:invoiceninja/redux/company/company_reducer.dart';
|
||||||
|
|
||||||
// We create the State reducer by combining many smaller reducers into one!
|
// We create the State reducer by combining many smaller reducers into one!
|
||||||
AppState appReducer(AppState state, action) {
|
AppState appReducer(AppState state, dynamic action) {
|
||||||
if (action is UserLogout) {
|
if (action is UserLogout) {
|
||||||
return AppState().rebuild((b) => b.authState.replace(state.authState));
|
return AppState().rebuild((b) => b.authState.replace(state.authState));
|
||||||
} else if (action is LoadStateSuccess) {
|
} else if (action is LoadStateSuccess) {
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ List<Middleware<AppState>> createStoreAuthMiddleware([
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
_saveAuthLocal(action) async {
|
_saveAuthLocal(dynamic action) async {
|
||||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||||
prefs.setString('email', action.email);
|
prefs.setString('email', action.email);
|
||||||
prefs.setString('url', action.url);
|
prefs.setString('url', action.url);
|
||||||
|
|
@ -34,7 +34,7 @@ _saveAuthLocal(action) async {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_loadAuthLocal(Store<AppState> store, action) async {
|
_loadAuthLocal(Store<AppState> store, dynamic action) async {
|
||||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||||
|
|
||||||
String email = prefs.getString('email') ?? Config.LOGIN_EMAIL;
|
String email = prefs.getString('email') ?? Config.LOGIN_EMAIL;
|
||||||
|
|
@ -47,7 +47,7 @@ _loadAuthLocal(Store<AppState> store, action) async {
|
||||||
}
|
}
|
||||||
|
|
||||||
Middleware<AppState> _createLoginInit() {
|
Middleware<AppState> _createLoginInit() {
|
||||||
return (Store<AppState> store, action, NextDispatcher next) {
|
return (Store<AppState> store, dynamic action, NextDispatcher next) {
|
||||||
_loadAuthLocal(store, action);
|
_loadAuthLocal(store, action);
|
||||||
|
|
||||||
next(action);
|
next(action);
|
||||||
|
|
@ -55,7 +55,7 @@ Middleware<AppState> _createLoginInit() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Middleware<AppState> _createLoginRequest(AuthRepository repository) {
|
Middleware<AppState> _createLoginRequest(AuthRepository repository) {
|
||||||
return (Store<AppState> store, action, NextDispatcher next) {
|
return (Store<AppState> store, dynamic action, NextDispatcher next) {
|
||||||
repository
|
repository
|
||||||
.login(action.email, action.password, action.url, action.secret)
|
.login(action.email, action.password, action.url, action.secret)
|
||||||
.then((data) {
|
.then((data) {
|
||||||
|
|
@ -76,7 +76,7 @@ Middleware<AppState> _createLoginRequest(AuthRepository repository) {
|
||||||
} else {
|
} else {
|
||||||
store.dispatch(UserLoginFailure('The minimum version is v4.5'));
|
store.dispatch(UserLoginFailure('The minimum version is v4.5'));
|
||||||
}
|
}
|
||||||
}).catchError((error) {
|
}).catchError((Object error) {
|
||||||
print(error);
|
print(error);
|
||||||
store.dispatch(UserLoginFailure(error.toString()));
|
store.dispatch(UserLoginFailure(error.toString()));
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ Middleware<AppState> _archiveClient(ClientRepository repository) {
|
||||||
if (action.completer != null) {
|
if (action.completer != null) {
|
||||||
action.completer.complete(null);
|
action.completer.complete(null);
|
||||||
}
|
}
|
||||||
}).catchError((error) {
|
}).catchError((Object error) {
|
||||||
print(error);
|
print(error);
|
||||||
store.dispatch(ArchiveClientFailure(origClient));
|
store.dispatch(ArchiveClientFailure(origClient));
|
||||||
if (action.completer != null) {
|
if (action.completer != null) {
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ import 'package:invoiceninja/redux/invoice/invoice_reducer.dart';
|
||||||
import 'package:invoiceninja/redux/dashboard/dashboard_reducer.dart';
|
import 'package:invoiceninja/redux/dashboard/dashboard_reducer.dart';
|
||||||
import 'package:invoiceninja/redux/company/company_actions.dart';
|
import 'package:invoiceninja/redux/company/company_actions.dart';
|
||||||
|
|
||||||
CompanyState companyReducer(CompanyState state, action) {
|
CompanyState companyReducer(CompanyState state, dynamic action) {
|
||||||
|
|
||||||
return state.rebuild((b) => b
|
return state.rebuild((b) => b
|
||||||
..clientState.replace(clientsReducer(state.clientState, action))
|
..clientState.replace(clientsReducer(state.clientState, action))
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ List<Middleware<AppState>> createStoreDashboardMiddleware([
|
||||||
|
|
||||||
|
|
||||||
Middleware<AppState> _createViewDashboard() {
|
Middleware<AppState> _createViewDashboard() {
|
||||||
return (Store<AppState> store, action, NextDispatcher next) {
|
return (Store<AppState> store, dynamic action, NextDispatcher next) {
|
||||||
store.dispatch(LoadDashboard());
|
store.dispatch(LoadDashboard());
|
||||||
store.dispatch(UpdateCurrentRoute(DashboardScreen.route));
|
store.dispatch(UpdateCurrentRoute(DashboardScreen.route));
|
||||||
|
|
||||||
|
|
@ -35,7 +35,7 @@ Middleware<AppState> _createViewDashboard() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Middleware<AppState> _createLoadDashboard(DashboardRepository repository) {
|
Middleware<AppState> _createLoadDashboard(DashboardRepository repository) {
|
||||||
return (Store<AppState> store, action, NextDispatcher next) {
|
return (Store<AppState> store, dynamic action, NextDispatcher next) {
|
||||||
AppState state = store.state;
|
AppState state = store.state;
|
||||||
|
|
||||||
if (!state.dashboardState.isStale && !action.force) {
|
if (!state.dashboardState.isStale && !action.force) {
|
||||||
|
|
@ -57,7 +57,7 @@ Middleware<AppState> _createLoadDashboard(DashboardRepository repository) {
|
||||||
if (state.clientState.isStale) {
|
if (state.clientState.isStale) {
|
||||||
store.dispatch(LoadClients());
|
store.dispatch(LoadClients());
|
||||||
}
|
}
|
||||||
}).catchError((error) {
|
}).catchError((Object error) {
|
||||||
print(error);
|
print(error);
|
||||||
store.dispatch(LoadDashboardFailure(error));
|
store.dispatch(LoadDashboardFailure(error));
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ import 'package:redux/redux.dart';
|
||||||
import 'package:invoiceninja/redux/invoice/invoice_actions.dart';
|
import 'package:invoiceninja/redux/invoice/invoice_actions.dart';
|
||||||
import 'package:invoiceninja/redux/invoice/invoice_state.dart';
|
import 'package:invoiceninja/redux/invoice/invoice_state.dart';
|
||||||
|
|
||||||
EntityUIState invoiceUIReducer(InvoiceUIState state, action) {
|
EntityUIState invoiceUIReducer(InvoiceUIState state, dynamic action) {
|
||||||
return state.rebuild((b) => b
|
return state.rebuild((b) => b
|
||||||
..listUIState.replace(invoiceListReducer(state.listUIState, action))
|
..listUIState.replace(invoiceListReducer(state.listUIState, action))
|
||||||
..editing.replace(editingReducer(state.editing, action))
|
..editing.replace(editingReducer(state.editing, action))
|
||||||
|
|
@ -45,11 +45,11 @@ final editingReducer = combineReducers<InvoiceEntity>([
|
||||||
TypedReducer<InvoiceEntity, SelectCompany>(_clearEditing),
|
TypedReducer<InvoiceEntity, SelectCompany>(_clearEditing),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
InvoiceEntity _clearEditing(InvoiceEntity client, action) {
|
InvoiceEntity _clearEditing(InvoiceEntity client, dynamic action) {
|
||||||
return InvoiceEntity();
|
return InvoiceEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
InvoiceEntity _updateEditing(InvoiceEntity invoice, action) {
|
InvoiceEntity _updateEditing(InvoiceEntity invoice, dynamic action) {
|
||||||
return action.invoice;
|
return action.invoice;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ Middleware<AppState> _deleteProduct(ProductRepository repository) {
|
||||||
if (action.completer != null) {
|
if (action.completer != null) {
|
||||||
action.completer.complete(null);
|
action.completer.complete(null);
|
||||||
}
|
}
|
||||||
}).catchError((error) {
|
}).catchError((Object error) {
|
||||||
print(error);
|
print(error);
|
||||||
store.dispatch(DeleteProductFailure(origProduct));
|
store.dispatch(DeleteProductFailure(origProduct));
|
||||||
if (action.completer != null) {
|
if (action.completer != null) {
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import 'package:redux/redux.dart';
|
||||||
import 'package:invoiceninja/redux/product/product_actions.dart';
|
import 'package:invoiceninja/redux/product/product_actions.dart';
|
||||||
import 'package:invoiceninja/redux/product/product_state.dart';
|
import 'package:invoiceninja/redux/product/product_state.dart';
|
||||||
|
|
||||||
EntityUIState productUIReducer(ProductUIState state, action) {
|
EntityUIState productUIReducer(ProductUIState state, dynamic action) {
|
||||||
return state.rebuild((b) => b
|
return state.rebuild((b) => b
|
||||||
..listUIState.replace(productListReducer(state.listUIState, action))
|
..listUIState.replace(productListReducer(state.listUIState, action))
|
||||||
..editing.replace(editingReducer(state.editing, action))
|
..editing.replace(editingReducer(state.editing, action))
|
||||||
|
|
@ -33,11 +33,11 @@ final editingReducer = combineReducers<ProductEntity>([
|
||||||
TypedReducer<ProductEntity, SelectCompany>(_clearEditing),
|
TypedReducer<ProductEntity, SelectCompany>(_clearEditing),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
ProductEntity _clearEditing(ProductEntity client, action) {
|
ProductEntity _clearEditing(ProductEntity client, dynamic action) {
|
||||||
return ProductEntity();
|
return ProductEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
ProductEntity _updateEditing(ProductEntity client, action) {
|
ProductEntity _updateEditing(ProductEntity client, dynamic action) {
|
||||||
return action.product;
|
return action.product;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import 'package:invoiceninja/redux/product/product_reducer.dart';
|
||||||
import 'package:invoiceninja/redux/invoice/invoice_reducer.dart';
|
import 'package:invoiceninja/redux/invoice/invoice_reducer.dart';
|
||||||
import 'package:redux/redux.dart';
|
import 'package:redux/redux.dart';
|
||||||
|
|
||||||
UIState uiReducer(UIState state, action) {
|
UIState uiReducer(UIState state, dynamic action) {
|
||||||
|
|
||||||
return state.rebuild((b) => b
|
return state.rebuild((b) => b
|
||||||
..selectedCompanyIndex = selectedCompanyIndexReducer(state.selectedCompanyIndex, action)
|
..selectedCompanyIndex = selectedCompanyIndexReducer(state.selectedCompanyIndex, action)
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ class ClientEditBillingAddressState extends State<ClientEditBillingAddress> {
|
||||||
_postalCodeController,
|
_postalCodeController,
|
||||||
];
|
];
|
||||||
|
|
||||||
_controllers.forEach((controller) => controller.removeListener(_onChanged));
|
_controllers.forEach((dynamic controller) => controller.removeListener(_onChanged));
|
||||||
|
|
||||||
var client = widget.viewModel.client;
|
var client = widget.viewModel.client;
|
||||||
_address1Controller.text = client.address1;
|
_address1Controller.text = client.address1;
|
||||||
|
|
@ -47,14 +47,14 @@ class ClientEditBillingAddressState extends State<ClientEditBillingAddress> {
|
||||||
_stateController.text = client.state;
|
_stateController.text = client.state;
|
||||||
_postalCodeController.text = client.postalCode;
|
_postalCodeController.text = client.postalCode;
|
||||||
|
|
||||||
_controllers.forEach((controller) => controller.addListener(_onChanged));
|
_controllers.forEach((dynamic controller) => controller.addListener(_onChanged));
|
||||||
|
|
||||||
super.didChangeDependencies();
|
super.didChangeDependencies();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
_controllers.forEach((controller) {
|
_controllers.forEach((dynamic controller) {
|
||||||
controller.removeListener(_onChanged);
|
controller.removeListener(_onChanged);
|
||||||
controller.dispose();
|
controller.dispose();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ class ContactEditDetailsState extends State<ContactEditDetails> {
|
||||||
_phoneController,
|
_phoneController,
|
||||||
];
|
];
|
||||||
|
|
||||||
_controllers.forEach((controller) => controller.removeListener(_onChanged));
|
_controllers.forEach((dynamic controller) => controller.removeListener(_onChanged));
|
||||||
|
|
||||||
var contact = widget.contact;
|
var contact = widget.contact;
|
||||||
_firstNameController.text = contact.firstName;
|
_firstNameController.text = contact.firstName;
|
||||||
|
|
@ -84,14 +84,14 @@ class ContactEditDetailsState extends State<ContactEditDetails> {
|
||||||
_emailController.text = contact.email;
|
_emailController.text = contact.email;
|
||||||
_phoneController.text = contact.phone;
|
_phoneController.text = contact.phone;
|
||||||
|
|
||||||
_controllers.forEach((controller) => controller.addListener(_onChanged));
|
_controllers.forEach((dynamic controller) => controller.addListener(_onChanged));
|
||||||
|
|
||||||
super.didChangeDependencies();
|
super.didChangeDependencies();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
_controllers.forEach((controller) {
|
_controllers.forEach((dynamic controller) {
|
||||||
controller.removeListener(_onChanged);
|
controller.removeListener(_onChanged);
|
||||||
controller.dispose();
|
controller.dispose();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ class ClientEditDetailsState extends State<ClientEditDetails> {
|
||||||
_phoneController,
|
_phoneController,
|
||||||
];
|
];
|
||||||
|
|
||||||
_controllers.forEach((controller) => controller.removeListener(_onChanged));
|
_controllers.forEach((dynamic controller) => controller.removeListener(_onChanged));
|
||||||
|
|
||||||
var client = widget.viewModel.client;
|
var client = widget.viewModel.client;
|
||||||
_nameController.text = client.name;
|
_nameController.text = client.name;
|
||||||
|
|
@ -45,14 +45,14 @@ class ClientEditDetailsState extends State<ClientEditDetails> {
|
||||||
_websiteController.text = client.website;
|
_websiteController.text = client.website;
|
||||||
_phoneController.text = client.workPhone;
|
_phoneController.text = client.workPhone;
|
||||||
|
|
||||||
_controllers.forEach((controller) => controller.addListener(_onChanged));
|
_controllers.forEach((dynamic controller) => controller.addListener(_onChanged));
|
||||||
|
|
||||||
super.didChangeDependencies();
|
super.didChangeDependencies();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
_controllers.forEach((controller) {
|
_controllers.forEach((dynamic controller) {
|
||||||
controller.removeListener(_onChanged);
|
controller.removeListener(_onChanged);
|
||||||
controller.dispose();
|
controller.dispose();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ class ClientEditShippingAddressState extends State<ClientEditShippingAddress> {
|
||||||
_shippingPostalCodeController,
|
_shippingPostalCodeController,
|
||||||
];
|
];
|
||||||
|
|
||||||
_controllers.forEach((controller) => controller.removeListener(_onChanged));
|
_controllers.forEach((dynamic controller) => controller.removeListener(_onChanged));
|
||||||
|
|
||||||
var client = widget.viewModel.client;
|
var client = widget.viewModel.client;
|
||||||
_shippingAddress1Controller.text = client.shippingAddress1;
|
_shippingAddress1Controller.text = client.shippingAddress1;
|
||||||
|
|
@ -47,14 +47,14 @@ class ClientEditShippingAddressState extends State<ClientEditShippingAddress> {
|
||||||
_shippingStateController.text = client.shippingState;
|
_shippingStateController.text = client.shippingState;
|
||||||
_shippingPostalCodeController.text = client.shippingPostalCode;
|
_shippingPostalCodeController.text = client.shippingPostalCode;
|
||||||
|
|
||||||
_controllers.forEach((controller) => controller.addListener(_onChanged));
|
_controllers.forEach((dynamic controller) => controller.addListener(_onChanged));
|
||||||
|
|
||||||
super.didChangeDependencies();
|
super.didChangeDependencies();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
_controllers.forEach((controller) {
|
_controllers.forEach((dynamic controller) {
|
||||||
controller.removeListener(_onChanged);
|
controller.removeListener(_onChanged);
|
||||||
controller.dispose();
|
controller.dispose();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ class InvoiceEditDetailsState extends State<InvoiceEditDetails> with AutomaticKe
|
||||||
_partialController,
|
_partialController,
|
||||||
];
|
];
|
||||||
|
|
||||||
_controllers.forEach((controller) => controller.removeListener(_onChanged));
|
_controllers.forEach((dynamic controller) => controller.removeListener(_onChanged));
|
||||||
|
|
||||||
final invoice = widget.viewModel.invoice;
|
final invoice = widget.viewModel.invoice;
|
||||||
_invoiceNumberController.text = invoice.invoiceNumber;
|
_invoiceNumberController.text = invoice.invoiceNumber;
|
||||||
|
|
@ -55,14 +55,14 @@ class InvoiceEditDetailsState extends State<InvoiceEditDetails> with AutomaticKe
|
||||||
invoice.partial, widget.viewModel.state,
|
invoice.partial, widget.viewModel.state,
|
||||||
formatNumberType: FormatNumberType.input);
|
formatNumberType: FormatNumberType.input);
|
||||||
|
|
||||||
_controllers.forEach((controller) => controller.addListener(_onChanged));
|
_controllers.forEach((dynamic controller) => controller.addListener(_onChanged));
|
||||||
|
|
||||||
super.didChangeDependencies();
|
super.didChangeDependencies();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
_controllers.forEach((controller) {
|
_controllers.forEach((dynamic controller) {
|
||||||
controller.removeListener(_onChanged);
|
controller.removeListener(_onChanged);
|
||||||
controller.dispose();
|
controller.dispose();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ class ItemEditDetailsState extends State<ItemEditDetails> with AutomaticKeepAliv
|
||||||
_qtyController,
|
_qtyController,
|
||||||
];
|
];
|
||||||
|
|
||||||
_controllers.forEach((controller) => controller.removeListener(_onChanged));
|
_controllers.forEach((dynamic controller) => controller.removeListener(_onChanged));
|
||||||
|
|
||||||
var invoiceItem = widget.invoiceItem;
|
var invoiceItem = widget.invoiceItem;
|
||||||
_productKeyController.text = invoiceItem.productKey;
|
_productKeyController.text = invoiceItem.productKey;
|
||||||
|
|
@ -89,14 +89,14 @@ class ItemEditDetailsState extends State<ItemEditDetails> with AutomaticKeepAliv
|
||||||
_qtyController.text = formatNumber(invoiceItem.qty, widget.viewModel.state,
|
_qtyController.text = formatNumber(invoiceItem.qty, widget.viewModel.state,
|
||||||
formatNumberType: FormatNumberType.input);
|
formatNumberType: FormatNumberType.input);
|
||||||
|
|
||||||
_controllers.forEach((controller) => controller.addListener(_onChanged));
|
_controllers.forEach((dynamic controller) => controller.addListener(_onChanged));
|
||||||
|
|
||||||
super.didChangeDependencies();
|
super.didChangeDependencies();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
_controllers.forEach((controller) {
|
_controllers.forEach((dynamic controller) {
|
||||||
controller.removeListener(_onChanged);
|
controller.removeListener(_onChanged);
|
||||||
controller.dispose();
|
controller.dispose();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -38,21 +38,21 @@ class _ProductEditState extends State<ProductEdit> {
|
||||||
_costController,
|
_costController,
|
||||||
];
|
];
|
||||||
|
|
||||||
_controllers.forEach((controller) => controller.removeListener(_onChanged));
|
_controllers.forEach((dynamic controller) => controller.removeListener(_onChanged));
|
||||||
|
|
||||||
var product = widget.viewModel.product;
|
var product = widget.viewModel.product;
|
||||||
_productKeyController.text = product.productKey;
|
_productKeyController.text = product.productKey;
|
||||||
_notesController.text = product.notes;
|
_notesController.text = product.notes;
|
||||||
_costController.text = formatNumber(product.cost, widget.viewModel.state, formatNumberType: FormatNumberType.input);
|
_costController.text = formatNumber(product.cost, widget.viewModel.state, formatNumberType: FormatNumberType.input);
|
||||||
|
|
||||||
_controllers.forEach((controller) => controller.addListener(_onChanged));
|
_controllers.forEach((dynamic controller) => controller.addListener(_onChanged));
|
||||||
|
|
||||||
super.didChangeDependencies();
|
super.didChangeDependencies();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
_controllers.forEach((controller) {
|
_controllers.forEach((dynamic controller) {
|
||||||
controller.removeListener(_onChanged);
|
controller.removeListener(_onChanged);
|
||||||
controller.dispose();
|
controller.dispose();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ class DeleteContact {
|
||||||
DeleteContact(this.index);
|
DeleteContact(this.index);
|
||||||
}
|
}
|
||||||
|
|
||||||
AppState reducer(AppState state, action) {
|
AppState reducer(AppState state, dynamic action) {
|
||||||
// In an actual app you'd most like want to
|
// In an actual app you'd most like want to
|
||||||
// use built_value to rebuild the state
|
// use built_value to rebuild the state
|
||||||
if (action is UpdateClient) {
|
if (action is UpdateClient) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue