Fix for back button
This commit is contained in:
parent
530091c37b
commit
f3dbf0be58
|
|
@ -97,6 +97,12 @@ class SwitchListTableLayout implements PersistUI, PersistPrefs {}
|
|||
|
||||
class PopLastHistory implements PersistUI {}
|
||||
|
||||
class UpdateLastHistory implements PersistUI {
|
||||
const UpdateLastHistory(this.page);
|
||||
|
||||
final int page;
|
||||
}
|
||||
|
||||
class DismissNativeWarning implements PersistUI {}
|
||||
|
||||
class DismissNativeWarningPermanently implements PersistUI, PersistPrefs {}
|
||||
|
|
@ -329,6 +335,7 @@ void filterByEntity({
|
|||
void viewEntitiesByType({
|
||||
@required EntityType entityType,
|
||||
BaseEntity filterEntity,
|
||||
int page = 0,
|
||||
}) {
|
||||
final store = StoreProvider.of<AppState>(navigatorKey.currentContext);
|
||||
final uiState = store.state.uiState;
|
||||
|
|
@ -371,13 +378,13 @@ void viewEntitiesByType({
|
|||
);
|
||||
break;
|
||||
case EntityType.client:
|
||||
action = ViewClientList();
|
||||
action = ViewClientList(page: page);
|
||||
break;
|
||||
case EntityType.user:
|
||||
action = ViewUserList();
|
||||
break;
|
||||
case EntityType.project:
|
||||
action = ViewProjectList();
|
||||
action = ViewProjectList(page: page);
|
||||
break;
|
||||
case EntityType.taxRate:
|
||||
action = ViewTaxRateList();
|
||||
|
|
@ -386,25 +393,25 @@ void viewEntitiesByType({
|
|||
action = ViewCompanyGatewayList();
|
||||
break;
|
||||
case EntityType.invoice:
|
||||
action = ViewInvoiceList();
|
||||
action = ViewInvoiceList(page: page);
|
||||
break;
|
||||
case EntityType.quote:
|
||||
action = ViewQuoteList();
|
||||
action = ViewQuoteList(page: page);
|
||||
break;
|
||||
case EntityType.vendor:
|
||||
action = ViewVendorList();
|
||||
action = ViewVendorList(page: page);
|
||||
break;
|
||||
case EntityType.product:
|
||||
action = ViewProductList();
|
||||
action = ViewProductList(page: page);
|
||||
break;
|
||||
case EntityType.task:
|
||||
action = ViewTaskList();
|
||||
action = ViewTaskList(page: page);
|
||||
break;
|
||||
case EntityType.expense:
|
||||
action = ViewExpenseList();
|
||||
action = ViewExpenseList(page: page);
|
||||
break;
|
||||
case EntityType.payment:
|
||||
action = ViewPaymentList();
|
||||
action = ViewPaymentList(page: page);
|
||||
break;
|
||||
case EntityType.group:
|
||||
action = ViewGroupList();
|
||||
|
|
@ -416,20 +423,17 @@ void viewEntitiesByType({
|
|||
case EntityType.transactionRule:
|
||||
action = ViewTransactionRuleList();
|
||||
break;
|
||||
|
||||
case EntityType.transaction:
|
||||
action = ViewTransactionList();
|
||||
action = ViewTransactionList(page: page);
|
||||
break;
|
||||
|
||||
case EntityType.bankAccount:
|
||||
action = ViewBankAccountList();
|
||||
break;
|
||||
|
||||
case EntityType.purchaseOrder:
|
||||
action = ViewPurchaseOrderList();
|
||||
action = ViewPurchaseOrderList(page: page);
|
||||
break;
|
||||
case EntityType.recurringExpense:
|
||||
action = ViewRecurringExpenseList();
|
||||
action = ViewRecurringExpenseList(page: page);
|
||||
break;
|
||||
case EntityType.subscription:
|
||||
action = ViewSubscriptionList();
|
||||
|
|
@ -441,7 +445,7 @@ void viewEntitiesByType({
|
|||
action = ViewExpenseCategoryList();
|
||||
break;
|
||||
case EntityType.recurringInvoice:
|
||||
action = ViewRecurringInvoiceList();
|
||||
action = ViewRecurringInvoiceList(page: page);
|
||||
break;
|
||||
case EntityType.webhook:
|
||||
action = ViewWebhookList();
|
||||
|
|
@ -456,7 +460,7 @@ void viewEntitiesByType({
|
|||
action = ViewDesignList();
|
||||
break;
|
||||
case EntityType.credit:
|
||||
action = ViewCreditList();
|
||||
action = ViewCreditList(page: page);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,9 +26,11 @@ import 'package:invoiceninja_flutter/utils/localization.dart';
|
|||
class ViewClientList implements PersistUI {
|
||||
ViewClientList({
|
||||
this.force = false,
|
||||
this.page = 0,
|
||||
});
|
||||
|
||||
final bool force;
|
||||
final int page;
|
||||
}
|
||||
|
||||
class ViewClient implements PersistUI, PersistPrefs {
|
||||
|
|
|
|||
|
|
@ -29,9 +29,13 @@ import 'package:invoiceninja_flutter/data/web_client.dart';
|
|||
import 'package:printing/printing.dart';
|
||||
|
||||
class ViewCreditList implements PersistUI {
|
||||
ViewCreditList({this.force = false});
|
||||
ViewCreditList({
|
||||
this.force = false,
|
||||
this.page = 0,
|
||||
});
|
||||
|
||||
final bool force;
|
||||
final int page;
|
||||
}
|
||||
|
||||
class ViewCredit implements PersistUI, PersistPrefs {
|
||||
|
|
|
|||
|
|
@ -23,9 +23,13 @@ import 'package:invoiceninja_flutter/utils/dialogs.dart';
|
|||
import 'package:invoiceninja_flutter/utils/localization.dart';
|
||||
|
||||
class ViewExpenseList implements PersistUI {
|
||||
ViewExpenseList({this.force = false});
|
||||
ViewExpenseList({
|
||||
this.force = false,
|
||||
this.page = 0,
|
||||
});
|
||||
|
||||
final bool force;
|
||||
final int page;
|
||||
}
|
||||
|
||||
class ViewExpense implements PersistUI, PersistPrefs {
|
||||
|
|
|
|||
|
|
@ -31,9 +31,13 @@ import 'package:invoiceninja_flutter/data/web_client.dart';
|
|||
import 'package:printing/printing.dart';
|
||||
|
||||
class ViewInvoiceList implements PersistUI {
|
||||
ViewInvoiceList({this.force = false});
|
||||
ViewInvoiceList({
|
||||
this.force = false,
|
||||
this.page = 0,
|
||||
});
|
||||
|
||||
final bool force;
|
||||
final int page;
|
||||
}
|
||||
|
||||
class ViewInvoice implements PersistUI, PersistPrefs {
|
||||
|
|
|
|||
|
|
@ -18,9 +18,13 @@ import 'package:invoiceninja_flutter/utils/completers.dart';
|
|||
import 'package:invoiceninja_flutter/utils/localization.dart';
|
||||
|
||||
class ViewPaymentList implements PersistUI {
|
||||
ViewPaymentList({this.force = false});
|
||||
ViewPaymentList({
|
||||
this.force = false,
|
||||
this.page = 0,
|
||||
});
|
||||
|
||||
final bool force;
|
||||
final int page;
|
||||
}
|
||||
|
||||
class ViewPayment implements PersistUI, PersistPrefs {
|
||||
|
|
|
|||
|
|
@ -23,9 +23,13 @@ import 'package:invoiceninja_flutter/utils/localization.dart';
|
|||
import '../document/document_actions.dart';
|
||||
|
||||
class ViewProductList implements PersistUI {
|
||||
ViewProductList({this.force = false});
|
||||
ViewProductList({
|
||||
this.force = false,
|
||||
this.page = 0,
|
||||
});
|
||||
|
||||
final bool force;
|
||||
final int page;
|
||||
}
|
||||
|
||||
class ViewProduct implements PersistUI, PersistPrefs {
|
||||
|
|
|
|||
|
|
@ -22,9 +22,13 @@ import 'package:invoiceninja_flutter/utils/dialogs.dart';
|
|||
import 'package:invoiceninja_flutter/utils/localization.dart';
|
||||
|
||||
class ViewProjectList implements PersistUI {
|
||||
ViewProjectList({this.force = false});
|
||||
ViewProjectList({
|
||||
this.force = false,
|
||||
this.page = 0,
|
||||
});
|
||||
|
||||
final bool force;
|
||||
final int page;
|
||||
}
|
||||
|
||||
class ViewProject implements PersistUI, PersistPrefs {
|
||||
|
|
|
|||
|
|
@ -20,9 +20,13 @@ import 'package:printing/printing.dart';
|
|||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class ViewPurchaseOrderList implements PersistUI {
|
||||
ViewPurchaseOrderList({this.force = false});
|
||||
ViewPurchaseOrderList({
|
||||
this.force = false,
|
||||
this.page = 0,
|
||||
});
|
||||
|
||||
final bool force;
|
||||
final int page;
|
||||
}
|
||||
|
||||
class ViewPurchaseOrder implements PersistUI, PersistPrefs {
|
||||
|
|
|
|||
|
|
@ -29,9 +29,13 @@ import 'package:invoiceninja_flutter/data/web_client.dart';
|
|||
import 'package:printing/printing.dart';
|
||||
|
||||
class ViewQuoteList implements PersistUI {
|
||||
ViewQuoteList({this.force = false});
|
||||
ViewQuoteList({
|
||||
this.force = false,
|
||||
this.page = 0,
|
||||
});
|
||||
|
||||
final bool force;
|
||||
final int page;
|
||||
}
|
||||
|
||||
class ViewQuote implements PersistUI, PersistPrefs {
|
||||
|
|
|
|||
|
|
@ -22,9 +22,11 @@ import 'package:invoiceninja_flutter/utils/localization.dart';
|
|||
class ViewRecurringExpenseList implements PersistUI {
|
||||
ViewRecurringExpenseList({
|
||||
this.force = false,
|
||||
this.page = 0,
|
||||
});
|
||||
|
||||
final bool force;
|
||||
final int page;
|
||||
}
|
||||
|
||||
class ViewRecurringExpense implements PersistUI, PersistPrefs {
|
||||
|
|
|
|||
|
|
@ -27,9 +27,11 @@ import 'package:invoiceninja_flutter/utils/localization.dart';
|
|||
class ViewRecurringInvoiceList implements PersistUI {
|
||||
ViewRecurringInvoiceList({
|
||||
this.force = false,
|
||||
this.page = 0,
|
||||
});
|
||||
|
||||
final bool force;
|
||||
final int page;
|
||||
}
|
||||
|
||||
class ViewRecurringInvoice implements PersistUI, PersistPrefs {
|
||||
|
|
|
|||
|
|
@ -22,9 +22,10 @@ import 'package:invoiceninja_flutter/utils/formatting.dart';
|
|||
import 'package:invoiceninja_flutter/utils/localization.dart';
|
||||
|
||||
class ViewTaskList implements PersistUI {
|
||||
ViewTaskList({this.force = false});
|
||||
ViewTaskList({this.force = false, this.page = 0,});
|
||||
|
||||
final bool force;
|
||||
final int page;
|
||||
}
|
||||
|
||||
class ViewTask implements PersistUI, PersistPrefs {
|
||||
|
|
|
|||
|
|
@ -10,9 +10,13 @@ import 'package:invoiceninja_flutter/utils/localization.dart';
|
|||
import 'package:invoiceninja_flutter/ui/app/entities/entity_actions_dialog.dart';
|
||||
|
||||
class ViewTransactionList implements PersistUI {
|
||||
ViewTransactionList({this.force = false});
|
||||
ViewTransactionList({
|
||||
this.force = false,
|
||||
this.page = 0,
|
||||
});
|
||||
|
||||
final bool force;
|
||||
final int page;
|
||||
}
|
||||
|
||||
class ViewTransaction implements PersistUI, PersistPrefs {
|
||||
|
|
|
|||
|
|
@ -536,6 +536,18 @@ Reducer<BuiltList<HistoryRecord>> historyReducer = combineReducers([
|
|||
}
|
||||
},
|
||||
),
|
||||
TypedReducer<BuiltList<HistoryRecord>, UpdateLastHistory>(
|
||||
(historyList, action) {
|
||||
if (historyList.isEmpty) {
|
||||
return historyList;
|
||||
}
|
||||
|
||||
final history = historyList.first;
|
||||
|
||||
return historyList.rebuild(
|
||||
(b) => b..[0] = history.rebuild((b) => b.page = action.page));
|
||||
},
|
||||
),
|
||||
TypedReducer<BuiltList<HistoryRecord>, ViewDashboard>((historyList, action) =>
|
||||
_addToHistory(
|
||||
historyList, HistoryRecord(entityType: EntityType.dashboard))),
|
||||
|
|
@ -551,9 +563,9 @@ Reducer<BuiltList<HistoryRecord>> historyReducer = combineReducers([
|
|||
TypedReducer<BuiltList<HistoryRecord>, ViewClient>((historyList, action) =>
|
||||
_addToHistory(historyList,
|
||||
HistoryRecord(id: action.clientId, entityType: EntityType.client))),
|
||||
TypedReducer<BuiltList<HistoryRecord>, ViewClientList>((historyList,
|
||||
action) =>
|
||||
_addToHistory(historyList, HistoryRecord(entityType: EntityType.client))),
|
||||
TypedReducer<BuiltList<HistoryRecord>, ViewClientList>(
|
||||
(historyList, action) => _addToHistory(historyList,
|
||||
HistoryRecord(entityType: EntityType.client, page: action.page))),
|
||||
TypedReducer<BuiltList<HistoryRecord>, EditClient>((historyList, action) =>
|
||||
_addToHistory(historyList,
|
||||
HistoryRecord(id: action.client.id, entityType: EntityType.client))),
|
||||
|
|
@ -561,8 +573,8 @@ Reducer<BuiltList<HistoryRecord>> historyReducer = combineReducers([
|
|||
_addToHistory(historyList,
|
||||
HistoryRecord(id: action.productId, entityType: EntityType.product))),
|
||||
TypedReducer<BuiltList<HistoryRecord>, ViewProductList>(
|
||||
(historyList, action) => _addToHistory(
|
||||
historyList, HistoryRecord(entityType: EntityType.product))),
|
||||
(historyList, action) => _addToHistory(historyList,
|
||||
HistoryRecord(entityType: EntityType.product, page: action.page))),
|
||||
TypedReducer<BuiltList<HistoryRecord>, EditProduct>((historyList, action) =>
|
||||
_addToHistory(
|
||||
historyList,
|
||||
|
|
@ -572,8 +584,8 @@ Reducer<BuiltList<HistoryRecord>> historyReducer = combineReducers([
|
|||
_addToHistory(historyList,
|
||||
HistoryRecord(id: action.invoiceId, entityType: EntityType.invoice))),
|
||||
TypedReducer<BuiltList<HistoryRecord>, ViewInvoiceList>(
|
||||
(historyList, action) => _addToHistory(
|
||||
historyList, HistoryRecord(entityType: EntityType.invoice))),
|
||||
(historyList, action) => _addToHistory(historyList,
|
||||
HistoryRecord(entityType: EntityType.invoice, page: action.page))),
|
||||
TypedReducer<BuiltList<HistoryRecord>, EditInvoice>((historyList, action) =>
|
||||
_addToHistory(
|
||||
historyList,
|
||||
|
|
@ -583,8 +595,8 @@ Reducer<BuiltList<HistoryRecord>> historyReducer = combineReducers([
|
|||
_addToHistory(historyList,
|
||||
HistoryRecord(id: action.paymentId, entityType: EntityType.payment))),
|
||||
TypedReducer<BuiltList<HistoryRecord>, ViewPaymentList>(
|
||||
(historyList, action) => _addToHistory(
|
||||
historyList, HistoryRecord(entityType: EntityType.payment))),
|
||||
(historyList, action) => _addToHistory(historyList,
|
||||
HistoryRecord(entityType: EntityType.payment, page: action.page))),
|
||||
TypedReducer<BuiltList<HistoryRecord>, EditPayment>((historyList, action) =>
|
||||
_addToHistory(
|
||||
historyList,
|
||||
|
|
@ -594,7 +606,8 @@ Reducer<BuiltList<HistoryRecord>> historyReducer = combineReducers([
|
|||
_addToHistory(historyList,
|
||||
HistoryRecord(id: action.quoteId, entityType: EntityType.quote))),
|
||||
TypedReducer<BuiltList<HistoryRecord>, ViewQuoteList>((historyList, action) =>
|
||||
_addToHistory(historyList, HistoryRecord(entityType: EntityType.quote))),
|
||||
_addToHistory(historyList,
|
||||
HistoryRecord(entityType: EntityType.quote, page: action.page))),
|
||||
TypedReducer<BuiltList<HistoryRecord>, EditQuote>((historyList, action) =>
|
||||
_addToHistory(historyList,
|
||||
HistoryRecord(id: action.quote.id, entityType: EntityType.quote))),
|
||||
|
|
@ -602,7 +615,8 @@ Reducer<BuiltList<HistoryRecord>> historyReducer = combineReducers([
|
|||
_addToHistory(historyList,
|
||||
HistoryRecord(id: action.taskId, entityType: EntityType.task))),
|
||||
TypedReducer<BuiltList<HistoryRecord>, ViewTaskList>((historyList, action) =>
|
||||
_addToHistory(historyList, HistoryRecord(entityType: EntityType.task))),
|
||||
_addToHistory(historyList,
|
||||
HistoryRecord(entityType: EntityType.task, page: action.page))),
|
||||
TypedReducer<BuiltList<HistoryRecord>, EditTask>((historyList, action) =>
|
||||
_addToHistory(historyList,
|
||||
HistoryRecord(id: action.task.id, entityType: EntityType.task))),
|
||||
|
|
@ -610,8 +624,8 @@ Reducer<BuiltList<HistoryRecord>> historyReducer = combineReducers([
|
|||
_addToHistory(historyList,
|
||||
HistoryRecord(id: action.projectId, entityType: EntityType.project))),
|
||||
TypedReducer<BuiltList<HistoryRecord>, ViewProjectList>(
|
||||
(historyList, action) => _addToHistory(
|
||||
historyList, HistoryRecord(entityType: EntityType.project))),
|
||||
(historyList, action) => _addToHistory(historyList,
|
||||
HistoryRecord(entityType: EntityType.project, page: action.page))),
|
||||
TypedReducer<BuiltList<HistoryRecord>, EditProject>((historyList, action) =>
|
||||
_addToHistory(
|
||||
historyList,
|
||||
|
|
@ -620,9 +634,9 @@ Reducer<BuiltList<HistoryRecord>> historyReducer = combineReducers([
|
|||
TypedReducer<BuiltList<HistoryRecord>, ViewVendor>((historyList, action) =>
|
||||
_addToHistory(historyList,
|
||||
HistoryRecord(id: action.vendorId, entityType: EntityType.vendor))),
|
||||
TypedReducer<BuiltList<HistoryRecord>, ViewVendorList>((historyList,
|
||||
action) =>
|
||||
_addToHistory(historyList, HistoryRecord(entityType: EntityType.vendor))),
|
||||
TypedReducer<BuiltList<HistoryRecord>, ViewVendorList>(
|
||||
(historyList, action) => _addToHistory(historyList,
|
||||
HistoryRecord(entityType: EntityType.vendor, page: action.page))),
|
||||
TypedReducer<BuiltList<HistoryRecord>, EditVendor>((historyList, action) =>
|
||||
_addToHistory(historyList,
|
||||
HistoryRecord(id: action.vendor.id, entityType: EntityType.vendor))),
|
||||
|
|
@ -630,8 +644,8 @@ Reducer<BuiltList<HistoryRecord>> historyReducer = combineReducers([
|
|||
_addToHistory(historyList,
|
||||
HistoryRecord(id: action.expenseId, entityType: EntityType.expense))),
|
||||
TypedReducer<BuiltList<HistoryRecord>, ViewExpenseList>(
|
||||
(historyList, action) => _addToHistory(
|
||||
historyList, HistoryRecord(entityType: EntityType.expense))),
|
||||
(historyList, action) => _addToHistory(historyList,
|
||||
HistoryRecord(entityType: EntityType.expense, page: action.page))),
|
||||
TypedReducer<BuiltList<HistoryRecord>, EditExpense>((historyList, action) =>
|
||||
_addToHistory(
|
||||
historyList,
|
||||
|
|
@ -706,7 +720,9 @@ Reducer<BuiltList<HistoryRecord>> historyReducer = combineReducers([
|
|||
id: action.transactionId, entityType: EntityType.transaction))),
|
||||
TypedReducer<BuiltList<HistoryRecord>, ViewTransactionList>(
|
||||
(historyList, action) => _addToHistory(
|
||||
historyList, HistoryRecord(entityType: EntityType.transaction))),
|
||||
historyList,
|
||||
HistoryRecord(
|
||||
entityType: EntityType.transaction, page: action.page))),
|
||||
TypedReducer<BuiltList<HistoryRecord>, EditTransaction>(
|
||||
(historyList, action) => _addToHistory(
|
||||
historyList,
|
||||
|
|
@ -729,7 +745,9 @@ Reducer<BuiltList<HistoryRecord>> historyReducer = combineReducers([
|
|||
entityType: EntityType.purchaseOrder))),
|
||||
TypedReducer<BuiltList<HistoryRecord>, ViewPurchaseOrderList>(
|
||||
(historyList, action) => _addToHistory(
|
||||
historyList, HistoryRecord(entityType: EntityType.purchaseOrder))),
|
||||
historyList,
|
||||
HistoryRecord(
|
||||
entityType: EntityType.purchaseOrder, page: action.page))),
|
||||
TypedReducer<BuiltList<HistoryRecord>, EditPurchaseOrder>(
|
||||
(historyList, action) => _addToHistory(
|
||||
historyList,
|
||||
|
|
@ -744,7 +762,9 @@ Reducer<BuiltList<HistoryRecord>> historyReducer = combineReducers([
|
|||
entityType: EntityType.recurringExpense))),
|
||||
TypedReducer<BuiltList<HistoryRecord>, ViewRecurringExpenseList>(
|
||||
(historyList, action) => _addToHistory(
|
||||
historyList, HistoryRecord(entityType: EntityType.recurringExpense))),
|
||||
historyList,
|
||||
HistoryRecord(
|
||||
entityType: EntityType.recurringExpense, page: action.page))),
|
||||
TypedReducer<BuiltList<HistoryRecord>, EditRecurringExpense>(
|
||||
(historyList, action) => _addToHistory(
|
||||
historyList,
|
||||
|
|
@ -803,7 +823,9 @@ Reducer<BuiltList<HistoryRecord>> historyReducer = combineReducers([
|
|||
entityType: EntityType.recurringInvoice))),
|
||||
TypedReducer<BuiltList<HistoryRecord>, ViewRecurringInvoiceList>(
|
||||
(historyList, action) => _addToHistory(
|
||||
historyList, HistoryRecord(entityType: EntityType.recurringInvoice))),
|
||||
historyList,
|
||||
HistoryRecord(
|
||||
entityType: EntityType.recurringInvoice, page: action.page))),
|
||||
TypedReducer<BuiltList<HistoryRecord>, EditRecurringInvoice>(
|
||||
(historyList, action) => _addToHistory(
|
||||
historyList,
|
||||
|
|
@ -849,9 +871,9 @@ Reducer<BuiltList<HistoryRecord>> historyReducer = combineReducers([
|
|||
TypedReducer<BuiltList<HistoryRecord>, ViewCredit>((historyList, action) =>
|
||||
_addToHistory(historyList,
|
||||
HistoryRecord(id: action.creditId, entityType: EntityType.credit))),
|
||||
TypedReducer<BuiltList<HistoryRecord>, ViewCreditList>((historyList,
|
||||
action) =>
|
||||
_addToHistory(historyList, HistoryRecord(entityType: EntityType.credit))),
|
||||
TypedReducer<BuiltList<HistoryRecord>, ViewCreditList>(
|
||||
(historyList, action) => _addToHistory(historyList,
|
||||
HistoryRecord(entityType: EntityType.credit, page: action.page))),
|
||||
TypedReducer<BuiltList<HistoryRecord>, EditCredit>((historyList, action) =>
|
||||
_addToHistory(historyList,
|
||||
HistoryRecord(id: action.credit.id, entityType: EntityType.credit))),
|
||||
|
|
|
|||
|
|
@ -394,11 +394,13 @@ abstract class HistoryRecord
|
|||
factory HistoryRecord({
|
||||
@required EntityType entityType,
|
||||
String id,
|
||||
int page,
|
||||
}) {
|
||||
return _$HistoryRecord._(
|
||||
id: id,
|
||||
entityType: entityType,
|
||||
timestamp: DateTime.now().millisecondsSinceEpoch,
|
||||
page: page ?? 0,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -413,6 +415,9 @@ abstract class HistoryRecord
|
|||
|
||||
EntityType get entityType;
|
||||
|
||||
@nullable
|
||||
int get page;
|
||||
|
||||
int get timestamp;
|
||||
|
||||
DateTime get dateTime => DateTime.fromMillisecondsSinceEpoch(timestamp);
|
||||
|
|
|
|||
|
|
@ -620,6 +620,12 @@ class _$HistoryRecordSerializer implements StructuredSerializer<HistoryRecord> {
|
|||
..add(serializers.serialize(value,
|
||||
specifiedType: const FullType(String)));
|
||||
}
|
||||
value = object.page;
|
||||
if (value != null) {
|
||||
result
|
||||
..add('page')
|
||||
..add(serializers.serialize(value, specifiedType: const FullType(int)));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
@ -643,6 +649,10 @@ class _$HistoryRecordSerializer implements StructuredSerializer<HistoryRecord> {
|
|||
result.entityType = serializers.deserialize(value,
|
||||
specifiedType: const FullType(EntityType)) as EntityType;
|
||||
break;
|
||||
case 'page':
|
||||
result.page = serializers.deserialize(value,
|
||||
specifiedType: const FullType(int)) as int;
|
||||
break;
|
||||
case 'timestamp':
|
||||
result.timestamp = serializers.deserialize(value,
|
||||
specifiedType: const FullType(int)) as int;
|
||||
|
|
@ -1557,12 +1567,15 @@ class _$HistoryRecord extends HistoryRecord {
|
|||
@override
|
||||
final EntityType entityType;
|
||||
@override
|
||||
final int page;
|
||||
@override
|
||||
final int timestamp;
|
||||
|
||||
factory _$HistoryRecord([void Function(HistoryRecordBuilder) updates]) =>
|
||||
(new HistoryRecordBuilder()..update(updates))._build();
|
||||
|
||||
_$HistoryRecord._({this.id, this.entityType, this.timestamp}) : super._() {
|
||||
_$HistoryRecord._({this.id, this.entityType, this.page, this.timestamp})
|
||||
: super._() {
|
||||
BuiltValueNullFieldError.checkNotNull(
|
||||
entityType, r'HistoryRecord', 'entityType');
|
||||
BuiltValueNullFieldError.checkNotNull(
|
||||
|
|
@ -1582,6 +1595,7 @@ class _$HistoryRecord extends HistoryRecord {
|
|||
return other is HistoryRecord &&
|
||||
id == other.id &&
|
||||
entityType == other.entityType &&
|
||||
page == other.page &&
|
||||
timestamp == other.timestamp;
|
||||
}
|
||||
|
||||
|
|
@ -1592,6 +1606,7 @@ class _$HistoryRecord extends HistoryRecord {
|
|||
var _$hash = 0;
|
||||
_$hash = $jc(_$hash, id.hashCode);
|
||||
_$hash = $jc(_$hash, entityType.hashCode);
|
||||
_$hash = $jc(_$hash, page.hashCode);
|
||||
_$hash = $jc(_$hash, timestamp.hashCode);
|
||||
_$hash = $jf(_$hash);
|
||||
return __hashCode ??= _$hash;
|
||||
|
|
@ -1602,6 +1617,7 @@ class _$HistoryRecord extends HistoryRecord {
|
|||
return (newBuiltValueToStringHelper(r'HistoryRecord')
|
||||
..add('id', id)
|
||||
..add('entityType', entityType)
|
||||
..add('page', page)
|
||||
..add('timestamp', timestamp))
|
||||
.toString();
|
||||
}
|
||||
|
|
@ -1619,6 +1635,10 @@ class HistoryRecordBuilder
|
|||
EntityType get entityType => _$this._entityType;
|
||||
set entityType(EntityType entityType) => _$this._entityType = entityType;
|
||||
|
||||
int _page;
|
||||
int get page => _$this._page;
|
||||
set page(int page) => _$this._page = page;
|
||||
|
||||
int _timestamp;
|
||||
int get timestamp => _$this._timestamp;
|
||||
set timestamp(int timestamp) => _$this._timestamp = timestamp;
|
||||
|
|
@ -1630,6 +1650,7 @@ class HistoryRecordBuilder
|
|||
if ($v != null) {
|
||||
_id = $v.id;
|
||||
_entityType = $v.entityType;
|
||||
_page = $v.page;
|
||||
_timestamp = $v.timestamp;
|
||||
_$v = null;
|
||||
}
|
||||
|
|
@ -1656,6 +1677,7 @@ class HistoryRecordBuilder
|
|||
id: id,
|
||||
entityType: BuiltValueNullFieldError.checkNotNull(
|
||||
entityType, r'HistoryRecord', 'entityType'),
|
||||
page: page,
|
||||
timestamp: BuiltValueNullFieldError.checkNotNull(
|
||||
timestamp, r'HistoryRecord', 'timestamp'));
|
||||
replace(_$result);
|
||||
|
|
|
|||
|
|
@ -21,9 +21,13 @@ import 'package:invoiceninja_flutter/utils/localization.dart';
|
|||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class ViewVendorList implements PersistUI {
|
||||
ViewVendorList({this.force = false});
|
||||
ViewVendorList({
|
||||
this.force = false,
|
||||
this.page = 0,
|
||||
});
|
||||
|
||||
final bool force;
|
||||
final int page;
|
||||
}
|
||||
|
||||
class ViewVendor implements PersistUI, PersistPrefs {
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
import 'dart:async';
|
||||
|
||||
// Flutter imports:
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
// Package imports:
|
||||
|
|
@ -134,6 +135,10 @@ class _HistoryListTileState extends State<HistoryListTile> {
|
|||
}
|
||||
} else if (history.id == null) {
|
||||
title = Text(localization.lookup(history.entityType.plural));
|
||||
|
||||
if (!kReleaseMode) {
|
||||
subtitle = Text('Page: ${history.page}');
|
||||
}
|
||||
} else {
|
||||
entity = state.getEntityMap(history.entityType)[history.id] as BaseEntity;
|
||||
|
||||
|
|
|
|||
|
|
@ -314,7 +314,8 @@ class MainScreen extends StatelessWidget {
|
|||
break;
|
||||
default:
|
||||
if ((history.id ?? '').isEmpty) {
|
||||
viewEntitiesByType(entityType: history.entityType);
|
||||
viewEntitiesByType(
|
||||
entityType: history.entityType, page: history.page);
|
||||
} else {
|
||||
viewEntityById(
|
||||
entityId: history.id,
|
||||
|
|
|
|||
|
|
@ -134,8 +134,10 @@ class _MenuDrawerState extends State<MenuDrawer> {
|
|||
break;
|
||||
default:
|
||||
if ((history.id ?? '').isEmpty) {
|
||||
print('## PAGE: ${history.page}');
|
||||
viewEntitiesByType(
|
||||
entityType: history.entityType);
|
||||
entityType: history.entityType,
|
||||
page: history.page);
|
||||
} else {
|
||||
viewEntityById(
|
||||
entityId: history.id,
|
||||
|
|
|
|||
|
|
@ -88,11 +88,19 @@ class _EntityListState extends State<EntityList> {
|
|||
|
||||
// make sure the initial page shows the selected record
|
||||
final entityUIState = state.getUIState(entityType);
|
||||
final selectedIndex = widget.entityList.indexOf(entityUIState.selectedId);
|
||||
final rowsPerPage = state.prefState.rowsPerPage;
|
||||
|
||||
if (selectedIndex >= 0) {
|
||||
_firstRowIndex = (selectedIndex / rowsPerPage).floor() * rowsPerPage;
|
||||
if ((entityUIState.selectedId ?? '').isNotEmpty) {
|
||||
final selectedIndex = widget.entityList.indexOf(entityUIState.selectedId);
|
||||
|
||||
if (selectedIndex >= 0) {
|
||||
_firstRowIndex = (selectedIndex / rowsPerPage).floor() * rowsPerPage;
|
||||
}
|
||||
} else {
|
||||
final history = state.historyList.first;
|
||||
if (history.page != null) {
|
||||
_firstRowIndex = history.page * rowsPerPage;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -279,7 +287,11 @@ class _EntityListState extends State<EntityList> {
|
|||
: 0,
|
||||
sortAscending: listUIState.sortAscending,
|
||||
rowsPerPage: state.prefState.rowsPerPage,
|
||||
onPageChanged: (row) => _firstRowIndex = row,
|
||||
onPageChanged: (row) {
|
||||
_firstRowIndex = row;
|
||||
store.dispatch(UpdateLastHistory(
|
||||
(row / state.prefState.rowsPerPage).floor()));
|
||||
},
|
||||
initialFirstRowIndex: _firstRowIndex,
|
||||
availableRowsPerPage: [
|
||||
10,
|
||||
|
|
|
|||
|
|
@ -12,9 +12,11 @@ import 'package:invoiceninja_flutter/ui/app/entities/entity_actions_dialog.dart'
|
|||
class ViewStubList implements PersistUI {
|
||||
ViewStubList({
|
||||
this.force = false
|
||||
this.page = 0,
|
||||
});
|
||||
|
||||
final bool force;
|
||||
final int page;
|
||||
}
|
||||
|
||||
class ViewStub
|
||||
|
|
|
|||
Loading…
Reference in New Issue