Refactor
This commit is contained in:
parent
da873ed28e
commit
a0b72a27bd
|
|
@ -6,10 +6,11 @@ part 'date_format_model.g.dart';
|
|||
|
||||
abstract class DateFormatListResponse implements Built<DateFormatListResponse, DateFormatListResponseBuilder> {
|
||||
|
||||
factory DateFormatListResponse([void updates(DateFormatListResponseBuilder b)]) = _$DateFormatListResponse;
|
||||
DateFormatListResponse._();
|
||||
|
||||
BuiltList<DateFormatEntity> get data;
|
||||
|
||||
DateFormatListResponse._();
|
||||
factory DateFormatListResponse([void updates(DateFormatListResponseBuilder b)]) = _$DateFormatListResponse;
|
||||
static Serializer<DateFormatListResponse> get serializer => _$dateFormatListResponseSerializer;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ class ClientRepository {
|
|||
|
||||
Future saveData(CompanyEntity company, AuthState auth, ClientEntity client, [EntityAction action]) async {
|
||||
|
||||
var data = serializers.serializeWith(ClientEntity.serializer, client);
|
||||
final data = serializers.serializeWith(ClientEntity.serializer, client);
|
||||
Future<dynamic> response;
|
||||
|
||||
if (client.isNew) {
|
||||
|
|
@ -42,7 +42,7 @@ class ClientRepository {
|
|||
response = await webClient.put(url, company.token, json.encode(data));
|
||||
}
|
||||
|
||||
ClientItemResponse clientResponse = serializers.deserializeWith(
|
||||
final ClientItemResponse clientResponse = serializers.deserializeWith(
|
||||
ClientItemResponse.serializer, response);
|
||||
|
||||
return clientResponse.data;
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ class CreditsRepository {
|
|||
final Future<dynamic> response = await webClient.get(
|
||||
auth.url + '/credits?per_page=500', company.token);
|
||||
|
||||
CreditListResponse creditResponse = serializers.deserializeWith(
|
||||
final CreditListResponse creditResponse = serializers.deserializeWith(
|
||||
CreditListResponse.serializer, response);
|
||||
|
||||
return creditResponse.data;
|
||||
|
|
@ -28,7 +28,7 @@ class CreditsRepository {
|
|||
|
||||
Future saveData(CompanyEntity company, AuthState auth, CreditEntity credit, [EntityAction action]) async {
|
||||
|
||||
var data = serializers.serializeWith(CreditEntity.serializer, credit);
|
||||
final data = serializers.serializeWith(CreditEntity.serializer, credit);
|
||||
Future<dynamic> response;
|
||||
|
||||
if (credit.isNew) {
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ class ExpenseRepository {
|
|||
final Future<dynamic> response = await webClient.get(
|
||||
auth.url + '/expenses?per_page=500', company.token);
|
||||
|
||||
ExpenseListResponse expenseResponse = serializers.deserializeWith(
|
||||
final ExpenseListResponse expenseResponse = serializers.deserializeWith(
|
||||
ExpenseListResponse.serializer, response);
|
||||
|
||||
return expenseResponse.data;
|
||||
|
|
@ -42,7 +42,7 @@ class ExpenseRepository {
|
|||
response = await webClient.put(url, company.token, json.encode(data));
|
||||
}
|
||||
|
||||
ExpenseItemResponse expenseResponse = serializers.deserializeWith(
|
||||
final ExpenseItemResponse expenseResponse = serializers.deserializeWith(
|
||||
ExpenseItemResponse.serializer, response);
|
||||
|
||||
return expenseResponse.data;
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ class InvoiceRepository {
|
|||
final Future<dynamic> response = await webClient.get(
|
||||
auth.url + '/invoices?include=invitations', company.token);
|
||||
|
||||
InvoiceListResponse invoiceResponse = serializers.deserializeWith(
|
||||
final InvoiceListResponse invoiceResponse = serializers.deserializeWith(
|
||||
InvoiceListResponse.serializer, response);
|
||||
|
||||
return invoiceResponse.data;
|
||||
|
|
@ -28,7 +28,7 @@ class InvoiceRepository {
|
|||
|
||||
Future saveData(CompanyEntity company, AuthState auth, InvoiceEntity invoice, [EntityAction action]) async {
|
||||
|
||||
var data = serializers.serializeWith(InvoiceEntity.serializer, invoice);
|
||||
final data = serializers.serializeWith(InvoiceEntity.serializer, invoice);
|
||||
Future<dynamic> response;
|
||||
|
||||
if (invoice.isNew) {
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ class PaymentsRepository {
|
|||
final Future<dynamic> response = await webClient.get(
|
||||
auth.url + '/payments?per_page=500', company.token);
|
||||
|
||||
PaymentListResponse paymentResponse = serializers.deserializeWith(
|
||||
final PaymentListResponse paymentResponse = serializers.deserializeWith(
|
||||
PaymentListResponse.serializer, response);
|
||||
|
||||
return paymentResponse.data;
|
||||
|
|
@ -42,7 +42,7 @@ class PaymentsRepository {
|
|||
response = await webClient.put(url, company.token, json.encode(data));
|
||||
}
|
||||
|
||||
PaymentItemResponse paymentResponse = serializers.deserializeWith(
|
||||
final PaymentItemResponse paymentResponse = serializers.deserializeWith(
|
||||
PaymentItemResponse.serializer, response);
|
||||
|
||||
return paymentResponse.data;
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ class PersistenceRepository {
|
|||
|
||||
|
||||
Future<File> saveAuthState(AuthState state) async {
|
||||
var data = serializers.serializeWith(AuthState.serializer, state);
|
||||
final data = serializers.serializeWith(AuthState.serializer, state);
|
||||
return await fileStorage.save(json.encode(data));
|
||||
}
|
||||
|
||||
|
|
@ -54,7 +54,7 @@ class PersistenceRepository {
|
|||
|
||||
|
||||
Future<File> saveUIState(UIState state) async {
|
||||
var data = serializers.serializeWith(UIState.serializer, state);
|
||||
final data = serializers.serializeWith(UIState.serializer, state);
|
||||
return await fileStorage.save(json.encode(data));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ class ProductRepository {
|
|||
|
||||
Future saveData(CompanyEntity company, AuthState auth, ProductEntity product, [EntityAction action]) async {
|
||||
|
||||
var data = serializers.serializeWith(ProductEntity.serializer, product);
|
||||
final data = serializers.serializeWith(ProductEntity.serializer, product);
|
||||
Future<dynamic> response;
|
||||
|
||||
if (product.isNew) {
|
||||
|
|
@ -42,7 +42,7 @@ class ProductRepository {
|
|||
response = await webClient.put(url, company.token, json.encode(data));
|
||||
}
|
||||
|
||||
ProductItemResponse productResponse = serializers.deserializeWith(
|
||||
final ProductItemResponse productResponse = serializers.deserializeWith(
|
||||
ProductItemResponse.serializer, response);
|
||||
|
||||
return productResponse.data;
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ class ProjectsRepository {
|
|||
final Future<dynamic> response = await webClient.get(
|
||||
auth.url + '/projects?per_page=500', company.token);
|
||||
|
||||
ProjectListResponse projectResponse = serializers.deserializeWith(
|
||||
final ProjectListResponse projectResponse = serializers.deserializeWith(
|
||||
ProjectListResponse.serializer, response);
|
||||
|
||||
return projectResponse.data;
|
||||
|
|
@ -42,7 +42,7 @@ class ProjectsRepository {
|
|||
response = await webClient.put(url, company.token, json.encode(data));
|
||||
}
|
||||
|
||||
ProjectItemResponse projectResponse = serializers.deserializeWith(
|
||||
final ProjectItemResponse projectResponse = serializers.deserializeWith(
|
||||
ProjectItemResponse.serializer, response);
|
||||
|
||||
return projectResponse.data;
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ class TasksRepository {
|
|||
final Future<dynamic> response = await webClient.get(
|
||||
auth.url + '/tasks?per_page=500', company.token);
|
||||
|
||||
TaskListResponse taskResponse = serializers.deserializeWith(
|
||||
final TaskListResponse taskResponse = serializers.deserializeWith(
|
||||
TaskListResponse.serializer, response);
|
||||
|
||||
return taskResponse.data;
|
||||
|
|
@ -28,7 +28,7 @@ class TasksRepository {
|
|||
|
||||
Future saveData(CompanyEntity company, AuthState auth, TaskEntity task, [EntityAction action]) async {
|
||||
|
||||
var data = serializers.serializeWith(TaskEntity.serializer, task);
|
||||
final data = serializers.serializeWith(TaskEntity.serializer, task);
|
||||
Future<dynamic> response;
|
||||
|
||||
if (task.isNew) {
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ class VendorRepository {
|
|||
final Future<dynamic> response = await webClient.get(
|
||||
auth.url + '/vendors?per_page=500', company.token);
|
||||
|
||||
VendorListResponse vendorResponse = serializers.deserializeWith(
|
||||
final VendorListResponse vendorResponse = serializers.deserializeWith(
|
||||
VendorListResponse.serializer, response);
|
||||
|
||||
return vendorResponse.data;
|
||||
|
|
@ -28,7 +28,7 @@ class VendorRepository {
|
|||
|
||||
Future saveData(CompanyEntity company, AuthState auth, VendorEntity vendor, [EntityAction action]) async {
|
||||
|
||||
var data = serializers.serializeWith(VendorEntity.serializer, vendor);
|
||||
final data = serializers.serializeWith(VendorEntity.serializer, vendor);
|
||||
Future<dynamic> response;
|
||||
|
||||
if (vendor.isNew) {
|
||||
|
|
|
|||
|
|
@ -236,7 +236,7 @@ Middleware<AppState> _createUserLoggedIn(
|
|||
return (Store<AppState> store, dynamic action, NextDispatcher next) {
|
||||
next(action);
|
||||
|
||||
var state = store.state;
|
||||
final state = store.state;
|
||||
|
||||
authRepository.saveAuthState(state.authState);
|
||||
uiRepository.saveUIState(state.uiState);
|
||||
|
|
@ -268,7 +268,7 @@ Middleware<AppState> _createDataLoaded(
|
|||
// first process the action so the data is in the state
|
||||
next(action);
|
||||
|
||||
AppState state = store.state;
|
||||
final AppState state = store.state;
|
||||
|
||||
switch (state.uiState.selectedCompanyIndex) {
|
||||
case 1:
|
||||
|
|
|
|||
|
|
@ -88,8 +88,8 @@ Middleware<AppState> _createLoginRequest(AuthRepository repository) {
|
|||
bool _isVersionSupported(String version) {
|
||||
var parts = version.split('.');
|
||||
|
||||
int major = int.parse(parts[0]);
|
||||
int minor = int.parse(parts[1]);
|
||||
final int major = int.parse(parts[0]);
|
||||
final int minor = int.parse(parts[1]);
|
||||
|
||||
return true;
|
||||
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ Middleware<AppState> _archiveClient(ClientRepository repository) {
|
|||
|
||||
Middleware<AppState> _deleteClient(ClientRepository repository) {
|
||||
return (Store<AppState> store, dynamic action, NextDispatcher next) {
|
||||
var origClient = store.state.clientState.map[action.clientId];
|
||||
final origClient = store.state.clientState.map[action.clientId];
|
||||
repository
|
||||
.saveData(store.state.selectedCompany, store.state.authState,
|
||||
origClient, EntityAction.delete)
|
||||
|
|
@ -155,7 +155,7 @@ Middleware<AppState> _saveClient(ClientRepository repository) {
|
|||
Middleware<AppState> _loadClients(ClientRepository repository) {
|
||||
return (Store<AppState> store, dynamic action, NextDispatcher next) {
|
||||
|
||||
AppState state = store.state;
|
||||
final AppState state = store.state;
|
||||
|
||||
if (!state.clientState.isStale && !action.force) {
|
||||
next(action);
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ final clientsReducer = combineReducers<ClientState>([
|
|||
]);
|
||||
|
||||
ClientState _archiveClientRequest(ClientState clientState, ArchiveClientRequest action) {
|
||||
var client = clientState.map[action.clientId].rebuild((b) => b
|
||||
final client = clientState.map[action.clientId].rebuild((b) => b
|
||||
..archivedAt = DateTime.now().millisecondsSinceEpoch
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ List<int> dropdownClientsSelector(
|
|||
BuiltList<int> clientList,
|
||||
String filter) {
|
||||
|
||||
var list = clientList.where((clientId) {
|
||||
var client = clientMap[clientId];
|
||||
final list = clientList.where((clientId) {
|
||||
final client = clientMap[clientId];
|
||||
if (! client.isActive) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -52,8 +52,8 @@ List<int> visibleClientsSelector(
|
|||
}).toList();
|
||||
|
||||
list.sort((clientAId, clientBId) {
|
||||
var clientA = clientMap[clientAId];
|
||||
var clientB = clientMap[clientBId];
|
||||
final clientA = clientMap[clientAId];
|
||||
final clientB = clientMap[clientBId];
|
||||
return clientA.compareTo(clientB, clientListState.sortField, clientListState.sortAscending);
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ Middleware<AppState> _editInvoice() {
|
|||
|
||||
Middleware<AppState> _archiveInvoice(InvoiceRepository repository) {
|
||||
return (Store<AppState> store, dynamic action, NextDispatcher next) {
|
||||
var origInvoice = store.state.invoiceState.map[action.invoiceId];
|
||||
final origInvoice = store.state.invoiceState.map[action.invoiceId];
|
||||
repository
|
||||
.saveData(store.state.selectedCompany, store.state.authState,
|
||||
origInvoice, EntityAction.archive)
|
||||
|
|
@ -180,7 +180,7 @@ Middleware<AppState> _saveInvoice(InvoiceRepository repository) {
|
|||
Middleware<AppState> _loadInvoices(InvoiceRepository repository) {
|
||||
return (Store<AppState> store, dynamic action, NextDispatcher next) {
|
||||
|
||||
AppState state = store.state;
|
||||
final AppState state = store.state;
|
||||
|
||||
if (!state.invoiceState.isStale && !action.force) {
|
||||
next(action);
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ final invoicesReducer = combineReducers<InvoiceState>([
|
|||
]);
|
||||
|
||||
InvoiceState _archiveInvoiceRequest(InvoiceState invoiceState, ArchiveInvoiceRequest action) {
|
||||
var invoice = invoiceState.map[action.invoiceId].rebuild((b) => b
|
||||
final invoice = invoiceState.map[action.invoiceId].rebuild((b) => b
|
||||
..archivedAt = DateTime.now().millisecondsSinceEpoch
|
||||
);
|
||||
|
||||
|
|
@ -151,7 +151,7 @@ InvoiceState _archiveInvoiceFailure(InvoiceState invoiceState, ArchiveInvoiceFai
|
|||
}
|
||||
|
||||
InvoiceState _deleteInvoiceRequest(InvoiceState invoiceState, DeleteInvoiceRequest action) {
|
||||
var invoice = invoiceState.map[action.invoiceId].rebuild((b) => b
|
||||
final invoice = invoiceState.map[action.invoiceId].rebuild((b) => b
|
||||
..archivedAt = DateTime.now().millisecondsSinceEpoch
|
||||
..isDeleted = true
|
||||
);
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ Middleware<AppState> _saveProduct(ProductRepository repository) {
|
|||
|
||||
Middleware<AppState> _loadProducts(ProductRepository repository) {
|
||||
return (Store<AppState> store, dynamic action, NextDispatcher next) {
|
||||
AppState state = store.state;
|
||||
final AppState state = store.state;
|
||||
|
||||
if (!state.productState.isStale && !action.force) {
|
||||
next(action);
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ final productsReducer = combineReducers<ProductState>([
|
|||
]);
|
||||
|
||||
ProductState _archiveProductRequest(ProductState productState, ArchiveProductRequest action) {
|
||||
var product = productState.map[action.productId].rebuild((b) => b
|
||||
final product = productState.map[action.productId].rebuild((b) => b
|
||||
..archivedAt = DateTime.now().millisecondsSinceEpoch
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ List<int> visibleProductsSelector(
|
|||
BuiltList<int> productList,
|
||||
ListUIState productListState) {
|
||||
|
||||
var list = productList.where((productId) {
|
||||
var product = productMap[productId];
|
||||
final list = productList.where((productId) {
|
||||
final product = productMap[productId];
|
||||
if (! product.matchesStates(productListState.stateFilters)) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@ class ClientScreen extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var store = StoreProvider.of<AppState>(context);
|
||||
var localization = AppLocalization.of(context);
|
||||
final store = StoreProvider.of<AppState>(context);
|
||||
final localization = AppLocalization.of(context);
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ class ClientEditBillingAddressState extends State<ClientEditBillingAddress> {
|
|||
|
||||
_controllers.forEach((dynamic controller) => controller.removeListener(_onChanged));
|
||||
|
||||
var client = widget.viewModel.client;
|
||||
final client = widget.viewModel.client;
|
||||
_address1Controller.text = client.address1;
|
||||
_address2Controller.text = client.address2;
|
||||
_cityController.text = client.city;
|
||||
|
|
@ -63,7 +63,7 @@ class ClientEditBillingAddressState extends State<ClientEditBillingAddress> {
|
|||
}
|
||||
|
||||
void _onChanged() {
|
||||
var client = widget.viewModel.client.rebuild((b) => b
|
||||
final client = widget.viewModel.client.rebuild((b) => b
|
||||
..address1 = _address1Controller.text.trim()
|
||||
..address2 = _address2Controller.text.trim()
|
||||
..city = _cityController.text.trim()
|
||||
|
|
|
|||
|
|
@ -15,9 +15,9 @@ class ClientEditContacts extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var localization = AppLocalization.of(context);
|
||||
var client = viewModel.client;
|
||||
var contacts = client.contacts.map((contact) => ContactEditDetails(
|
||||
final localization = AppLocalization.of(context);
|
||||
final client = viewModel.client;
|
||||
final contacts = client.contacts.map((contact) => ContactEditDetails(
|
||||
viewModel: viewModel,
|
||||
key: Key('__${EntityType.contact}_${contact.id}__'),
|
||||
isRemoveVisible: client.contacts.length > 1,
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ class ClientEditDetailsState extends State<ClientEditDetails> {
|
|||
|
||||
_controllers.forEach((dynamic controller) => controller.removeListener(_onChanged));
|
||||
|
||||
var client = widget.viewModel.client;
|
||||
final client = widget.viewModel.client;
|
||||
_nameController.text = client.name;
|
||||
_idNumberController.text = client.idNumber;
|
||||
_vatNumberController.text = client.vatNumber;
|
||||
|
|
@ -76,7 +76,7 @@ class ClientEditDetailsState extends State<ClientEditDetails> {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var localization = AppLocalization.of(context);
|
||||
final localization = AppLocalization.of(context);
|
||||
|
||||
return ListView(
|
||||
shrinkWrap: true,
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ class ClientEditShippingAddressState extends State<ClientEditShippingAddress> {
|
|||
}
|
||||
|
||||
void _onChanged() {
|
||||
var client = widget.viewModel.client.rebuild((b) => b
|
||||
final client = widget.viewModel.client.rebuild((b) => b
|
||||
..shippingAddress1 = _shippingAddress1Controller.text.trim()
|
||||
..shippingAddress2 = _shippingAddress2Controller.text.trim()
|
||||
..shippingCity = _shippingCityController.text.trim()
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ class _ClientViewDetailsState extends State<ClientViewDetails> {
|
|||
}
|
||||
|
||||
Widget _launchStatus(BuildContext context, AsyncSnapshot<Null> snapshot) {
|
||||
var localization = AppLocalization.of(context);
|
||||
final localization = AppLocalization.of(context);
|
||||
if (snapshot.hasError) {
|
||||
return new Text('${localization.error}: ${snapshot.error}');
|
||||
} else {
|
||||
|
|
@ -49,7 +49,7 @@ class _ClientViewDetailsState extends State<ClientViewDetails> {
|
|||
listTiles
|
||||
.add(FutureBuilder<Null>(future: _launched, builder: _launchStatus));
|
||||
|
||||
var contacts = client.contacts;
|
||||
final contacts = client.contacts;
|
||||
contacts.forEach((contact) {
|
||||
if ((contact.email ?? '').isNotEmpty) {
|
||||
listTiles.add(AppListTile(
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ class ItemEditDetailsState extends State<ItemEditDetails> with AutomaticKeepAliv
|
|||
|
||||
_controllers.forEach((dynamic controller) => controller.removeListener(_onChanged));
|
||||
|
||||
var invoiceItem = widget.invoiceItem;
|
||||
final invoiceItem = widget.invoiceItem;
|
||||
_productKeyController.text = invoiceItem.productKey;
|
||||
_notesController.text = invoiceItem.notes;
|
||||
_costController.text = formatNumber(
|
||||
|
|
@ -105,7 +105,7 @@ class ItemEditDetailsState extends State<ItemEditDetails> with AutomaticKeepAliv
|
|||
}
|
||||
|
||||
void _onChanged() {
|
||||
var invoiceItem = widget.invoiceItem.rebuild((b) => b
|
||||
final invoiceItem = widget.invoiceItem.rebuild((b) => b
|
||||
..productKey = _productKeyController.text.trim()
|
||||
..notes = _notesController.text.trim()
|
||||
..cost = double.tryParse(_costController.text) ?? 0.0
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ class InvoiceEditVM {
|
|||
});
|
||||
|
||||
factory InvoiceEditVM.fromStore(Store<AppState> store) {
|
||||
AppState state = store.state;
|
||||
final AppState state = store.state;
|
||||
final invoice = state.invoiceUIState.editing;
|
||||
|
||||
return InvoiceEditVM(
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ class _InvoiceItemSelectorState extends State<InvoiceItemSelector> {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var localization = AppLocalization.of(context);
|
||||
final localization = AppLocalization.of(context);
|
||||
|
||||
Widget _headerRow() {
|
||||
return Row(
|
||||
|
|
@ -132,8 +132,8 @@ class _InvoiceItemSelectorState extends State<InvoiceItemSelector> {
|
|||
}
|
||||
|
||||
Widget _entityList() {
|
||||
var state = widget.state.selectedCompanyState.productState;
|
||||
var matches = state.list
|
||||
final state = widget.state.selectedCompanyState.productState;
|
||||
final matches = state.list
|
||||
.where((entityId) => state.map[entityId].matchesSearch(_filter))
|
||||
.toList();
|
||||
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@ class InvoiceScreen extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var store = StoreProvider.of<AppState>(context);
|
||||
var localization = AppLocalization.of(context);
|
||||
final store = StoreProvider.of<AppState>(context);
|
||||
final localization = AppLocalization.of(context);
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ class _InvoiceViewState extends State<InvoiceView> {
|
|||
),
|
||||
];
|
||||
|
||||
Map<String, String> fields = {
|
||||
final Map<String, String> fields = {
|
||||
InvoiceFields.invoiceStatusId:
|
||||
invoiceStatusSelector(invoice, store.state.staticState),
|
||||
InvoiceFields.invoiceDate: invoice.invoiceDate,
|
||||
|
|
@ -67,7 +67,7 @@ class _InvoiceViewState extends State<InvoiceView> {
|
|||
: FormatNumberType.percent),
|
||||
};
|
||||
|
||||
List<Widget> fieldWidgets = [];
|
||||
final List<Widget> fieldWidgets = [];
|
||||
fields.forEach((field, value) {
|
||||
if (value != null && value.isNotEmpty) {
|
||||
fieldWidgets.add(Column(
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ class InvoiceViewVM {
|
|||
final client = store.state.clientState.map[invoice.clientId];
|
||||
|
||||
Future<Null> _viewPdf(BuildContext context) async {
|
||||
var localization = AppLocalization.of(context);
|
||||
final localization = AppLocalization.of(context);
|
||||
String url;
|
||||
bool useWebView;
|
||||
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ class _ProductEditState extends State<ProductEdit> {
|
|||
}
|
||||
|
||||
void _onChanged() {
|
||||
var product = widget.viewModel.product.rebuild((b) => b
|
||||
final product = widget.viewModel.product.rebuild((b) => b
|
||||
..productKey = _productKeyController.text.trim()
|
||||
..notes = _notesController.text.trim()
|
||||
..cost = double.tryParse(_costController.text) ?? 0.0
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@ class ProductScreen extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var store = StoreProvider.of<AppState>(context);
|
||||
var localization = AppLocalization.of(context);
|
||||
final store = StoreProvider.of<AppState>(context);
|
||||
final localization = AppLocalization.of(context);
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
|
|
|
|||
|
|
@ -47,8 +47,8 @@ String formatNumber(
|
|||
currencyId = kCurrencyUSDollar;
|
||||
}
|
||||
|
||||
CurrencyEntity currency = state.staticState.currencyMap[currencyId];
|
||||
CountryEntity country = state.staticState.countryMap[countryId];
|
||||
final CurrencyEntity currency = state.staticState.currencyMap[currencyId];
|
||||
final CountryEntity country = state.staticState.countryMap[countryId];
|
||||
|
||||
String thousandSeparator = currency.thousandSeparator;
|
||||
String decimalSeparator = currency.decimalSeparator;
|
||||
|
|
|
|||
|
|
@ -176,7 +176,7 @@ class ContactsPageState extends State<ContactsPage>
|
|||
}
|
||||
|
||||
List<ContactEntity> getContacts() {
|
||||
List<ContactEntity> contacts = [];
|
||||
final List<ContactEntity> contacts = [];
|
||||
_contactKeys.forEach((contactKey) {
|
||||
contacts.add(contactKey.currentState.getContact());
|
||||
});
|
||||
|
|
|
|||
|
|
@ -233,8 +233,8 @@ class ContactsPage extends StatelessWidget {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return StoreBuilder(builder: (BuildContext context, Store<AppState> store) {
|
||||
var client = store.state.client;
|
||||
var contacts = client.contacts.map((contact) => ContactForm(
|
||||
final client = store.state.client;
|
||||
final contacts = client.contacts.map((contact) => ContactForm(
|
||||
contact: contact,
|
||||
//key: Key('__contact_${contact.id}__'),
|
||||
index: store.state.client.contacts.indexOf(contact)));
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ void main() {
|
|||
|
||||
test('measure', () async {
|
||||
// Record the performance timeline of things that happen inside the closure
|
||||
Timeline timeline = await driver.traceAction(() async {
|
||||
final Timeline timeline = await driver.traceAction(() async {
|
||||
|
||||
//SerializableFinder email = find.byValueKey('email');
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue