Persist table sorting
This commit is contained in:
parent
d8fe1c4573
commit
14f55b0bbb
|
|
@ -107,7 +107,8 @@ abstract class AppState implements Built<AppState, AppStateBuilder> {
|
|||
List<int>.generate(kMaxNumberOfCompanies, (i) => i + 1)
|
||||
.map((index) => UserCompanyState(reportErrors))
|
||||
.toList()),
|
||||
uiState: UIState(currentRoute: currentRoute),
|
||||
uiState: UIState(
|
||||
currentRoute: currentRoute, sortFields: prefState?.sortFields),
|
||||
prefState: prefState ?? PrefState(),
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import 'package:built_value/serializer.dart';
|
|||
import 'package:invoiceninja_flutter/data/models/models.dart';
|
||||
import 'package:invoiceninja_flutter/redux/ui/entity_ui_state.dart';
|
||||
import 'package:invoiceninja_flutter/redux/ui/list_ui_state.dart';
|
||||
import 'package:invoiceninja_flutter/redux/ui/pref_state.dart';
|
||||
|
||||
part 'client_state.g.dart';
|
||||
|
||||
|
|
@ -53,9 +54,10 @@ abstract class ClientState implements Built<ClientState, ClientStateBuilder> {
|
|||
abstract class ClientUIState extends Object
|
||||
with EntityUIState
|
||||
implements Built<ClientUIState, ClientUIStateBuilder> {
|
||||
factory ClientUIState() {
|
||||
factory ClientUIState(PrefStateSortField sortField) {
|
||||
return _$ClientUIState._(
|
||||
listUIState: ListUIState(ClientFields.name),
|
||||
listUIState: ListUIState(sortField.field ?? ClientFields.name,
|
||||
sortAscending: sortField?.ascending),
|
||||
editing: ClientEntity(),
|
||||
editingContact: ContactEntity(),
|
||||
saveCompleter: null,
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import 'package:invoiceninja_flutter/data/models/company_gateway_model.dart';
|
|||
import 'package:invoiceninja_flutter/redux/ui/entity_ui_state.dart';
|
||||
import 'package:invoiceninja_flutter/redux/ui/list_ui_state.dart';
|
||||
import 'package:invoiceninja_flutter/data/models/models.dart';
|
||||
import 'package:invoiceninja_flutter/redux/ui/pref_state.dart';
|
||||
|
||||
part 'company_gateway_state.g.dart';
|
||||
|
||||
|
|
@ -43,9 +44,10 @@ abstract class CompanyGatewayState
|
|||
abstract class CompanyGatewayUIState extends Object
|
||||
with EntityUIState
|
||||
implements Built<CompanyGatewayUIState, CompanyGatewayUIStateBuilder> {
|
||||
factory CompanyGatewayUIState() {
|
||||
factory CompanyGatewayUIState(PrefStateSortField sortField) {
|
||||
return _$CompanyGatewayUIState._(
|
||||
listUIState: ListUIState(CompanyGatewayFields.name),
|
||||
listUIState: ListUIState(sortField.field ?? CompanyGatewayFields.name,
|
||||
sortAscending: sortField?.ascending),
|
||||
editing: CompanyGatewayEntity(),
|
||||
selectedId: '',
|
||||
tabIndex: 0,
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import 'package:invoiceninja_flutter/data/models/credit_model.dart';
|
|||
import 'package:invoiceninja_flutter/redux/ui/entity_ui_state.dart';
|
||||
import 'package:invoiceninja_flutter/redux/ui/list_ui_state.dart';
|
||||
import 'package:invoiceninja_flutter/data/models/models.dart';
|
||||
import 'package:invoiceninja_flutter/redux/ui/pref_state.dart';
|
||||
|
||||
part 'credit_state.g.dart';
|
||||
|
||||
|
|
@ -53,9 +54,10 @@ abstract class CreditState implements Built<CreditState, CreditStateBuilder> {
|
|||
abstract class CreditUIState extends Object
|
||||
with EntityUIState
|
||||
implements Built<CreditUIState, CreditUIStateBuilder> {
|
||||
factory CreditUIState() {
|
||||
factory CreditUIState(PrefStateSortField sortField) {
|
||||
return _$CreditUIState._(
|
||||
listUIState: ListUIState(CreditFields.number, sortAscending: false),
|
||||
listUIState: ListUIState(sortField.field ?? CreditFields.number,
|
||||
sortAscending: sortField?.ascending ?? false),
|
||||
editing: InvoiceEntity(),
|
||||
selectedId: '',
|
||||
tabIndex: 0,
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import 'package:invoiceninja_flutter/data/models/design_model.dart';
|
|||
import 'package:invoiceninja_flutter/redux/ui/entity_ui_state.dart';
|
||||
import 'package:invoiceninja_flutter/redux/ui/list_ui_state.dart';
|
||||
import 'package:invoiceninja_flutter/data/models/models.dart';
|
||||
import 'package:invoiceninja_flutter/redux/ui/pref_state.dart';
|
||||
|
||||
part 'design_state.g.dart';
|
||||
|
||||
|
|
@ -55,9 +56,10 @@ abstract class DesignState implements Built<DesignState, DesignStateBuilder> {
|
|||
abstract class DesignUIState extends Object
|
||||
with EntityUIState
|
||||
implements Built<DesignUIState, DesignUIStateBuilder> {
|
||||
factory DesignUIState() {
|
||||
factory DesignUIState(PrefStateSortField sortField) {
|
||||
return _$DesignUIState._(
|
||||
listUIState: ListUIState(DesignFields.name),
|
||||
listUIState: ListUIState(sortField.field ?? DesignFields.name,
|
||||
sortAscending: sortField?.ascending),
|
||||
editing: DesignEntity(),
|
||||
selectedId: '',
|
||||
tabIndex: 0,
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import 'package:invoiceninja_flutter/data/models/document_model.dart';
|
|||
import 'package:invoiceninja_flutter/data/models/entities.dart';
|
||||
import 'package:invoiceninja_flutter/redux/ui/entity_ui_state.dart';
|
||||
import 'package:invoiceninja_flutter/redux/ui/list_ui_state.dart';
|
||||
import 'package:invoiceninja_flutter/redux/ui/pref_state.dart';
|
||||
|
||||
part 'document_state.g.dart';
|
||||
|
||||
|
|
@ -35,9 +36,10 @@ abstract class DocumentState
|
|||
abstract class DocumentUIState extends Object
|
||||
with EntityUIState
|
||||
implements Built<DocumentUIState, DocumentUIStateBuilder> {
|
||||
factory DocumentUIState() {
|
||||
factory DocumentUIState(PrefStateSortField sortField) {
|
||||
return _$DocumentUIState._(
|
||||
listUIState: ListUIState(DocumentFields.name),
|
||||
listUIState: ListUIState(sortField.field ?? DocumentFields.name,
|
||||
sortAscending: sortField?.ascending),
|
||||
editing: DocumentEntity(),
|
||||
selectedId: '',
|
||||
tabIndex: 0,
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import 'package:invoiceninja_flutter/data/models/entities.dart';
|
|||
import 'package:invoiceninja_flutter/data/models/expense_model.dart';
|
||||
import 'package:invoiceninja_flutter/redux/ui/entity_ui_state.dart';
|
||||
import 'package:invoiceninja_flutter/redux/ui/list_ui_state.dart';
|
||||
import 'package:invoiceninja_flutter/redux/ui/pref_state.dart';
|
||||
|
||||
part 'expense_state.g.dart';
|
||||
|
||||
|
|
@ -55,9 +56,10 @@ abstract class ExpenseState
|
|||
abstract class ExpenseUIState extends Object
|
||||
with EntityUIState
|
||||
implements Built<ExpenseUIState, ExpenseUIStateBuilder> {
|
||||
factory ExpenseUIState() {
|
||||
factory ExpenseUIState(PrefStateSortField sortField) {
|
||||
return _$ExpenseUIState._(
|
||||
listUIState: ListUIState(ExpenseFields.number, sortAscending: false),
|
||||
listUIState: ListUIState(sortField.field ?? ExpenseFields.number,
|
||||
sortAscending: sortField?.ascending ?? false),
|
||||
editing: ExpenseEntity(),
|
||||
selectedId: '',
|
||||
tabIndex: 0,
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import 'package:built_collection/built_collection.dart';
|
|||
import 'package:invoiceninja_flutter/redux/ui/entity_ui_state.dart';
|
||||
import 'package:invoiceninja_flutter/redux/ui/list_ui_state.dart';
|
||||
import 'package:invoiceninja_flutter/data/models/models.dart';
|
||||
import 'package:invoiceninja_flutter/redux/ui/pref_state.dart';
|
||||
|
||||
part 'expense_category_state.g.dart';
|
||||
|
||||
|
|
@ -55,9 +56,10 @@ abstract class ExpenseCategoryState
|
|||
abstract class ExpenseCategoryUIState extends Object
|
||||
with EntityUIState
|
||||
implements Built<ExpenseCategoryUIState, ExpenseCategoryUIStateBuilder> {
|
||||
factory ExpenseCategoryUIState() {
|
||||
factory ExpenseCategoryUIState(PrefStateSortField sortField) {
|
||||
return _$ExpenseCategoryUIState._(
|
||||
listUIState: ListUIState(ExpenseCategoryFields.name),
|
||||
listUIState: ListUIState(sortField.field ?? ExpenseCategoryFields.name,
|
||||
sortAscending: sortField?.ascending),
|
||||
editing: ExpenseCategoryEntity(),
|
||||
selectedId: '',
|
||||
tabIndex: 0,
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import 'package:invoiceninja_flutter/data/models/group_model.dart';
|
|||
import 'package:invoiceninja_flutter/redux/ui/entity_ui_state.dart';
|
||||
import 'package:invoiceninja_flutter/redux/ui/list_ui_state.dart';
|
||||
import 'package:invoiceninja_flutter/data/models/models.dart';
|
||||
import 'package:invoiceninja_flutter/redux/ui/pref_state.dart';
|
||||
|
||||
part 'group_state.g.dart';
|
||||
|
||||
|
|
@ -41,9 +42,10 @@ abstract class GroupState implements Built<GroupState, GroupStateBuilder> {
|
|||
abstract class GroupUIState extends Object
|
||||
with EntityUIState
|
||||
implements Built<GroupUIState, GroupUIStateBuilder> {
|
||||
factory GroupUIState() {
|
||||
factory GroupUIState(PrefStateSortField sortField) {
|
||||
return _$GroupUIState._(
|
||||
listUIState: ListUIState(GroupFields.name),
|
||||
listUIState: ListUIState(sortField.field ?? GroupFields.name,
|
||||
sortAscending: sortField?.ascending),
|
||||
editing: GroupEntity(),
|
||||
selectedId: '',
|
||||
tabIndex: 0,
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import 'package:built_value/serializer.dart';
|
|||
import 'package:built_collection/built_collection.dart';
|
||||
import 'package:invoiceninja_flutter/redux/ui/entity_ui_state.dart';
|
||||
import 'package:invoiceninja_flutter/redux/ui/list_ui_state.dart';
|
||||
import 'package:invoiceninja_flutter/redux/ui/pref_state.dart';
|
||||
|
||||
part 'invoice_state.g.dart';
|
||||
|
||||
|
|
@ -54,9 +55,10 @@ abstract class InvoiceState
|
|||
abstract class InvoiceUIState extends Object
|
||||
with EntityUIState
|
||||
implements Built<InvoiceUIState, InvoiceUIStateBuilder> {
|
||||
factory InvoiceUIState() {
|
||||
factory InvoiceUIState(PrefStateSortField sortField) {
|
||||
return _$InvoiceUIState._(
|
||||
listUIState: ListUIState(InvoiceFields.number, sortAscending: false),
|
||||
listUIState: ListUIState(sortField.field ?? InvoiceFields.number,
|
||||
sortAscending: sortField?.ascending ?? false),
|
||||
editing: InvoiceEntity(),
|
||||
selectedId: '',
|
||||
tabIndex: 0,
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import 'package:invoiceninja_flutter/data/models/entities.dart';
|
|||
import 'package:invoiceninja_flutter/data/models/payment_model.dart';
|
||||
import 'package:invoiceninja_flutter/redux/ui/entity_ui_state.dart';
|
||||
import 'package:invoiceninja_flutter/redux/ui/list_ui_state.dart';
|
||||
import 'package:invoiceninja_flutter/redux/ui/pref_state.dart';
|
||||
|
||||
part 'payment_state.g.dart';
|
||||
|
||||
|
|
@ -55,9 +56,10 @@ abstract class PaymentState
|
|||
abstract class PaymentUIState extends Object
|
||||
with EntityUIState
|
||||
implements Built<PaymentUIState, PaymentUIStateBuilder> {
|
||||
factory PaymentUIState() {
|
||||
factory PaymentUIState(PrefStateSortField sortField) {
|
||||
return _$PaymentUIState._(
|
||||
listUIState: ListUIState(PaymentFields.number, sortAscending: false),
|
||||
listUIState: ListUIState(sortField.field ?? PaymentFields.number,
|
||||
sortAscending: sortField?.ascending ?? false),
|
||||
editing: PaymentEntity(),
|
||||
selectedId: '',
|
||||
tabIndex: 0,
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import 'package:invoiceninja_flutter/data/models/payment_term_model.dart';
|
|||
import 'package:invoiceninja_flutter/redux/ui/entity_ui_state.dart';
|
||||
import 'package:invoiceninja_flutter/redux/ui/list_ui_state.dart';
|
||||
import 'package:invoiceninja_flutter/data/models/models.dart';
|
||||
import 'package:invoiceninja_flutter/redux/ui/pref_state.dart';
|
||||
|
||||
part 'payment_term_state.g.dart';
|
||||
|
||||
|
|
@ -47,9 +48,10 @@ abstract class PaymentTermState
|
|||
abstract class PaymentTermUIState extends Object
|
||||
with EntityUIState
|
||||
implements Built<PaymentTermUIState, PaymentTermUIStateBuilder> {
|
||||
factory PaymentTermUIState() {
|
||||
factory PaymentTermUIState(PrefStateSortField sortField) {
|
||||
return _$PaymentTermUIState._(
|
||||
listUIState: ListUIState(PaymentTermFields.name),
|
||||
listUIState: ListUIState(sortField.field ?? PaymentTermFields.name,
|
||||
sortAscending: sortField?.ascending),
|
||||
editing: PaymentTermEntity(),
|
||||
selectedId: '',
|
||||
tabIndex: 0,
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import 'package:built_value/serializer.dart';
|
|||
import 'package:built_collection/built_collection.dart';
|
||||
import 'package:invoiceninja_flutter/redux/ui/entity_ui_state.dart';
|
||||
import 'package:invoiceninja_flutter/redux/ui/list_ui_state.dart';
|
||||
import 'package:invoiceninja_flutter/redux/ui/pref_state.dart';
|
||||
|
||||
part 'product_state.g.dart';
|
||||
|
||||
|
|
@ -54,9 +55,10 @@ abstract class ProductState
|
|||
abstract class ProductUIState extends Object
|
||||
with EntityUIState
|
||||
implements Built<ProductUIState, ProductUIStateBuilder> {
|
||||
factory ProductUIState() {
|
||||
factory ProductUIState(PrefStateSortField sortField) {
|
||||
return _$ProductUIState._(
|
||||
listUIState: ListUIState(ProductFields.productKey),
|
||||
listUIState: ListUIState(sortField.field ?? ProductFields.productKey,
|
||||
sortAscending: sortField?.ascending),
|
||||
editing: ProductEntity(),
|
||||
selectedId: '',
|
||||
tabIndex: 0,
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import 'package:invoiceninja_flutter/data/models/entities.dart';
|
|||
import 'package:invoiceninja_flutter/data/models/project_model.dart';
|
||||
import 'package:invoiceninja_flutter/redux/ui/entity_ui_state.dart';
|
||||
import 'package:invoiceninja_flutter/redux/ui/list_ui_state.dart';
|
||||
import 'package:invoiceninja_flutter/redux/ui/pref_state.dart';
|
||||
|
||||
part 'project_state.g.dart';
|
||||
|
||||
|
|
@ -55,9 +56,10 @@ abstract class ProjectState
|
|||
abstract class ProjectUIState extends Object
|
||||
with EntityUIState
|
||||
implements Built<ProjectUIState, ProjectUIStateBuilder> {
|
||||
factory ProjectUIState() {
|
||||
factory ProjectUIState(PrefStateSortField sortField) {
|
||||
return _$ProjectUIState._(
|
||||
listUIState: ListUIState(ProjectFields.number, sortAscending: false),
|
||||
listUIState: ListUIState(sortField.field ?? ProjectFields.number,
|
||||
sortAscending: sortField?.ascending ?? false),
|
||||
editing: ProjectEntity(),
|
||||
selectedId: '',
|
||||
tabIndex: 0,
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import 'package:invoiceninja_flutter/data/models/invoice_model.dart';
|
|||
import 'package:invoiceninja_flutter/data/models/quote_model.dart';
|
||||
import 'package:invoiceninja_flutter/redux/ui/entity_ui_state.dart';
|
||||
import 'package:invoiceninja_flutter/redux/ui/list_ui_state.dart';
|
||||
import 'package:invoiceninja_flutter/redux/ui/pref_state.dart';
|
||||
|
||||
part 'quote_state.g.dart';
|
||||
|
||||
|
|
@ -55,9 +56,10 @@ abstract class QuoteState implements Built<QuoteState, QuoteStateBuilder> {
|
|||
abstract class QuoteUIState extends Object
|
||||
with EntityUIState
|
||||
implements Built<QuoteUIState, QuoteUIStateBuilder> {
|
||||
factory QuoteUIState() {
|
||||
factory QuoteUIState(PrefStateSortField sortField) {
|
||||
return _$QuoteUIState._(
|
||||
listUIState: ListUIState(QuoteFields.number, sortAscending: false),
|
||||
listUIState: ListUIState(sortField.field ?? QuoteFields.number,
|
||||
sortAscending: sortField?.ascending ?? false),
|
||||
editing: InvoiceEntity(),
|
||||
selectedId: '',
|
||||
tabIndex: 0,
|
||||
|
|
|
|||
|
|
@ -3,9 +3,11 @@ import 'package:built_value/built_value.dart';
|
|||
import 'package:built_value/serializer.dart';
|
||||
import 'package:built_collection/built_collection.dart';
|
||||
import 'package:invoiceninja_flutter/data/models/invoice_model.dart';
|
||||
import 'package:invoiceninja_flutter/data/models/recurring_invoice_model.dart';
|
||||
import 'package:invoiceninja_flutter/redux/ui/entity_ui_state.dart';
|
||||
import 'package:invoiceninja_flutter/redux/ui/list_ui_state.dart';
|
||||
import 'package:invoiceninja_flutter/data/models/models.dart';
|
||||
import 'package:invoiceninja_flutter/redux/ui/pref_state.dart';
|
||||
|
||||
part 'recurring_invoice_state.g.dart';
|
||||
|
||||
|
|
@ -56,9 +58,10 @@ abstract class RecurringInvoiceState
|
|||
abstract class RecurringInvoiceUIState extends Object
|
||||
with EntityUIState
|
||||
implements Built<RecurringInvoiceUIState, RecurringInvoiceUIStateBuilder> {
|
||||
factory RecurringInvoiceUIState() {
|
||||
factory RecurringInvoiceUIState(PrefStateSortField sortField) {
|
||||
return _$RecurringInvoiceUIState._(
|
||||
listUIState: ListUIState(InvoiceFields.number),
|
||||
listUIState: ListUIState(sortField.field ?? RecurringInvoiceFields.number,
|
||||
sortAscending: sortField?.ascending ?? false),
|
||||
editing: InvoiceEntity(),
|
||||
selectedId: '',
|
||||
tabIndex: 0,
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import 'package:invoiceninja_flutter/data/models/subscription_model.dart';
|
|||
import 'package:invoiceninja_flutter/redux/ui/entity_ui_state.dart';
|
||||
import 'package:invoiceninja_flutter/redux/ui/list_ui_state.dart';
|
||||
import 'package:invoiceninja_flutter/data/models/models.dart';
|
||||
import 'package:invoiceninja_flutter/redux/ui/pref_state.dart';
|
||||
|
||||
part 'subscription_state.g.dart';
|
||||
|
||||
|
|
@ -55,9 +56,10 @@ abstract class SubscriptionState
|
|||
abstract class SubscriptionUIState extends Object
|
||||
with EntityUIState
|
||||
implements Built<SubscriptionUIState, SubscriptionUIStateBuilder> {
|
||||
factory SubscriptionUIState() {
|
||||
factory SubscriptionUIState(PrefStateSortField sortField) {
|
||||
return _$SubscriptionUIState._(
|
||||
listUIState: ListUIState(SubscriptionFields.createdAt),
|
||||
listUIState: ListUIState(sortField.field ?? SubscriptionFields.createdAt,
|
||||
sortAscending: sortField?.ascending),
|
||||
editing: SubscriptionEntity(),
|
||||
selectedId: '',
|
||||
tabIndex: 0,
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import 'package:invoiceninja_flutter/data/models/entities.dart';
|
|||
import 'package:invoiceninja_flutter/data/models/task_model.dart';
|
||||
import 'package:invoiceninja_flutter/redux/ui/entity_ui_state.dart';
|
||||
import 'package:invoiceninja_flutter/redux/ui/list_ui_state.dart';
|
||||
import 'package:invoiceninja_flutter/redux/ui/pref_state.dart';
|
||||
|
||||
part 'task_state.g.dart';
|
||||
|
||||
|
|
@ -54,9 +55,10 @@ abstract class TaskState implements Built<TaskState, TaskStateBuilder> {
|
|||
abstract class TaskUIState extends Object
|
||||
with EntityUIState
|
||||
implements Built<TaskUIState, TaskUIStateBuilder> {
|
||||
factory TaskUIState() {
|
||||
factory TaskUIState(PrefStateSortField sortField) {
|
||||
return _$TaskUIState._(
|
||||
listUIState: ListUIState(TaskFields.number, sortAscending: false),
|
||||
listUIState: ListUIState(sortField.field ?? TaskFields.number,
|
||||
sortAscending: sortField?.ascending ?? false),
|
||||
editing: TaskEntity(),
|
||||
selectedId: '',
|
||||
tabIndex: 0,
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import 'package:invoiceninja_flutter/data/models/task_status_model.dart';
|
|||
import 'package:invoiceninja_flutter/redux/ui/entity_ui_state.dart';
|
||||
import 'package:invoiceninja_flutter/redux/ui/list_ui_state.dart';
|
||||
import 'package:invoiceninja_flutter/data/models/models.dart';
|
||||
import 'package:invoiceninja_flutter/redux/ui/pref_state.dart';
|
||||
|
||||
part 'task_status_state.g.dart';
|
||||
|
||||
|
|
@ -55,9 +56,10 @@ abstract class TaskStatusState
|
|||
abstract class TaskStatusUIState extends Object
|
||||
with EntityUIState
|
||||
implements Built<TaskStatusUIState, TaskStatusUIStateBuilder> {
|
||||
factory TaskStatusUIState() {
|
||||
factory TaskStatusUIState(PrefStateSortField sortField) {
|
||||
return _$TaskStatusUIState._(
|
||||
listUIState: ListUIState(TaskStatusFields.order),
|
||||
listUIState: ListUIState(sortField.field ?? TaskStatusFields.order,
|
||||
sortAscending: sortField?.ascending),
|
||||
editing: TaskStatusEntity(),
|
||||
selectedId: '',
|
||||
tabIndex: 0,
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import 'package:invoiceninja_flutter/data/models/tax_rate_model.dart';
|
|||
import 'package:invoiceninja_flutter/redux/ui/entity_ui_state.dart';
|
||||
import 'package:invoiceninja_flutter/redux/ui/list_ui_state.dart';
|
||||
import 'package:invoiceninja_flutter/data/models/models.dart';
|
||||
import 'package:invoiceninja_flutter/redux/ui/pref_state.dart';
|
||||
|
||||
part 'tax_rate_state.g.dart';
|
||||
|
||||
|
|
@ -34,9 +35,10 @@ abstract class TaxRateState
|
|||
abstract class TaxRateUIState extends Object
|
||||
with EntityUIState
|
||||
implements Built<TaxRateUIState, TaxRateUIStateBuilder> {
|
||||
factory TaxRateUIState() {
|
||||
factory TaxRateUIState(PrefStateSortField sortField) {
|
||||
return _$TaxRateUIState._(
|
||||
listUIState: ListUIState(TaxRateFields.name),
|
||||
listUIState: ListUIState(sortField.field ?? TaxRateFields.name,
|
||||
sortAscending: sortField?.ascending),
|
||||
editing: TaxRateEntity(),
|
||||
selectedId: '',
|
||||
tabIndex: 0,
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import 'package:invoiceninja_flutter/data/models/token_model.dart';
|
|||
import 'package:invoiceninja_flutter/redux/ui/entity_ui_state.dart';
|
||||
import 'package:invoiceninja_flutter/redux/ui/list_ui_state.dart';
|
||||
import 'package:invoiceninja_flutter/data/models/models.dart';
|
||||
import 'package:invoiceninja_flutter/redux/ui/pref_state.dart';
|
||||
|
||||
part 'token_state.g.dart';
|
||||
|
||||
|
|
@ -45,9 +46,10 @@ abstract class TokenState implements Built<TokenState, TokenStateBuilder> {
|
|||
abstract class TokenUIState extends Object
|
||||
with EntityUIState
|
||||
implements Built<TokenUIState, TokenUIStateBuilder> {
|
||||
factory TokenUIState() {
|
||||
factory TokenUIState(PrefStateSortField sortField) {
|
||||
return _$TokenUIState._(
|
||||
listUIState: ListUIState(TokenFields.name),
|
||||
listUIState: ListUIState(sortField.field ?? TokenFields.name,
|
||||
sortAscending: sortField?.ascending),
|
||||
editing: TokenEntity(),
|
||||
selectedId: '',
|
||||
tabIndex: 0,
|
||||
|
|
|
|||
|
|
@ -74,7 +74,8 @@ BuiltMap<EntityType, PrefStateSortField> _resortFields(
|
|||
BuiltMap<EntityType, PrefStateSortField> value,
|
||||
EntityType entityType,
|
||||
String field) {
|
||||
final sortField = value[entityType] ?? PrefStateSortField(field);
|
||||
final sortField =
|
||||
value[entityType] ?? PrefStateSortField(field, field != 'number');
|
||||
final directon = sortField.rebuild((b) => b
|
||||
..ascending = sortField.field != field || !sortField.ascending
|
||||
..field = field);
|
||||
|
|
|
|||
|
|
@ -131,10 +131,10 @@ abstract class PrefState implements Built<PrefState, PrefStateBuilder> {
|
|||
|
||||
abstract class PrefStateSortField
|
||||
implements Built<PrefStateSortField, PrefStateSortFieldBuilder> {
|
||||
factory PrefStateSortField(String field) {
|
||||
factory PrefStateSortField(String field, bool ascending) {
|
||||
return _$PrefStateSortField._(
|
||||
field: field ?? '',
|
||||
ascending: true,
|
||||
field: field,
|
||||
ascending: ascending,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import 'package:invoiceninja_flutter/redux/dashboard/dashboard_state.dart';
|
|||
import 'package:invoiceninja_flutter/redux/invoice/invoice_state.dart';
|
||||
import 'package:invoiceninja_flutter/redux/product/product_state.dart';
|
||||
import 'package:invoiceninja_flutter/redux/reports/reports_state.dart';
|
||||
import 'package:invoiceninja_flutter/redux/ui/pref_state.dart';
|
||||
import 'package:invoiceninja_flutter/ui/auth/login_vm.dart';
|
||||
import 'package:invoiceninja_flutter/redux/document/document_state.dart';
|
||||
import 'package:invoiceninja_flutter/redux/expense/expense_state.dart';
|
||||
|
|
@ -40,7 +41,10 @@ import 'package:invoiceninja_flutter/utils/strings.dart';
|
|||
part 'ui_state.g.dart';
|
||||
|
||||
abstract class UIState implements Built<UIState, UIStateBuilder> {
|
||||
factory UIState({String currentRoute}) {
|
||||
factory UIState({
|
||||
String currentRoute,
|
||||
BuiltMap<EntityType, PrefStateSortField> sortFields,
|
||||
}) {
|
||||
return _$UIState._(
|
||||
selectedCompanyIndex: 0,
|
||||
filterClearedAt: 0,
|
||||
|
|
@ -48,32 +52,37 @@ abstract class UIState implements Built<UIState, UIStateBuilder> {
|
|||
previousRoute: '',
|
||||
previewStack: BuiltList<EntityType>(),
|
||||
dashboardUIState: DashboardUIState(),
|
||||
productUIState: ProductUIState(),
|
||||
clientUIState: ClientUIState(),
|
||||
invoiceUIState: InvoiceUIState(),
|
||||
// STARTER: constructor - do not remove comment
|
||||
subscriptionUIState: SubscriptionUIState(),
|
||||
taskStatusUIState: TaskStatusUIState(),
|
||||
expenseCategoryUIState: ExpenseCategoryUIState(),
|
||||
recurringInvoiceUIState: RecurringInvoiceUIState(),
|
||||
webhookUIState: WebhookUIState(),
|
||||
tokenUIState: TokenUIState(),
|
||||
paymentTermUIState: PaymentTermUIState(),
|
||||
designUIState: DesignUIState(),
|
||||
creditUIState: CreditUIState(),
|
||||
userUIState: UserUIState(),
|
||||
taxRateUIState: TaxRateUIState(),
|
||||
companyGatewayUIState: CompanyGatewayUIState(),
|
||||
groupUIState: GroupUIState(),
|
||||
documentUIState: DocumentUIState(),
|
||||
expenseUIState: ExpenseUIState(),
|
||||
vendorUIState: VendorUIState(),
|
||||
taskUIState: TaskUIState(),
|
||||
projectUIState: ProjectUIState(),
|
||||
paymentUIState: PaymentUIState(),
|
||||
quoteUIState: QuoteUIState(),
|
||||
settingsUIState: SettingsUIState(),
|
||||
reportsUIState: ReportsUIState(),
|
||||
productUIState: ProductUIState(sortFields[EntityType.product]),
|
||||
clientUIState: ClientUIState(sortFields[EntityType.client]),
|
||||
invoiceUIState: InvoiceUIState(sortFields[EntityType.invoice]),
|
||||
subscriptionUIState:
|
||||
SubscriptionUIState(sortFields[EntityType.subscription]),
|
||||
taskStatusUIState: TaskStatusUIState(sortFields[EntityType.taskStatus]),
|
||||
expenseCategoryUIState:
|
||||
ExpenseCategoryUIState(sortFields[EntityType.expenseCategory]),
|
||||
recurringInvoiceUIState:
|
||||
RecurringInvoiceUIState(sortFields[EntityType.recurringInvoice]),
|
||||
webhookUIState: WebhookUIState(sortFields[EntityType.webhook]),
|
||||
tokenUIState: TokenUIState(sortFields[EntityType.token]),
|
||||
paymentTermUIState:
|
||||
PaymentTermUIState(sortFields[EntityType.paymentTerm]),
|
||||
designUIState: DesignUIState(sortFields[EntityType.design]),
|
||||
creditUIState: CreditUIState(sortFields[EntityType.credit]),
|
||||
userUIState: UserUIState(sortFields[EntityType.user]),
|
||||
taxRateUIState: TaxRateUIState(sortFields[EntityType.taxRate]),
|
||||
companyGatewayUIState:
|
||||
CompanyGatewayUIState(sortFields[EntityType.companyGateway]),
|
||||
groupUIState: GroupUIState(sortFields[EntityType.group]),
|
||||
documentUIState: DocumentUIState(sortFields[EntityType.document]),
|
||||
expenseUIState: ExpenseUIState(sortFields[EntityType.expense]),
|
||||
vendorUIState: VendorUIState(sortFields[EntityType.vendor]),
|
||||
taskUIState: TaskUIState(sortFields[EntityType.task]),
|
||||
projectUIState: ProjectUIState(sortFields[EntityType.project]),
|
||||
paymentUIState: PaymentUIState(sortFields[EntityType.payment]),
|
||||
quoteUIState: QuoteUIState(sortFields[EntityType.quote]),
|
||||
// STARTER: constructor - do not remove comment
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import 'package:invoiceninja_flutter/data/models/user_model.dart';
|
|||
import 'package:invoiceninja_flutter/redux/ui/entity_ui_state.dart';
|
||||
import 'package:invoiceninja_flutter/redux/ui/list_ui_state.dart';
|
||||
import 'package:invoiceninja_flutter/data/models/models.dart';
|
||||
import 'package:invoiceninja_flutter/redux/ui/pref_state.dart';
|
||||
|
||||
part 'user_state.g.dart';
|
||||
|
||||
|
|
@ -41,9 +42,10 @@ abstract class UserState implements Built<UserState, UserStateBuilder> {
|
|||
abstract class UserUIState extends Object
|
||||
with EntityUIState
|
||||
implements Built<UserUIState, UserUIStateBuilder> {
|
||||
factory UserUIState() {
|
||||
factory UserUIState(PrefStateSortField sortField) {
|
||||
return _$UserUIState._(
|
||||
listUIState: ListUIState(UserFields.firstName),
|
||||
listUIState: ListUIState(sortField.field ?? UserFields.firstName,
|
||||
sortAscending: sortField?.ascending),
|
||||
editing: UserEntity(),
|
||||
selectedId: '',
|
||||
tabIndex: 0,
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import 'package:invoiceninja_flutter/data/models/entities.dart';
|
|||
import 'package:invoiceninja_flutter/data/models/vendor_model.dart';
|
||||
import 'package:invoiceninja_flutter/redux/ui/entity_ui_state.dart';
|
||||
import 'package:invoiceninja_flutter/redux/ui/list_ui_state.dart';
|
||||
import 'package:invoiceninja_flutter/redux/ui/pref_state.dart';
|
||||
|
||||
part 'vendor_state.g.dart';
|
||||
|
||||
|
|
@ -54,9 +55,10 @@ abstract class VendorState implements Built<VendorState, VendorStateBuilder> {
|
|||
abstract class VendorUIState extends Object
|
||||
with EntityUIState
|
||||
implements Built<VendorUIState, VendorUIStateBuilder> {
|
||||
factory VendorUIState() {
|
||||
factory VendorUIState(PrefStateSortField sortField) {
|
||||
return _$VendorUIState._(
|
||||
listUIState: ListUIState(VendorFields.number, sortAscending: false),
|
||||
listUIState: ListUIState(sortField.field ?? VendorFields.name,
|
||||
sortAscending: sortField?.ascending),
|
||||
editing: VendorEntity(),
|
||||
editingContact: VendorContactEntity(),
|
||||
selectedId: '',
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import 'package:invoiceninja_flutter/data/models/webhook_model.dart';
|
|||
import 'package:invoiceninja_flutter/redux/ui/entity_ui_state.dart';
|
||||
import 'package:invoiceninja_flutter/redux/ui/list_ui_state.dart';
|
||||
import 'package:invoiceninja_flutter/data/models/models.dart';
|
||||
import 'package:invoiceninja_flutter/redux/ui/pref_state.dart';
|
||||
|
||||
part 'webhook_state.g.dart';
|
||||
|
||||
|
|
@ -46,9 +47,10 @@ abstract class WebhookState
|
|||
abstract class WebhookUIState extends Object
|
||||
with EntityUIState
|
||||
implements Built<WebhookUIState, WebhookUIStateBuilder> {
|
||||
factory WebhookUIState() {
|
||||
factory WebhookUIState(PrefStateSortField sortField) {
|
||||
return _$WebhookUIState._(
|
||||
listUIState: ListUIState(WebhookFields.targetUrl),
|
||||
listUIState: ListUIState(sortField.field ?? WebhookFields.targetUrl,
|
||||
sortAscending: sortField?.ascending),
|
||||
editing: WebhookEntity(),
|
||||
selectedId: '',
|
||||
tabIndex: 0,
|
||||
|
|
|
|||
|
|
@ -52,9 +52,9 @@ abstract class StubState implements Built<StubState, StubStateBuilder> {
|
|||
|
||||
abstract class StubUIState extends Object with EntityUIState implements Built<StubUIState, StubUIStateBuilder> {
|
||||
|
||||
factory StubUIState() {
|
||||
factory StubUIState(PrefStateSortField sortField) {
|
||||
return _$StubUIState._(
|
||||
listUIState: ListUIState(StubFields.name),
|
||||
listUIState: ListUIState(sortField?.field ?? StubFields.name, sortAscending: sortField?.ascending),
|
||||
editing: StubEntity(),
|
||||
selectedId: '',
|
||||
tabIndex: 0,
|
||||
|
|
|
|||
Loading…
Reference in New Issue