Refactor
This commit is contained in:
parent
be226c3dcd
commit
7030f61ce2
|
|
@ -10,18 +10,19 @@ part 'client_state.g.dart';
|
|||
|
||||
abstract class ClientState implements Built<ClientState, ClientStateBuilder> {
|
||||
|
||||
@nullable
|
||||
int get lastUpdated;
|
||||
|
||||
BuiltMap<int, ClientEntity> get map;
|
||||
BuiltList<int> get list;
|
||||
|
||||
factory ClientState() {
|
||||
return _$ClientState._(
|
||||
map: BuiltMap<int, ClientEntity>(),
|
||||
list: BuiltList<int>(),
|
||||
);
|
||||
}
|
||||
ClientState._();
|
||||
|
||||
@nullable
|
||||
int get lastUpdated;
|
||||
|
||||
BuiltMap<int, ClientEntity> get map;
|
||||
BuiltList<int> get list;
|
||||
|
||||
bool get isStale {
|
||||
if (! isLoaded) {
|
||||
|
|
@ -35,18 +36,11 @@ abstract class ClientState implements Built<ClientState, ClientStateBuilder> {
|
|||
return lastUpdated != null;
|
||||
}
|
||||
|
||||
ClientState._();
|
||||
static Serializer<ClientState> get serializer => _$clientStateSerializer;
|
||||
}
|
||||
|
||||
abstract class ClientUIState extends Object with EntityUIState implements Built<ClientUIState, ClientUIStateBuilder> {
|
||||
|
||||
@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<ClientUIState> get serializer => _$clientUIStateSerializer;
|
||||
}
|
||||
|
|
@ -9,12 +9,6 @@ import 'package:built_value/serializer.dart';
|
|||
part 'company_state.g.dart';
|
||||
|
||||
abstract class CompanyState implements Built<CompanyState, CompanyStateBuilder> {
|
||||
@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<CompanyState, CompanyStateBuilder>
|
|||
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<CompanyState> get serializer => _$companyStateSerializer;
|
||||
}
|
||||
|
|
@ -7,17 +7,19 @@ part 'dashboard_state.g.dart';
|
|||
|
||||
abstract class DashboardState implements Built<DashboardState, DashboardStateBuilder> {
|
||||
|
||||
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<DashboardState, DashboardStateBui
|
|||
return lastUpdated != null;
|
||||
}
|
||||
|
||||
DashboardState._();
|
||||
static Serializer<DashboardState> get serializer => _$dashboardStateSerializer;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,18 +10,19 @@ part 'invoice_state.g.dart';
|
|||
|
||||
abstract class InvoiceState implements Built<InvoiceState, InvoiceStateBuilder> {
|
||||
|
||||
@nullable
|
||||
int get lastUpdated;
|
||||
|
||||
BuiltMap<int, InvoiceEntity> get map;
|
||||
BuiltList<int> get list;
|
||||
|
||||
factory InvoiceState() {
|
||||
return _$InvoiceState._(
|
||||
map: BuiltMap<int, InvoiceEntity>(),
|
||||
list: BuiltList<int>(),
|
||||
);
|
||||
}
|
||||
InvoiceState._();
|
||||
|
||||
@nullable
|
||||
int get lastUpdated;
|
||||
|
||||
BuiltMap<int, InvoiceEntity> get map;
|
||||
BuiltList<int> get list;
|
||||
|
||||
bool get isStale {
|
||||
if (! isLoaded) {
|
||||
|
|
@ -35,18 +36,11 @@ abstract class InvoiceState implements Built<InvoiceState, InvoiceStateBuilder>
|
|||
return lastUpdated != null;
|
||||
}
|
||||
|
||||
InvoiceState._();
|
||||
static Serializer<InvoiceState> get serializer => _$invoiceStateSerializer;
|
||||
}
|
||||
|
||||
abstract class InvoiceUIState extends Object with EntityUIState implements Built<InvoiceUIState, InvoiceUIStateBuilder> {
|
||||
|
||||
@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<InvoiceUIState> get serializer => _$invoiceUIStateSerializer;
|
||||
}
|
||||
|
|
@ -10,18 +10,19 @@ part 'product_state.g.dart';
|
|||
|
||||
abstract class ProductState implements Built<ProductState, ProductStateBuilder> {
|
||||
|
||||
@nullable
|
||||
int get lastUpdated;
|
||||
|
||||
BuiltMap<int, ProductEntity> get map;
|
||||
BuiltList<int> get list;
|
||||
|
||||
factory ProductState() {
|
||||
return _$ProductState._(
|
||||
map: BuiltMap<int, ProductEntity>(),
|
||||
list: BuiltList<int>(),
|
||||
);
|
||||
}
|
||||
ProductState._();
|
||||
|
||||
@nullable
|
||||
int get lastUpdated;
|
||||
|
||||
BuiltMap<int, ProductEntity> get map;
|
||||
BuiltList<int> get list;
|
||||
|
||||
bool get isStale {
|
||||
if (! isLoaded) {
|
||||
|
|
@ -35,18 +36,11 @@ abstract class ProductState implements Built<ProductState, ProductStateBuilder>
|
|||
return lastUpdated != null;
|
||||
}
|
||||
|
||||
ProductState._();
|
||||
static Serializer<ProductState> get serializer => _$productStateSerializer;
|
||||
}
|
||||
|
||||
abstract class ProductUIState extends Object with EntityUIState implements Built<ProductUIState, ProductUIStateBuilder> {
|
||||
|
||||
@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<ProductUIState> get serializer => _$productUIStateSerializer;
|
||||
}
|
||||
|
|
@ -7,18 +7,6 @@ part 'static_state.g.dart';
|
|||
|
||||
abstract class StaticState implements Built<StaticState, StaticStateBuilder> {
|
||||
|
||||
BuiltMap<int, CurrencyEntity> get currencyMap;
|
||||
BuiltMap<int, SizeEntity> get sizeMap;
|
||||
BuiltMap<int, IndustryEntity> get industryMap;
|
||||
BuiltMap<int, TimezoneEntity> get timezoneMap;
|
||||
BuiltMap<int, DateFormatEntity> get dateFormatMap;
|
||||
BuiltMap<int, DatetimeFormatEntity> get datetimeFormatMap;
|
||||
BuiltMap<int, LanguageEntity> get languageMap;
|
||||
BuiltMap<int, PaymentTypeEntity> get paymentTypeMap;
|
||||
BuiltMap<int, CountryEntity> get countryMap;
|
||||
BuiltMap<int, InvoiceStatusEntity> get invoiceStatusMap;
|
||||
BuiltMap<int, FrequencyEntity> get frequencyMap;
|
||||
|
||||
factory StaticState() {
|
||||
return _$StaticState._(
|
||||
currencyMap: BuiltMap<int, CurrencyEntity>(),
|
||||
|
|
@ -34,7 +22,19 @@ abstract class StaticState implements Built<StaticState, StaticStateBuilder> {
|
|||
frequencyMap: BuiltMap<int, FrequencyEntity>(),
|
||||
);
|
||||
}
|
||||
|
||||
StaticState._();
|
||||
|
||||
BuiltMap<int, CurrencyEntity> get currencyMap;
|
||||
BuiltMap<int, SizeEntity> get sizeMap;
|
||||
BuiltMap<int, IndustryEntity> get industryMap;
|
||||
BuiltMap<int, TimezoneEntity> get timezoneMap;
|
||||
BuiltMap<int, DateFormatEntity> get dateFormatMap;
|
||||
BuiltMap<int, DatetimeFormatEntity> get datetimeFormatMap;
|
||||
BuiltMap<int, LanguageEntity> get languageMap;
|
||||
BuiltMap<int, PaymentTypeEntity> get paymentTypeMap;
|
||||
BuiltMap<int, CountryEntity> get countryMap;
|
||||
BuiltMap<int, InvoiceStatusEntity> get invoiceStatusMap;
|
||||
BuiltMap<int, FrequencyEntity> get frequencyMap;
|
||||
|
||||
static Serializer<StaticState> get serializer => _$staticStateSerializer;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,12 +9,6 @@ part 'ui_state.g.dart';
|
|||
|
||||
abstract class UIState implements Built<UIState, UIStateBuilder> {
|
||||
|
||||
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<UIState, UIStateBuilder> {
|
|||
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<UIState> get serializer => _$uIStateSerializer;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue