diff --git a/lib/redux/client/client_state.dart b/lib/redux/client/client_state.dart index d2dc6cd9b..fa8aa4d9b 100644 --- a/lib/redux/client/client_state.dart +++ b/lib/redux/client/client_state.dart @@ -10,18 +10,19 @@ part 'client_state.g.dart'; abstract class ClientState implements Built { - @nullable - int get lastUpdated; - - BuiltMap get map; - BuiltList get list; - factory ClientState() { return _$ClientState._( map: BuiltMap(), list: BuiltList(), ); } + ClientState._(); + + @nullable + int get lastUpdated; + + BuiltMap get map; + BuiltList get list; bool get isStale { if (! isLoaded) { @@ -35,18 +36,11 @@ abstract class ClientState implements Built { return lastUpdated != null; } - ClientState._(); static Serializer get serializer => _$clientStateSerializer; } abstract class ClientUIState extends Object with EntityUIState implements Built { - @nullable - ClientEntity get editing; - - @override - bool get isCreatingNew => editing.isNew; - factory ClientUIState() { return _$ClientUIState._( listUIState: ListUIState(ClientFields.name), @@ -55,7 +49,13 @@ abstract class ClientUIState extends Object with EntityUIState implements Built< selectedId: 0, ); } - ClientUIState._(); + + @nullable + ClientEntity get editing; + + @override + bool get isCreatingNew => editing.isNew; + static Serializer get serializer => _$clientUIStateSerializer; } \ No newline at end of file diff --git a/lib/redux/company/company_state.dart b/lib/redux/company/company_state.dart index a7ed689f0..63af2c1b4 100644 --- a/lib/redux/company/company_state.dart +++ b/lib/redux/company/company_state.dart @@ -9,12 +9,6 @@ import 'package:built_value/serializer.dart'; part 'company_state.g.dart'; abstract class CompanyState implements Built { - @nullable - CompanyEntity get company; - DashboardState get dashboardState; - ProductState get productState; - ClientState get clientState; - InvoiceState get invoiceState; factory CompanyState() { return _$CompanyState._( @@ -24,8 +18,15 @@ abstract class CompanyState implements Built invoiceState: InvoiceState(), ); } - CompanyState._(); + + @nullable + CompanyEntity get company; + DashboardState get dashboardState; + ProductState get productState; + ClientState get clientState; + InvoiceState get invoiceState; + //factory CompanyState([void updates(CompanyStateBuilder b)]) = _$CompanyState; static Serializer get serializer => _$companyStateSerializer; } \ No newline at end of file diff --git a/lib/redux/dashboard/dashboard_state.dart b/lib/redux/dashboard/dashboard_state.dart index 7558a1d43..543880de0 100644 --- a/lib/redux/dashboard/dashboard_state.dart +++ b/lib/redux/dashboard/dashboard_state.dart @@ -7,17 +7,19 @@ part 'dashboard_state.g.dart'; abstract class DashboardState implements Built { + factory DashboardState() { + return _$DashboardState._( + data: null, + ); + } + DashboardState._(); + @nullable int get lastUpdated; @nullable DashboardEntity get data; - factory DashboardState() { - return _$DashboardState._( - data: null, - ); - } bool get isStale { if (! isLoaded) { @@ -31,6 +33,5 @@ abstract class DashboardState implements Built get serializer => _$dashboardStateSerializer; } diff --git a/lib/redux/invoice/invoice_state.dart b/lib/redux/invoice/invoice_state.dart index 3702e975e..ef873deb3 100644 --- a/lib/redux/invoice/invoice_state.dart +++ b/lib/redux/invoice/invoice_state.dart @@ -10,18 +10,19 @@ part 'invoice_state.g.dart'; abstract class InvoiceState implements Built { - @nullable - int get lastUpdated; - - BuiltMap get map; - BuiltList get list; - factory InvoiceState() { return _$InvoiceState._( map: BuiltMap(), list: BuiltList(), ); } + InvoiceState._(); + + @nullable + int get lastUpdated; + + BuiltMap get map; + BuiltList get list; bool get isStale { if (! isLoaded) { @@ -35,18 +36,11 @@ abstract class InvoiceState implements Built return lastUpdated != null; } - InvoiceState._(); static Serializer get serializer => _$invoiceStateSerializer; } abstract class InvoiceUIState extends Object with EntityUIState implements Built { - @nullable - InvoiceEntity get editing; - - @override - bool get isCreatingNew => editing.isNew; - factory InvoiceUIState() { return _$InvoiceUIState._( listUIState: ListUIState(InvoiceFields.invoiceNumber), @@ -55,7 +49,13 @@ abstract class InvoiceUIState extends Object with EntityUIState implements Built selectedId: 0, ); } - InvoiceUIState._(); + + @nullable + InvoiceEntity get editing; + + @override + bool get isCreatingNew => editing.isNew; + static Serializer get serializer => _$invoiceUIStateSerializer; } \ No newline at end of file diff --git a/lib/redux/product/product_state.dart b/lib/redux/product/product_state.dart index 6dcab8cf8..261615ac6 100644 --- a/lib/redux/product/product_state.dart +++ b/lib/redux/product/product_state.dart @@ -10,18 +10,19 @@ part 'product_state.g.dart'; abstract class ProductState implements Built { - @nullable - int get lastUpdated; - - BuiltMap get map; - BuiltList get list; - factory ProductState() { return _$ProductState._( map: BuiltMap(), list: BuiltList(), ); } + ProductState._(); + + @nullable + int get lastUpdated; + + BuiltMap get map; + BuiltList get list; bool get isStale { if (! isLoaded) { @@ -35,18 +36,11 @@ abstract class ProductState implements Built return lastUpdated != null; } - ProductState._(); static Serializer get serializer => _$productStateSerializer; } abstract class ProductUIState extends Object with EntityUIState implements Built { - @nullable - ProductEntity get editing; - - @override - bool get isCreatingNew => editing.isNew; - factory ProductUIState() { return _$ProductUIState._( listUIState: ListUIState(ProductFields.productKey), @@ -55,7 +49,13 @@ abstract class ProductUIState extends Object with EntityUIState implements Built selectedId: 0, ); } - ProductUIState._(); + + @nullable + ProductEntity get editing; + + @override + bool get isCreatingNew => editing.isNew; + static Serializer get serializer => _$productUIStateSerializer; } \ No newline at end of file diff --git a/lib/redux/static/static_state.dart b/lib/redux/static/static_state.dart index 4162181fa..04dbb509a 100644 --- a/lib/redux/static/static_state.dart +++ b/lib/redux/static/static_state.dart @@ -7,18 +7,6 @@ part 'static_state.g.dart'; abstract class StaticState implements Built { - BuiltMap get currencyMap; - BuiltMap get sizeMap; - BuiltMap get industryMap; - BuiltMap get timezoneMap; - BuiltMap get dateFormatMap; - BuiltMap get datetimeFormatMap; - BuiltMap get languageMap; - BuiltMap get paymentTypeMap; - BuiltMap get countryMap; - BuiltMap get invoiceStatusMap; - BuiltMap get frequencyMap; - factory StaticState() { return _$StaticState._( currencyMap: BuiltMap(), @@ -34,7 +22,19 @@ abstract class StaticState implements Built { frequencyMap: BuiltMap(), ); } - StaticState._(); + + BuiltMap get currencyMap; + BuiltMap get sizeMap; + BuiltMap get industryMap; + BuiltMap get timezoneMap; + BuiltMap get dateFormatMap; + BuiltMap get datetimeFormatMap; + BuiltMap get languageMap; + BuiltMap get paymentTypeMap; + BuiltMap get countryMap; + BuiltMap get invoiceStatusMap; + BuiltMap get frequencyMap; + static Serializer get serializer => _$staticStateSerializer; } diff --git a/lib/redux/ui/ui_state.dart b/lib/redux/ui/ui_state.dart index ecff2a6fa..892576c60 100644 --- a/lib/redux/ui/ui_state.dart +++ b/lib/redux/ui/ui_state.dart @@ -9,12 +9,6 @@ part 'ui_state.g.dart'; abstract class UIState implements Built { - int get selectedCompanyIndex; - String get currentRoute; - ProductUIState get productUIState; - ClientUIState get clientUIState; - InvoiceUIState get invoiceUIState; - factory UIState() { return _$UIState._( selectedCompanyIndex: 0, @@ -24,8 +18,14 @@ abstract class UIState implements Built { invoiceUIState: InvoiceUIState(), ); } - UIState._(); + + int get selectedCompanyIndex; + String get currentRoute; + ProductUIState get productUIState; + ClientUIState get clientUIState; + InvoiceUIState get invoiceUIState; + //factory UIState([void updates(UIStateBuilder b)]) = _$UIState; static Serializer get serializer => _$uIStateSerializer; }