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> {
|
abstract class ClientState implements Built<ClientState, ClientStateBuilder> {
|
||||||
|
|
||||||
@nullable
|
|
||||||
int get lastUpdated;
|
|
||||||
|
|
||||||
BuiltMap<int, ClientEntity> get map;
|
|
||||||
BuiltList<int> get list;
|
|
||||||
|
|
||||||
factory ClientState() {
|
factory ClientState() {
|
||||||
return _$ClientState._(
|
return _$ClientState._(
|
||||||
map: BuiltMap<int, ClientEntity>(),
|
map: BuiltMap<int, ClientEntity>(),
|
||||||
list: BuiltList<int>(),
|
list: BuiltList<int>(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
ClientState._();
|
||||||
|
|
||||||
|
@nullable
|
||||||
|
int get lastUpdated;
|
||||||
|
|
||||||
|
BuiltMap<int, ClientEntity> get map;
|
||||||
|
BuiltList<int> get list;
|
||||||
|
|
||||||
bool get isStale {
|
bool get isStale {
|
||||||
if (! isLoaded) {
|
if (! isLoaded) {
|
||||||
|
|
@ -35,18 +36,11 @@ abstract class ClientState implements Built<ClientState, ClientStateBuilder> {
|
||||||
return lastUpdated != null;
|
return lastUpdated != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
ClientState._();
|
|
||||||
static Serializer<ClientState> get serializer => _$clientStateSerializer;
|
static Serializer<ClientState> get serializer => _$clientStateSerializer;
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class ClientUIState extends Object with EntityUIState implements Built<ClientUIState, ClientUIStateBuilder> {
|
abstract class ClientUIState extends Object with EntityUIState implements Built<ClientUIState, ClientUIStateBuilder> {
|
||||||
|
|
||||||
@nullable
|
|
||||||
ClientEntity get editing;
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool get isCreatingNew => editing.isNew;
|
|
||||||
|
|
||||||
factory ClientUIState() {
|
factory ClientUIState() {
|
||||||
return _$ClientUIState._(
|
return _$ClientUIState._(
|
||||||
listUIState: ListUIState(ClientFields.name),
|
listUIState: ListUIState(ClientFields.name),
|
||||||
|
|
@ -55,7 +49,13 @@ abstract class ClientUIState extends Object with EntityUIState implements Built<
|
||||||
selectedId: 0,
|
selectedId: 0,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
ClientUIState._();
|
ClientUIState._();
|
||||||
|
|
||||||
|
@nullable
|
||||||
|
ClientEntity get editing;
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool get isCreatingNew => editing.isNew;
|
||||||
|
|
||||||
static Serializer<ClientUIState> get serializer => _$clientUIStateSerializer;
|
static Serializer<ClientUIState> get serializer => _$clientUIStateSerializer;
|
||||||
}
|
}
|
||||||
|
|
@ -9,12 +9,6 @@ import 'package:built_value/serializer.dart';
|
||||||
part 'company_state.g.dart';
|
part 'company_state.g.dart';
|
||||||
|
|
||||||
abstract class CompanyState implements Built<CompanyState, CompanyStateBuilder> {
|
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() {
|
factory CompanyState() {
|
||||||
return _$CompanyState._(
|
return _$CompanyState._(
|
||||||
|
|
@ -24,8 +18,15 @@ abstract class CompanyState implements Built<CompanyState, CompanyStateBuilder>
|
||||||
invoiceState: InvoiceState(),
|
invoiceState: InvoiceState(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
CompanyState._();
|
CompanyState._();
|
||||||
|
|
||||||
|
@nullable
|
||||||
|
CompanyEntity get company;
|
||||||
|
DashboardState get dashboardState;
|
||||||
|
ProductState get productState;
|
||||||
|
ClientState get clientState;
|
||||||
|
InvoiceState get invoiceState;
|
||||||
|
|
||||||
//factory CompanyState([void updates(CompanyStateBuilder b)]) = _$CompanyState;
|
//factory CompanyState([void updates(CompanyStateBuilder b)]) = _$CompanyState;
|
||||||
static Serializer<CompanyState> get serializer => _$companyStateSerializer;
|
static Serializer<CompanyState> get serializer => _$companyStateSerializer;
|
||||||
}
|
}
|
||||||
|
|
@ -7,17 +7,19 @@ part 'dashboard_state.g.dart';
|
||||||
|
|
||||||
abstract class DashboardState implements Built<DashboardState, DashboardStateBuilder> {
|
abstract class DashboardState implements Built<DashboardState, DashboardStateBuilder> {
|
||||||
|
|
||||||
|
factory DashboardState() {
|
||||||
|
return _$DashboardState._(
|
||||||
|
data: null,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
DashboardState._();
|
||||||
|
|
||||||
@nullable
|
@nullable
|
||||||
int get lastUpdated;
|
int get lastUpdated;
|
||||||
|
|
||||||
@nullable
|
@nullable
|
||||||
DashboardEntity get data;
|
DashboardEntity get data;
|
||||||
|
|
||||||
factory DashboardState() {
|
|
||||||
return _$DashboardState._(
|
|
||||||
data: null,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool get isStale {
|
bool get isStale {
|
||||||
if (! isLoaded) {
|
if (! isLoaded) {
|
||||||
|
|
@ -31,6 +33,5 @@ abstract class DashboardState implements Built<DashboardState, DashboardStateBui
|
||||||
return lastUpdated != null;
|
return lastUpdated != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
DashboardState._();
|
|
||||||
static Serializer<DashboardState> get serializer => _$dashboardStateSerializer;
|
static Serializer<DashboardState> get serializer => _$dashboardStateSerializer;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,18 +10,19 @@ part 'invoice_state.g.dart';
|
||||||
|
|
||||||
abstract class InvoiceState implements Built<InvoiceState, InvoiceStateBuilder> {
|
abstract class InvoiceState implements Built<InvoiceState, InvoiceStateBuilder> {
|
||||||
|
|
||||||
@nullable
|
|
||||||
int get lastUpdated;
|
|
||||||
|
|
||||||
BuiltMap<int, InvoiceEntity> get map;
|
|
||||||
BuiltList<int> get list;
|
|
||||||
|
|
||||||
factory InvoiceState() {
|
factory InvoiceState() {
|
||||||
return _$InvoiceState._(
|
return _$InvoiceState._(
|
||||||
map: BuiltMap<int, InvoiceEntity>(),
|
map: BuiltMap<int, InvoiceEntity>(),
|
||||||
list: BuiltList<int>(),
|
list: BuiltList<int>(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
InvoiceState._();
|
||||||
|
|
||||||
|
@nullable
|
||||||
|
int get lastUpdated;
|
||||||
|
|
||||||
|
BuiltMap<int, InvoiceEntity> get map;
|
||||||
|
BuiltList<int> get list;
|
||||||
|
|
||||||
bool get isStale {
|
bool get isStale {
|
||||||
if (! isLoaded) {
|
if (! isLoaded) {
|
||||||
|
|
@ -35,18 +36,11 @@ abstract class InvoiceState implements Built<InvoiceState, InvoiceStateBuilder>
|
||||||
return lastUpdated != null;
|
return lastUpdated != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
InvoiceState._();
|
|
||||||
static Serializer<InvoiceState> get serializer => _$invoiceStateSerializer;
|
static Serializer<InvoiceState> get serializer => _$invoiceStateSerializer;
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class InvoiceUIState extends Object with EntityUIState implements Built<InvoiceUIState, InvoiceUIStateBuilder> {
|
abstract class InvoiceUIState extends Object with EntityUIState implements Built<InvoiceUIState, InvoiceUIStateBuilder> {
|
||||||
|
|
||||||
@nullable
|
|
||||||
InvoiceEntity get editing;
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool get isCreatingNew => editing.isNew;
|
|
||||||
|
|
||||||
factory InvoiceUIState() {
|
factory InvoiceUIState() {
|
||||||
return _$InvoiceUIState._(
|
return _$InvoiceUIState._(
|
||||||
listUIState: ListUIState(InvoiceFields.invoiceNumber),
|
listUIState: ListUIState(InvoiceFields.invoiceNumber),
|
||||||
|
|
@ -55,7 +49,13 @@ abstract class InvoiceUIState extends Object with EntityUIState implements Built
|
||||||
selectedId: 0,
|
selectedId: 0,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
InvoiceUIState._();
|
InvoiceUIState._();
|
||||||
|
|
||||||
|
@nullable
|
||||||
|
InvoiceEntity get editing;
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool get isCreatingNew => editing.isNew;
|
||||||
|
|
||||||
static Serializer<InvoiceUIState> get serializer => _$invoiceUIStateSerializer;
|
static Serializer<InvoiceUIState> get serializer => _$invoiceUIStateSerializer;
|
||||||
}
|
}
|
||||||
|
|
@ -10,18 +10,19 @@ part 'product_state.g.dart';
|
||||||
|
|
||||||
abstract class ProductState implements Built<ProductState, ProductStateBuilder> {
|
abstract class ProductState implements Built<ProductState, ProductStateBuilder> {
|
||||||
|
|
||||||
@nullable
|
|
||||||
int get lastUpdated;
|
|
||||||
|
|
||||||
BuiltMap<int, ProductEntity> get map;
|
|
||||||
BuiltList<int> get list;
|
|
||||||
|
|
||||||
factory ProductState() {
|
factory ProductState() {
|
||||||
return _$ProductState._(
|
return _$ProductState._(
|
||||||
map: BuiltMap<int, ProductEntity>(),
|
map: BuiltMap<int, ProductEntity>(),
|
||||||
list: BuiltList<int>(),
|
list: BuiltList<int>(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
ProductState._();
|
||||||
|
|
||||||
|
@nullable
|
||||||
|
int get lastUpdated;
|
||||||
|
|
||||||
|
BuiltMap<int, ProductEntity> get map;
|
||||||
|
BuiltList<int> get list;
|
||||||
|
|
||||||
bool get isStale {
|
bool get isStale {
|
||||||
if (! isLoaded) {
|
if (! isLoaded) {
|
||||||
|
|
@ -35,18 +36,11 @@ abstract class ProductState implements Built<ProductState, ProductStateBuilder>
|
||||||
return lastUpdated != null;
|
return lastUpdated != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProductState._();
|
|
||||||
static Serializer<ProductState> get serializer => _$productStateSerializer;
|
static Serializer<ProductState> get serializer => _$productStateSerializer;
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class ProductUIState extends Object with EntityUIState implements Built<ProductUIState, ProductUIStateBuilder> {
|
abstract class ProductUIState extends Object with EntityUIState implements Built<ProductUIState, ProductUIStateBuilder> {
|
||||||
|
|
||||||
@nullable
|
|
||||||
ProductEntity get editing;
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool get isCreatingNew => editing.isNew;
|
|
||||||
|
|
||||||
factory ProductUIState() {
|
factory ProductUIState() {
|
||||||
return _$ProductUIState._(
|
return _$ProductUIState._(
|
||||||
listUIState: ListUIState(ProductFields.productKey),
|
listUIState: ListUIState(ProductFields.productKey),
|
||||||
|
|
@ -55,7 +49,13 @@ abstract class ProductUIState extends Object with EntityUIState implements Built
|
||||||
selectedId: 0,
|
selectedId: 0,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
ProductUIState._();
|
ProductUIState._();
|
||||||
|
|
||||||
|
@nullable
|
||||||
|
ProductEntity get editing;
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool get isCreatingNew => editing.isNew;
|
||||||
|
|
||||||
static Serializer<ProductUIState> get serializer => _$productUIStateSerializer;
|
static Serializer<ProductUIState> get serializer => _$productUIStateSerializer;
|
||||||
}
|
}
|
||||||
|
|
@ -7,18 +7,6 @@ part 'static_state.g.dart';
|
||||||
|
|
||||||
abstract class StaticState implements Built<StaticState, StaticStateBuilder> {
|
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() {
|
factory StaticState() {
|
||||||
return _$StaticState._(
|
return _$StaticState._(
|
||||||
currencyMap: BuiltMap<int, CurrencyEntity>(),
|
currencyMap: BuiltMap<int, CurrencyEntity>(),
|
||||||
|
|
@ -34,7 +22,19 @@ abstract class StaticState implements Built<StaticState, StaticStateBuilder> {
|
||||||
frequencyMap: BuiltMap<int, FrequencyEntity>(),
|
frequencyMap: BuiltMap<int, FrequencyEntity>(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
StaticState._();
|
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;
|
static Serializer<StaticState> get serializer => _$staticStateSerializer;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,12 +9,6 @@ part 'ui_state.g.dart';
|
||||||
|
|
||||||
abstract class UIState implements Built<UIState, UIStateBuilder> {
|
abstract class UIState implements Built<UIState, UIStateBuilder> {
|
||||||
|
|
||||||
int get selectedCompanyIndex;
|
|
||||||
String get currentRoute;
|
|
||||||
ProductUIState get productUIState;
|
|
||||||
ClientUIState get clientUIState;
|
|
||||||
InvoiceUIState get invoiceUIState;
|
|
||||||
|
|
||||||
factory UIState() {
|
factory UIState() {
|
||||||
return _$UIState._(
|
return _$UIState._(
|
||||||
selectedCompanyIndex: 0,
|
selectedCompanyIndex: 0,
|
||||||
|
|
@ -24,8 +18,14 @@ abstract class UIState implements Built<UIState, UIStateBuilder> {
|
||||||
invoiceUIState: InvoiceUIState(),
|
invoiceUIState: InvoiceUIState(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
UIState._();
|
UIState._();
|
||||||
|
|
||||||
|
int get selectedCompanyIndex;
|
||||||
|
String get currentRoute;
|
||||||
|
ProductUIState get productUIState;
|
||||||
|
ClientUIState get clientUIState;
|
||||||
|
InvoiceUIState get invoiceUIState;
|
||||||
|
|
||||||
//factory UIState([void updates(UIStateBuilder b)]) = _$UIState;
|
//factory UIState([void updates(UIStateBuilder b)]) = _$UIState;
|
||||||
static Serializer<UIState> get serializer => _$uIStateSerializer;
|
static Serializer<UIState> get serializer => _$uIStateSerializer;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue