Navigation refactor

This commit is contained in:
Hillel Coren 2020-06-16 14:33:51 +03:00
parent e3051480be
commit 893d3be1ca
53 changed files with 175 additions and 177 deletions

View File

@ -165,6 +165,7 @@ class AuthRepository {
return serializers.deserializeWith(LoginResponse.serializer, response); return serializers.deserializeWith(LoginResponse.serializer, response);
} }
String get _tokenName => String get _tokenName => kIsWeb
kIsWeb ? 'web_client' : Platform.isAndroid ? 'android_client' : 'ios_client'; ? 'web_client'
: Platform.isAndroid ? 'android_client' : 'ios_client';
} }

View File

@ -176,7 +176,7 @@ void _checkResponse(http.Response response) {
print('headers: ${response.headers}'); print('headers: ${response.headers}');
final version = response.headers['X-APP-VERSION']; final version = response.headers['X-APP-VERSION'];
/* /*
if (version == null) { if (version == null) {
throw 'Invalid version, please check v5 is installed on the server'; throw 'Invalid version, please check v5 is installed on the server';

View File

@ -50,6 +50,7 @@ final selectedIdReducer = combineReducers<String>([
return action.client.id; return action.client.id;
}), }),
TypedReducer<String, SelectCompany>((selectedId, action) => ''), TypedReducer<String, SelectCompany>((selectedId, action) => ''),
TypedReducer<String, ClearEntityFilter>((selectedId, action) => ''),
TypedReducer<String, FilterByEntity>((selectedId, action) => TypedReducer<String, FilterByEntity>((selectedId, action) =>
action.entityType == EntityType.client ? action.entityId : selectedId), action.entityType == EntityType.client ? action.entityId : selectedId),
]); ]);

View File

@ -22,6 +22,7 @@ Reducer<String> selectedIdReducer = combineReducers([
TypedReducer<String, AddCompanyGatewaySuccess>( TypedReducer<String, AddCompanyGatewaySuccess>(
(String selectedId, action) => action.companyGateway.id), (String selectedId, action) => action.companyGateway.id),
TypedReducer<String, SelectCompany>((selectedId, action) => ''), TypedReducer<String, SelectCompany>((selectedId, action) => ''),
TypedReducer<String, ClearEntityFilter>((selectedId, action) => ''),
]); ]);
final editingReducer = combineReducers<CompanyGatewayEntity>([ final editingReducer = combineReducers<CompanyGatewayEntity>([

View File

@ -38,6 +38,7 @@ Reducer<String> selectedIdReducer = combineReducers([
TypedReducer<String, ShowEmailCredit>( TypedReducer<String, ShowEmailCredit>(
(selectedId, action) => action.credit.id), (selectedId, action) => action.credit.id),
TypedReducer<String, SelectCompany>((selectedId, action) => ''), TypedReducer<String, SelectCompany>((selectedId, action) => ''),
TypedReducer<String, ClearEntityFilter>((selectedId, action) => ''),
]); ]);
final editingReducer = combineReducers<InvoiceEntity>([ final editingReducer = combineReducers<InvoiceEntity>([

View File

@ -21,6 +21,7 @@ Reducer<String> selectedIdReducer = combineReducers([
TypedReducer<String, AddDesignSuccess>( TypedReducer<String, AddDesignSuccess>(
(String selectedId, dynamic action) => action.design.id), (String selectedId, dynamic action) => action.design.id),
TypedReducer<String, SelectCompany>((selectedId, action) => ''), TypedReducer<String, SelectCompany>((selectedId, action) => ''),
TypedReducer<String, ClearEntityFilter>((selectedId, action) => ''),
]); ]);
final editingReducer = combineReducers<DesignEntity>([ final editingReducer = combineReducers<DesignEntity>([

View File

@ -20,6 +20,7 @@ Reducer<String> selectedIdReducer = combineReducers([
TypedReducer<String, AddDocumentSuccess>( TypedReducer<String, AddDocumentSuccess>(
(selectedId, action) => action.document.id), (selectedId, action) => action.document.id),
TypedReducer<String, SelectCompany>((selectedId, action) => ''), TypedReducer<String, SelectCompany>((selectedId, action) => ''),
TypedReducer<String, ClearEntityFilter>((selectedId, action) => ''),
]); ]);
final editingReducer = combineReducers<DocumentEntity>([ final editingReducer = combineReducers<DocumentEntity>([

View File

@ -20,6 +20,7 @@ Reducer<String> selectedIdReducer = combineReducers([
TypedReducer<String, AddExpenseSuccess>( TypedReducer<String, AddExpenseSuccess>(
(selectedId, action) => action.expense.id), (selectedId, action) => action.expense.id),
TypedReducer<String, SelectCompany>((selectedId, action) => ''), TypedReducer<String, SelectCompany>((selectedId, action) => ''),
TypedReducer<String, ClearEntityFilter>((selectedId, action) => ''),
]); ]);
final editingReducer = combineReducers<ExpenseEntity>([ final editingReducer = combineReducers<ExpenseEntity>([
@ -315,5 +316,5 @@ ExpenseState _setLoadedExpenses(
expenseState.loadExpenses(action.expenses); expenseState.loadExpenses(action.expenses);
ExpenseState _setLoadedCompany( ExpenseState _setLoadedCompany(
ExpenseState expenseState, LoadCompanySuccess action) => ExpenseState expenseState, LoadCompanySuccess action) =>
expenseState.loadExpenses(action.userCompany.company.expenses); expenseState.loadExpenses(action.userCompany.company.expenses);

View File

@ -22,6 +22,7 @@ Reducer<String> selectedIdReducer = combineReducers([
TypedReducer<String, AddGroupSuccess>( TypedReducer<String, AddGroupSuccess>(
(String selectedId, action) => action.group.id), (String selectedId, action) => action.group.id),
TypedReducer<String, SelectCompany>((selectedId, action) => ''), TypedReducer<String, SelectCompany>((selectedId, action) => ''),
TypedReducer<String, ClearEntityFilter>((selectedId, action) => ''),
TypedReducer<String, FilterByEntity>((selectedId, action) => TypedReducer<String, FilterByEntity>((selectedId, action) =>
action.entityType == EntityType.group ? action.entityId : selectedId), action.entityType == EntityType.group ? action.entityId : selectedId),
]); ]);

View File

@ -43,21 +43,23 @@ List<String> dropdownInvoiceSelector(
return list; return list;
} }
var memoizedFilteredInvoiceList = memo5( var memoizedFilteredInvoiceList = memo5((
(BuiltMap<String, InvoiceEntity> invoiceMap, BuiltMap<String, InvoiceEntity> invoiceMap,
BuiltList<String> invoiceList, BuiltList<String> invoiceList,
BuiltMap<String, ClientEntity> clientMap, BuiltMap<String, ClientEntity> clientMap,
BuiltMap<String, PaymentEntity> paymentMap, BuiltMap<String, PaymentEntity> paymentMap,
ListUIState invoiceListState,) => ListUIState invoiceListState,
filteredInvoicesSelector(invoiceMap, invoiceList, clientMap, paymentMap, ) =>
invoiceListState)); filteredInvoicesSelector(
invoiceMap, invoiceList, clientMap, paymentMap, invoiceListState));
List<String> filteredInvoicesSelector( List<String> filteredInvoicesSelector(
BuiltMap<String, InvoiceEntity> invoiceMap, BuiltMap<String, InvoiceEntity> invoiceMap,
BuiltList<String> invoiceList, BuiltList<String> invoiceList,
BuiltMap<String, ClientEntity> clientMap, BuiltMap<String, ClientEntity> clientMap,
BuiltMap<String, PaymentEntity> paymentMap, BuiltMap<String, PaymentEntity> paymentMap,
ListUIState invoiceListState,) { ListUIState invoiceListState,
) {
final Map<String, List<String>> invoicePaymentMap = {}; final Map<String, List<String>> invoicePaymentMap = {};
if (invoiceListState.filterEntityType == EntityType.payment) { if (invoiceListState.filterEntityType == EntityType.payment) {

View File

@ -20,6 +20,7 @@ Reducer<String> selectedIdReducer = combineReducers([
TypedReducer<String, AddPaymentSuccess>( TypedReducer<String, AddPaymentSuccess>(
(selectedId, action) => action.payment.id), (selectedId, action) => action.payment.id),
TypedReducer<String, SelectCompany>((selectedId, action) => ''), TypedReducer<String, SelectCompany>((selectedId, action) => ''),
TypedReducer<String, ClearEntityFilter>((selectedId, action) => ''),
TypedReducer<String, FilterByEntity>((selectedId, action) => TypedReducer<String, FilterByEntity>((selectedId, action) =>
action.entityType == EntityType.payment ? action.entityId : selectedId), action.entityType == EntityType.payment ? action.entityId : selectedId),
]); ]);

View File

@ -21,6 +21,7 @@ Reducer<String> selectedIdReducer = combineReducers([
TypedReducer<String, AddPaymentTermSuccess>( TypedReducer<String, AddPaymentTermSuccess>(
(String selectedId, dynamic action) => action.paymentTerm.id), (String selectedId, dynamic action) => action.paymentTerm.id),
TypedReducer<String, SelectCompany>((selectedId, action) => ''), TypedReducer<String, SelectCompany>((selectedId, action) => ''),
TypedReducer<String, ClearEntityFilter>((selectedId, action) => ''),
]); ]);
final editingReducer = combineReducers<PaymentTermEntity>([ final editingReducer = combineReducers<PaymentTermEntity>([
@ -64,8 +65,7 @@ final paymentTermListReducer = combineReducers<ListUIState>([
_filterPaymentTermsByCustom1), _filterPaymentTermsByCustom1),
TypedReducer<ListUIState, FilterPaymentTermsByCustom2>( TypedReducer<ListUIState, FilterPaymentTermsByCustom2>(
_filterPaymentTermsByCustom2), _filterPaymentTermsByCustom2),
TypedReducer<ListUIState, FilterByEntity>( TypedReducer<ListUIState, FilterByEntity>(_filterPaymentTermsByClient),
_filterPaymentTermsByClient),
TypedReducer<ListUIState, StartPaymentTermMultiselect>(_startListMultiselect), TypedReducer<ListUIState, StartPaymentTermMultiselect>(_startListMultiselect),
TypedReducer<ListUIState, AddToPaymentTermMultiselect>(_addToListMultiselect), TypedReducer<ListUIState, AddToPaymentTermMultiselect>(_addToListMultiselect),
TypedReducer<ListUIState, RemoveFromPaymentTermMultiselect>( TypedReducer<ListUIState, RemoveFromPaymentTermMultiselect>(

View File

@ -57,6 +57,7 @@ Reducer<String> selectedIdReducer = combineReducers([
TypedReducer<String, AddProductSuccess>( TypedReducer<String, AddProductSuccess>(
(selectedId, action) => action.product.id), (selectedId, action) => action.product.id),
TypedReducer<String, SelectCompany>((selectedId, action) => ''), TypedReducer<String, SelectCompany>((selectedId, action) => ''),
TypedReducer<String, ClearEntityFilter>((selectedId, action) => ''),
]); ]);
final productListReducer = combineReducers<ListUIState>([ final productListReducer = combineReducers<ListUIState>([

View File

@ -36,6 +36,7 @@ Reducer<String> selectedIdReducer = combineReducers([
TypedReducer<String, AddProjectSuccess>( TypedReducer<String, AddProjectSuccess>(
(selectedId, action) => action.project.id), (selectedId, action) => action.project.id),
TypedReducer<String, SelectCompany>((selectedId, action) => ''), TypedReducer<String, SelectCompany>((selectedId, action) => ''),
TypedReducer<String, ClearEntityFilter>((selectedId, action) => ''),
]); ]);
final editingReducer = combineReducers<ProjectEntity>([ final editingReducer = combineReducers<ProjectEntity>([

View File

@ -37,6 +37,7 @@ Reducer<String> selectedIdReducer = combineReducers([
(selectedId, action) => action.quote.id), (selectedId, action) => action.quote.id),
TypedReducer<String, ShowEmailQuote>((selectedId, action) => action.quote.id), TypedReducer<String, ShowEmailQuote>((selectedId, action) => action.quote.id),
TypedReducer<String, SelectCompany>((selectedId, action) => ''), TypedReducer<String, SelectCompany>((selectedId, action) => ''),
TypedReducer<String, ClearEntityFilter>((selectedId, action) => ''),
]); ]);
final editingReducer = combineReducers<InvoiceEntity>([ final editingReducer = combineReducers<InvoiceEntity>([

View File

@ -29,6 +29,7 @@ Reducer<String> selectedIdReducer = combineReducers([
TypedReducer<String, ViewTask>((selectedId, action) => action.taskId), TypedReducer<String, ViewTask>((selectedId, action) => action.taskId),
TypedReducer<String, AddTaskSuccess>((selectedId, action) => action.task.id), TypedReducer<String, AddTaskSuccess>((selectedId, action) => action.task.id),
TypedReducer<String, SelectCompany>((selectedId, action) => ''), TypedReducer<String, SelectCompany>((selectedId, action) => ''),
TypedReducer<String, ClearEntityFilter>((selectedId, action) => ''),
]); ]);
final editingReducer = combineReducers<TaskEntity>([ final editingReducer = combineReducers<TaskEntity>([
@ -296,6 +297,5 @@ TaskState _setLoadedTask(TaskState taskState, LoadTaskSuccess action) {
TaskState _setLoadedTasks(TaskState taskState, LoadTasksSuccess action) => TaskState _setLoadedTasks(TaskState taskState, LoadTasksSuccess action) =>
taskState.loadTasks(action.tasks); taskState.loadTasks(action.tasks);
TaskState _setLoadedCompany( TaskState _setLoadedCompany(TaskState taskState, LoadCompanySuccess action) =>
TaskState taskState, LoadCompanySuccess action) =>
taskState.loadTasks(action.userCompany.company.tasks); taskState.loadTasks(action.userCompany.company.tasks);

View File

@ -21,6 +21,7 @@ Reducer<String> selectedIdReducer = combineReducers([
TypedReducer<String, AddTaxRateSuccess>( TypedReducer<String, AddTaxRateSuccess>(
(String selectedId, action) => action.taxRate.id), (String selectedId, action) => action.taxRate.id),
TypedReducer<String, SelectCompany>((selectedId, action) => ''), TypedReducer<String, SelectCompany>((selectedId, action) => ''),
TypedReducer<String, ClearEntityFilter>((selectedId, action) => ''),
]); ]);
final editingReducer = combineReducers<TaxRateEntity>([ final editingReducer = combineReducers<TaxRateEntity>([

View File

@ -21,14 +21,10 @@ import 'package:invoiceninja_flutter/redux/project/project_reducer.dart';
import 'package:invoiceninja_flutter/redux/quote/quote_reducer.dart'; import 'package:invoiceninja_flutter/redux/quote/quote_reducer.dart';
import 'package:invoiceninja_flutter/redux/task/task_reducer.dart'; import 'package:invoiceninja_flutter/redux/task/task_reducer.dart';
import 'package:invoiceninja_flutter/redux/vendor/vendor_reducer.dart'; import 'package:invoiceninja_flutter/redux/vendor/vendor_reducer.dart';
// STARTER: import - do not remove comment // STARTER: import - do not remove comment
import 'package:invoiceninja_flutter/redux/payment_term/payment_term_reducer.dart'; import 'package:invoiceninja_flutter/redux/payment_term/payment_term_reducer.dart';
import 'package:invoiceninja_flutter/redux/design/design_reducer.dart'; import 'package:invoiceninja_flutter/redux/design/design_reducer.dart';
import 'package:invoiceninja_flutter/redux/credit/credit_reducer.dart'; import 'package:invoiceninja_flutter/redux/credit/credit_reducer.dart';
import 'package:invoiceninja_flutter/redux/user/user_reducer.dart'; import 'package:invoiceninja_flutter/redux/user/user_reducer.dart';
import 'package:invoiceninja_flutter/redux/tax_rate/tax_rate_reducer.dart'; import 'package:invoiceninja_flutter/redux/tax_rate/tax_rate_reducer.dart';
import 'package:invoiceninja_flutter/redux/company_gateway/company_gateway_reducer.dart'; import 'package:invoiceninja_flutter/redux/company_gateway/company_gateway_reducer.dart';

View File

@ -20,6 +20,7 @@ Reducer<String> selectedIdReducer = combineReducers([
TypedReducer<String, AddUserSuccess>( TypedReducer<String, AddUserSuccess>(
(String selectedId, action) => action.user.id), (String selectedId, action) => action.user.id),
TypedReducer<String, SelectCompany>((selectedId, action) => ''), TypedReducer<String, SelectCompany>((selectedId, action) => ''),
TypedReducer<String, ClearEntityFilter>((selectedId, action) => ''),
TypedReducer<String, FilterByEntity>((selectedId, action) => TypedReducer<String, FilterByEntity>((selectedId, action) =>
action.entityType == EntityType.user ? action.entityId : selectedId), action.entityType == EntityType.user ? action.entityId : selectedId),
]); ]);

View File

@ -48,6 +48,7 @@ Reducer<String> selectedIdReducer = combineReducers([
TypedReducer<String, AddVendorSuccess>( TypedReducer<String, AddVendorSuccess>(
(selectedId, action) => action.vendor.id), (selectedId, action) => action.vendor.id),
TypedReducer<String, SelectCompany>((selectedId, action) => ''), TypedReducer<String, SelectCompany>((selectedId, action) => ''),
TypedReducer<String, ClearEntityFilter>((selectedId, action) => ''),
]); ]);
final editingReducer = combineReducers<VendorEntity>([ final editingReducer = combineReducers<VendorEntity>([

View File

@ -83,7 +83,6 @@ class ViewActionMenuButton extends StatelessWidget {
entity: entity, entity: entity,
onSelected: onSelected, onSelected: onSelected,
isSaving: isSaving, isSaving: isSaving,
entityActions: entityActions entityActions: entityActions);
);
} }
} }

View File

@ -42,7 +42,8 @@ class ActivityListTile extends StatelessWidget {
onTap: !enableNavigation onTap: !enableNavigation
? null ? null
: () { : () {
print('## ON TAP: ${activity.entityType} - ${activity.invoiceId}'); print(
'## ON TAP: ${activity.entityType} - ${activity.invoiceId}');
switch (activity.entityType) { switch (activity.entityType) {
case EntityType.task: case EntityType.task:
viewEntityById( viewEntityById(

View File

@ -81,8 +81,7 @@ class CompanyGatewayListVM {
isLoading: state.isLoading, isLoading: state.isLoading,
isLoaded: state.companyGatewayState.isLoaded, isLoaded: state.companyGatewayState.isLoaded,
filter: state.companyGatewayUIState.listUIState.filter, filter: state.companyGatewayUIState.listUIState.filter,
onClearEntityFilterPressed: () => onClearEntityFilterPressed: () => store.dispatch(ClearEntityFilter()),
store.dispatch(ClearEntityFilter()),
onViewEntityFilterPressed: (BuildContext context) => viewEntityById( onViewEntityFilterPressed: (BuildContext context) => viewEntityById(
context: context, context: context,
entityId: state.companyGatewayListState.filterEntityId, entityId: state.companyGatewayListState.filterEntityId,

View File

@ -225,7 +225,9 @@ class CreditListItem extends StatelessWidget {
localization localization
.lookup(kCreditStatuses[credit.statusId]), .lookup(kCreditStatuses[credit.statusId]),
style: TextStyle( style: TextStyle(
color: !credit.isSent ? textColor : CreditStatusColors.colors[credit.statusId], color: !credit.isSent
? textColor
: CreditStatusColors.colors[credit.statusId],
)), )),
], ],
), ),

View File

@ -124,22 +124,22 @@ class CreditScreen extends StatelessWidget {
onSelectedCustom4: (value) => onSelectedCustom4: (value) =>
store.dispatch(FilterCreditsByCustom4(value)), store.dispatch(FilterCreditsByCustom4(value)),
), ),
floatingActionButton: floatingActionButton: state.prefState.isMenuFloated &&
state.prefState.isMenuFloated && userCompany.canCreate(EntityType.credit) userCompany.canCreate(EntityType.credit)
? FloatingActionButton( ? FloatingActionButton(
heroTag: 'credit_fab', heroTag: 'credit_fab',
backgroundColor: Theme.of(context).primaryColorDark, backgroundColor: Theme.of(context).primaryColorDark,
onPressed: () { onPressed: () {
createEntityByType( createEntityByType(
context: context, entityType: EntityType.credit); context: context, entityType: EntityType.credit);
}, },
child: Icon( child: Icon(
Icons.add, Icons.add,
color: Colors.white, color: Colors.white,
), ),
tooltip: localization.newCredit, tooltip: localization.newCredit,
) )
: null, : null,
); );
} }
} }

View File

@ -3,11 +3,8 @@ import 'package:invoiceninja_flutter/data/models/models.dart';
import 'package:invoiceninja_flutter/ui/app/presenters/entity_presenter.dart'; import 'package:invoiceninja_flutter/ui/app/presenters/entity_presenter.dart';
class DesignPresenter extends EntityPresenter { class DesignPresenter extends EntityPresenter {
static List<String> getDefaultTableFields(UserCompanyEntity userCompany) { static List<String> getDefaultTableFields(UserCompanyEntity userCompany) {
return [ return [];
];
} }
static List<String> getAllTableFields(UserCompanyEntity userCompany) { static List<String> getAllTableFields(UserCompanyEntity userCompany) {

View File

@ -119,8 +119,7 @@ class DocumentListVM {
isLoading: state.isLoading, isLoading: state.isLoading,
isLoaded: state.documentState.isLoaded, isLoaded: state.documentState.isLoaded,
filter: state.documentUIState.listUIState.filter, filter: state.documentUIState.listUIState.filter,
onClearEntityFilterPressed: () => onClearEntityFilterPressed: () => store.dispatch(FilterByEntity()),
store.dispatch(FilterByEntity()),
onViewEntityFilterPressed: (BuildContext context) => viewEntityById( onViewEntityFilterPressed: (BuildContext context) => viewEntityById(
context: context, context: context,
entityId: state.documentListState.filterEntityId, entityId: state.documentListState.filterEntityId,

View File

@ -110,22 +110,22 @@ class DocumentScreen extends StatelessWidget {
} }
}, },
), ),
floatingActionButton: floatingActionButton: state.prefState.isMenuFloated &&
state.prefState.isMenuFloated && userCompany.canCreate(EntityType.document) userCompany.canCreate(EntityType.document)
? FloatingActionButton( ? FloatingActionButton(
heroTag: 'document_fab', heroTag: 'document_fab',
backgroundColor: Theme.of(context).primaryColorDark, backgroundColor: Theme.of(context).primaryColorDark,
onPressed: () { onPressed: () {
createEntityByType( createEntityByType(
context: context, entityType: EntityType.document); context: context, entityType: EntityType.document);
}, },
child: Icon( child: Icon(
Icons.add, Icons.add,
color: Colors.white, color: Colors.white,
), ),
tooltip: localization.newDocument, tooltip: localization.newDocument,
) )
: null, : null,
); );
} }
} }

View File

@ -135,8 +135,7 @@ class ExpenseListVM {
isLoading: state.isLoading, isLoading: state.isLoading,
isLoaded: state.expenseState.isLoaded, isLoaded: state.expenseState.isLoaded,
filter: state.expenseUIState.listUIState.filter, filter: state.expenseUIState.listUIState.filter,
onClearEntityFilterPressed: () => onClearEntityFilterPressed: () => store.dispatch(FilterByEntity()),
store.dispatch(FilterByEntity()),
onViewEntityFilterPressed: (BuildContext context) => viewEntityById( onViewEntityFilterPressed: (BuildContext context) => viewEntityById(
context: context, context: context,
entityId: state.expenseListState.filterEntityId, entityId: state.expenseListState.filterEntityId,

View File

@ -6,7 +6,6 @@ import 'package:invoiceninja_flutter/ui/app/presenters/entity_presenter.dart';
import 'package:invoiceninja_flutter/utils/formatting.dart'; import 'package:invoiceninja_flutter/utils/formatting.dart';
class ExpensePresenter extends EntityPresenter { class ExpensePresenter extends EntityPresenter {
static List<String> getDefaultTableFields(UserCompanyEntity userCompany) { static List<String> getDefaultTableFields(UserCompanyEntity userCompany) {
return [ return [
ExpenseFields.vendor, ExpenseFields.vendor,

View File

@ -88,7 +88,8 @@ class ExpenseScreen extends StatelessWidget {
bottomNavigationBar: AppBottomBar( bottomNavigationBar: AppBottomBar(
entityType: EntityType.expense, entityType: EntityType.expense,
tableColumns: ExpensePresenter.getAllTableFields(userCompany), tableColumns: ExpensePresenter.getAllTableFields(userCompany),
defaultTableColumns: ExpensePresenter.getDefaultTableFields(userCompany), defaultTableColumns:
ExpensePresenter.getDefaultTableFields(userCompany),
onRefreshPressed: () => store.dispatch(LoadExpenses(force: true)), onRefreshPressed: () => store.dispatch(LoadExpenses(force: true)),
onSelectedSortField: (value) => store.dispatch(SortExpenses(value)), onSelectedSortField: (value) => store.dispatch(SortExpenses(value)),
customValues1: company.getCustomFieldValues(CustomFieldType.expense1, customValues1: company.getCustomFieldValues(CustomFieldType.expense1,

View File

@ -82,7 +82,6 @@ class InvoiceEditItemsVM extends EntityEditItemsVM {
); );
factory InvoiceEditItemsVM.fromStore(Store<AppState> store) { factory InvoiceEditItemsVM.fromStore(Store<AppState> store) {
return InvoiceEditItemsVM( return InvoiceEditItemsVM(
state: store.state, state: store.state,
company: store.state.company, company: store.state.company,

View File

@ -248,7 +248,8 @@ class InvoiceListItem extends StatelessWidget {
), ),
Text(statusLabel, Text(statusLabel,
style: TextStyle( style: TextStyle(
color: !invoice.isSent ? textColor : statusColor, color:
!invoice.isSent ? textColor : statusColor,
)), )),
], ],
), ),

View File

@ -186,11 +186,11 @@ class InvoiceListVM extends EntityListVM {
user: state.user, user: state.user,
listState: state.invoiceListState, listState: state.invoiceListState,
invoiceList: memoizedFilteredInvoiceList( invoiceList: memoizedFilteredInvoiceList(
state.invoiceState.map, state.invoiceState.map,
state.invoiceState.list, state.invoiceState.list,
state.clientState.map, state.clientState.map,
state.paymentState.map, state.paymentState.map,
state.invoiceListState, state.invoiceListState,
), ),
invoiceMap: state.invoiceState.map, invoiceMap: state.invoiceState.map,
clientMap: state.clientState.map, clientMap: state.clientState.map,
@ -206,8 +206,7 @@ class InvoiceListVM extends EntityListVM {
} }
}, },
onRefreshed: (context) => _handleRefresh(context), onRefreshed: (context) => _handleRefresh(context),
onClearEntityFilterPressed: () => onClearEntityFilterPressed: () => store.dispatch(FilterByEntity()),
store.dispatch(FilterByEntity()),
onViewEntityFilterPressed: (BuildContext context) => viewEntityById( onViewEntityFilterPressed: (BuildContext context) => viewEntityById(
context: context, context: context,
entityId: state.invoiceListState.filterEntityId, entityId: state.invoiceListState.filterEntityId,

View File

@ -88,7 +88,8 @@ class InvoiceScreen extends StatelessWidget {
bottomNavigationBar: AppBottomBar( bottomNavigationBar: AppBottomBar(
entityType: EntityType.invoice, entityType: EntityType.invoice,
tableColumns: InvoicePresenter.getAllTableFields(userCompany), tableColumns: InvoicePresenter.getAllTableFields(userCompany),
defaultTableColumns: InvoicePresenter.getDefaultTableFields(userCompany), defaultTableColumns:
InvoicePresenter.getDefaultTableFields(userCompany),
onRefreshPressed: () => store.dispatch(LoadInvoices(force: true)), onRefreshPressed: () => store.dispatch(LoadInvoices(force: true)),
onSelectedSortField: (value) { onSelectedSortField: (value) {
store.dispatch(SortInvoices(value)); store.dispatch(SortInvoices(value));

View File

@ -139,8 +139,7 @@ class PaymentListVM {
viewEntity(context: context, entity: payment); viewEntity(context: context, entity: payment);
} }
}, },
onClearEntityFilterPressed: () => onClearEntityFilterPressed: () => store.dispatch(FilterByEntity()),
store.dispatch(FilterByEntity()),
onViewEntityFilterPressed: (BuildContext context) => viewEntityById( onViewEntityFilterPressed: (BuildContext context) => viewEntityById(
context: context, context: context,
entityId: state.paymentListState.filterEntityId, entityId: state.paymentListState.filterEntityId,

View File

@ -84,7 +84,8 @@ class PaymentScreen extends StatelessWidget {
bottomNavigationBar: AppBottomBar( bottomNavigationBar: AppBottomBar(
entityType: EntityType.payment, entityType: EntityType.payment,
tableColumns: PaymentPresenter.getAllTableFields(userCompany), tableColumns: PaymentPresenter.getAllTableFields(userCompany),
defaultTableColumns: PaymentPresenter.getDefaultTableFields(userCompany), defaultTableColumns:
PaymentPresenter.getDefaultTableFields(userCompany),
onRefreshPressed: () => store.dispatch(LoadPayments(force: true)), onRefreshPressed: () => store.dispatch(LoadPayments(force: true)),
onSelectedSortField: (value) => store.dispatch(SortPayments(value)), onSelectedSortField: (value) => store.dispatch(SortPayments(value)),
customValues1: company.getCustomFieldValues(CustomFieldType.payment1, customValues1: company.getCustomFieldValues(CustomFieldType.payment1,

View File

@ -125,8 +125,7 @@ class PaymentTermListVM {
isLoading: state.isLoading, isLoading: state.isLoading,
isLoaded: state.paymentTermState.isLoaded, isLoaded: state.paymentTermState.isLoaded,
filter: state.paymentTermUIState.listUIState.filter, filter: state.paymentTermUIState.listUIState.filter,
onClearEntityFilterPressed: () => onClearEntityFilterPressed: () => store.dispatch(FilterByEntity()),
store.dispatch(FilterByEntity()),
onViewEntityFilterPressed: (BuildContext context) => viewEntityById( onViewEntityFilterPressed: (BuildContext context) => viewEntityById(
context: context, context: context,
entityId: state.paymentTermListState.filterEntityId, entityId: state.paymentTermListState.filterEntityId,

View File

@ -3,11 +3,8 @@ import 'package:invoiceninja_flutter/data/models/models.dart';
import 'package:invoiceninja_flutter/ui/app/presenters/entity_presenter.dart'; import 'package:invoiceninja_flutter/ui/app/presenters/entity_presenter.dart';
class PaymentTermPresenter extends EntityPresenter { class PaymentTermPresenter extends EntityPresenter {
static List<String> getDefaultTableFields(UserCompanyEntity userCompany) { static List<String> getDefaultTableFields(UserCompanyEntity userCompany) {
return [ return [];
];
} }
static List<String> getAllTableFields(UserCompanyEntity userCompany) { static List<String> getAllTableFields(UserCompanyEntity userCompany) {

View File

@ -84,7 +84,8 @@ class ProductScreen extends StatelessWidget {
bottomNavigationBar: AppBottomBar( bottomNavigationBar: AppBottomBar(
entityType: EntityType.product, entityType: EntityType.product,
tableColumns: ProductPresenter.getAllTableFields(userCompany), tableColumns: ProductPresenter.getAllTableFields(userCompany),
defaultTableColumns: ProductPresenter.getDefaultTableFields(userCompany), defaultTableColumns:
ProductPresenter.getDefaultTableFields(userCompany),
onRefreshPressed: () => store.dispatch(LoadProducts(force: true)), onRefreshPressed: () => store.dispatch(LoadProducts(force: true)),
onSelectedSortField: (value) => store.dispatch(SortProducts(value)), onSelectedSortField: (value) => store.dispatch(SortProducts(value)),
customValues1: company.getCustomFieldValues(CustomFieldType.product1, customValues1: company.getCustomFieldValues(CustomFieldType.product1,
@ -119,22 +120,22 @@ class ProductScreen extends StatelessWidget {
} }
}, },
), ),
floatingActionButton: floatingActionButton: state.prefState.isMenuFloated &&
state.prefState.isMenuFloated && userCompany.canCreate(EntityType.product) userCompany.canCreate(EntityType.product)
? FloatingActionButton( ? FloatingActionButton(
heroTag: 'product_fab', heroTag: 'product_fab',
backgroundColor: Theme.of(context).primaryColorDark, backgroundColor: Theme.of(context).primaryColorDark,
onPressed: () { onPressed: () {
createEntityByType( createEntityByType(
context: context, entityType: EntityType.product); context: context, entityType: EntityType.product);
}, },
child: Icon( child: Icon(
Icons.add, Icons.add,
color: Colors.white, color: Colors.white,
), ),
tooltip: localization.newProduct, tooltip: localization.newProduct,
) )
: null, : null,
); );
} }
} }

View File

@ -129,8 +129,7 @@ class ProjectListVM {
isLoading: state.isLoading, isLoading: state.isLoading,
isLoaded: state.projectState.isLoaded, isLoaded: state.projectState.isLoaded,
filter: state.projectUIState.listUIState.filter, filter: state.projectUIState.listUIState.filter,
onClearEntityFilterPressed: () => onClearEntityFilterPressed: () => store.dispatch(ClearEntityFilter()),
store.dispatch(ClearEntityFilter()),
onViewEntityFilterPressed: (BuildContext context) => viewEntityById( onViewEntityFilterPressed: (BuildContext context) => viewEntityById(
context: context, context: context,
entityId: state.projectListState.filterEntityId, entityId: state.projectListState.filterEntityId,

View File

@ -6,7 +6,6 @@ import 'package:invoiceninja_flutter/ui/app/presenters/entity_presenter.dart';
import 'package:invoiceninja_flutter/utils/formatting.dart'; import 'package:invoiceninja_flutter/utils/formatting.dart';
class ProjectPresenter extends EntityPresenter { class ProjectPresenter extends EntityPresenter {
static List<String> getDefaultTableFields(UserCompanyEntity userCompany) { static List<String> getDefaultTableFields(UserCompanyEntity userCompany) {
return [ return [
ProjectFields.name, ProjectFields.name,

View File

@ -86,7 +86,8 @@ class ProjectScreen extends StatelessWidget {
bottomNavigationBar: AppBottomBar( bottomNavigationBar: AppBottomBar(
entityType: EntityType.project, entityType: EntityType.project,
tableColumns: ProjectPresenter.getAllTableFields(userCompany), tableColumns: ProjectPresenter.getAllTableFields(userCompany),
defaultTableColumns: ProjectPresenter.getDefaultTableFields(userCompany), defaultTableColumns:
ProjectPresenter.getDefaultTableFields(userCompany),
onRefreshPressed: () => store.dispatch(LoadProjects(force: true)), onRefreshPressed: () => store.dispatch(LoadProjects(force: true)),
onSelectedSortField: (value) => store.dispatch(SortProjects(value)), onSelectedSortField: (value) => store.dispatch(SortProjects(value)),
customValues1: company.getCustomFieldValues(CustomFieldType.project1, customValues1: company.getCustomFieldValues(CustomFieldType.project1,
@ -120,20 +121,20 @@ class ProjectScreen extends StatelessWidget {
} }
}, },
), ),
floatingActionButton: floatingActionButton: state.prefState.isMenuFloated &&
state.prefState.isMenuFloated && userCompany.canCreate(EntityType.project) userCompany.canCreate(EntityType.project)
? FloatingActionButton( ? FloatingActionButton(
heroTag: 'project_fab', heroTag: 'project_fab',
backgroundColor: Theme.of(context).primaryColorDark, backgroundColor: Theme.of(context).primaryColorDark,
onPressed: () => createEntityByType( onPressed: () => createEntityByType(
context: context, entityType: EntityType.project), context: context, entityType: EntityType.project),
child: Icon( child: Icon(
Icons.add, Icons.add,
color: Colors.white, color: Colors.white,
), ),
tooltip: localization.newProject, tooltip: localization.newProject,
) )
: null, : null,
); );
} }
} }

View File

@ -149,22 +149,22 @@ class QuoteScreen extends StatelessWidget {
} }
}, },
), ),
floatingActionButton: floatingActionButton: state.prefState.isMenuFloated &&
state.prefState.isMenuFloated && userCompany.canCreate(EntityType.quote) userCompany.canCreate(EntityType.quote)
? FloatingActionButton( ? FloatingActionButton(
heroTag: 'quote_fab', heroTag: 'quote_fab',
backgroundColor: Theme.of(context).primaryColorDark, backgroundColor: Theme.of(context).primaryColorDark,
onPressed: () { onPressed: () {
createEntityByType( createEntityByType(
context: context, entityType: EntityType.quote); context: context, entityType: EntityType.quote);
}, },
child: Icon( child: Icon(
Icons.add, Icons.add,
color: Colors.white, color: Colors.white,
), ),
tooltip: localization.newQuote, tooltip: localization.newQuote,
) )
: null, : null,
); );
} }
} }

View File

@ -170,7 +170,8 @@ class _AccountOverview extends StatelessWidget {
callback: (value) { callback: (value) {
final state = viewModel.state; final state = viewModel.state;
final credentials = state.credentials; final credentials = state.credentials;
final url = '${credentials.url}/claim_license?license_key=$value'; final url =
'${credentials.url}/claim_license?license_key=$value';
WebClient() WebClient()
.post( .post(
url, url,

View File

@ -6,7 +6,6 @@ import 'package:invoiceninja_flutter/redux/app/app_state.dart';
import 'package:invoiceninja_flutter/ui/app/presenters/entity_presenter.dart'; import 'package:invoiceninja_flutter/ui/app/presenters/entity_presenter.dart';
class TaskPresenter extends EntityPresenter { class TaskPresenter extends EntityPresenter {
static List<String> getDefaultTableFields(UserCompanyEntity userCompany) { static List<String> getDefaultTableFields(UserCompanyEntity userCompany) {
return [ return [
TaskFields.client, TaskFields.client,

View File

@ -120,8 +120,7 @@ class TaxRateListVM {
isLoading: state.isLoading, isLoading: state.isLoading,
isLoaded: state.taxRateState.isLoaded, isLoaded: state.taxRateState.isLoaded,
filter: state.taxRateUIState.listUIState.filter, filter: state.taxRateUIState.listUIState.filter,
onClearEntityFilterPressed: () => onClearEntityFilterPressed: () => store.dispatch(ClearEntityFilter()),
store.dispatch(ClearEntityFilter()),
onViewEntityFilterPressed: (BuildContext context) => viewEntityById( onViewEntityFilterPressed: (BuildContext context) => viewEntityById(
context: context, context: context,
entityId: state.taxRateListState.filterEntityId, entityId: state.taxRateListState.filterEntityId,

View File

@ -3,7 +3,6 @@ import 'package:invoiceninja_flutter/data/models/models.dart';
import 'package:invoiceninja_flutter/ui/app/presenters/entity_presenter.dart'; import 'package:invoiceninja_flutter/ui/app/presenters/entity_presenter.dart';
class VendorPresenter extends EntityPresenter { class VendorPresenter extends EntityPresenter {
static List<String> getDefaultTableFields(UserCompanyEntity userCompany) { static List<String> getDefaultTableFields(UserCompanyEntity userCompany) {
return [ return [
VendorFields.name, VendorFields.name,

View File

@ -120,22 +120,22 @@ class VendorScreen extends StatelessWidget {
} }
}, },
), ),
floatingActionButton: floatingActionButton: state.prefState.isMenuFloated &&
state.prefState.isMenuFloated && userCompany.canCreate(EntityType.vendor) userCompany.canCreate(EntityType.vendor)
? FloatingActionButton( ? FloatingActionButton(
heroTag: 'vendor_fab', heroTag: 'vendor_fab',
backgroundColor: Theme.of(context).primaryColorDark, backgroundColor: Theme.of(context).primaryColorDark,
onPressed: () { onPressed: () {
createEntityByType( createEntityByType(
context: context, entityType: EntityType.vendor); context: context, entityType: EntityType.vendor);
}, },
child: Icon( child: Icon(
Icons.add, Icons.add,
color: Colors.white, color: Colors.white,
), ),
tooltip: localization.newVendor, tooltip: localization.newVendor,
) )
: null, : null,
); );
} }
} }

View File

@ -37,7 +37,6 @@ Completer<T> snackBarCompleter<T>(BuildContext context, String message,
// //
} }
completer.future.then((_) { completer.future.then((_) {
if (shouldPop) { if (shouldPop) {
Navigator.of(context).pop(); Navigator.of(context).pop();
@ -45,8 +44,8 @@ Completer<T> snackBarCompleter<T>(BuildContext context, String message,
if (scaffold != null) { if (scaffold != null) {
scaffold.showSnackBar(SnackBar( scaffold.showSnackBar(SnackBar(
content: SnackBarRow( content: SnackBarRow(
message: message, message: message,
))); )));
} }
}).catchError((Object error) { }).catchError((Object error) {
if (shouldPop) { if (shouldPop) {

View File

@ -3891,20 +3891,16 @@ mixin LocalizationsProvider on LocaleCodeAware {
String get reminderEndless => String get reminderEndless =>
_localizedValues[localeCode]['reminder_endless'] ?? ''; _localizedValues[localeCode]['reminder_endless'] ?? '';
String get useDefault => String get useDefault => _localizedValues[localeCode]['use_default'] ?? '';
_localizedValues[localeCode]['use_default'] ?? '';
String get contactName => String get contactName => _localizedValues[localeCode]['contact_name'] ?? '';
_localizedValues[localeCode]['contact_name'] ?? '';
String get creditRemaining => String get creditRemaining =>
_localizedValues[localeCode]['credit_remaining'] ?? ''; _localizedValues[localeCode]['credit_remaining'] ?? '';
String get allRecords => String get allRecords => _localizedValues[localeCode]['all_records'] ?? '';
_localizedValues[localeCode]['all_records'] ?? '';
String get ownedByUser => String get ownedByUser => _localizedValues[localeCode]['owned_by_user'] ?? '';
_localizedValues[localeCode]['owned_by_user'] ?? '';
String lookup(String key) { String lookup(String key) {
final lookupKey = toSnakeCase(key); final lookupKey = toSnakeCase(key);

View File

@ -40,7 +40,6 @@ String getAppURL(BuildContext context) {
} }
} }
AppLayout calculateLayout(BuildContext context) { AppLayout calculateLayout(BuildContext context) {
final size = MediaQuery.of(context).size.width; final size = MediaQuery.of(context).size.width;

View File

@ -22,7 +22,8 @@ Reducer<String> selectedIdReducer = combineReducers([
(String selectedId, dynamic action) => action.stubId), (String selectedId, dynamic action) => action.stubId),
TypedReducer<String, AddStubSuccess>( TypedReducer<String, AddStubSuccess>(
(String selectedId, dynamic action) => action.stub.id), (String selectedId, dynamic action) => action.stub.id),
TypedReducer<String, SelectCompany>((selectedId, action) => ''), TypedReducer<String, SelectCompany>((selectedId, action) => ''),
TypedReducer<String, ClearEntityFilter>((selectedId, action) => ''),
]); ]);
final editingReducer = combineReducers<StubEntity>([ final editingReducer = combineReducers<StubEntity>([