From 8394a8b3c0e62f766ce647dde63dc7128b160dce Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Mon, 15 Feb 2021 10:30:52 +0200 Subject: [PATCH] Set default tab to 0 --- lib/constants.dart | 2 +- lib/redux/app/app_actions.dart | 2 +- lib/redux/client/client_reducer.dart | 2 +- lib/redux/client/client_state.dart | 1 + lib/redux/company_gateway/company_gateway_state.dart | 1 + lib/redux/credit/credit_reducer.dart | 2 +- lib/redux/credit/credit_state.dart | 1 + lib/redux/design/design_state.dart | 1 + lib/redux/document/document_state.dart | 1 + lib/redux/expense/expense_reducer.dart | 2 +- lib/redux/expense/expense_state.dart | 1 + lib/redux/expense_category/expense_category_state.dart | 1 + lib/redux/group/group_state.dart | 1 + lib/redux/invoice/invoice_reducer.dart | 2 +- lib/redux/invoice/invoice_state.dart | 1 + lib/redux/payment/payment_reducer.dart | 2 +- lib/redux/payment/payment_state.dart | 1 + lib/redux/payment_term/payment_term_state.dart | 1 + lib/redux/product/product_reducer.dart | 2 +- lib/redux/product/product_state.dart | 1 + lib/redux/project/project_reducer.dart | 2 +- lib/redux/project/project_state.dart | 1 + lib/redux/quote/quote_reducer.dart | 2 +- lib/redux/quote/quote_state.dart | 1 + lib/redux/recurring_invoice/recurring_invoice_reducer.dart | 2 +- lib/redux/recurring_invoice/recurring_invoice_state.dart | 1 + lib/redux/task/task_reducer.dart | 2 +- lib/redux/task/task_state.dart | 1 + lib/redux/task_status/task_status_state.dart | 1 + lib/redux/tax_rate/tax_rate_state.dart | 1 + lib/redux/token/token_state.dart | 1 + lib/redux/ui/entity_ui_state.dart | 1 - lib/redux/ui/ui_reducer.dart | 2 +- lib/redux/user/user_state.dart | 1 + lib/redux/vendor/vendor_reducer.dart | 2 +- lib/redux/vendor/vendor_state.dart | 1 + lib/redux/webhook/webhook_state.dart | 1 + lib/ui/client/view/client_view.dart | 6 ++---- lib/ui/expense/view/expense_view.dart | 6 ++---- lib/ui/invoice/view/invoice_view.dart | 4 ++-- lib/ui/product/view/product_view.dart | 6 ++---- lib/ui/project/view/project_view.dart | 6 ++---- lib/ui/task/view/task_view.dart | 4 ++-- lib/ui/vendor/view/vendor_view.dart | 6 ++---- pubspec.yaml | 2 +- stubs/redux/stub/stub_reducer | 2 +- stubs/redux/stub/stub_state | 1 + 47 files changed, 53 insertions(+), 41 deletions(-) diff --git a/lib/constants.dart b/lib/constants.dart index 75899b6c4..bbaca6b1e 100644 --- a/lib/constants.dart +++ b/lib/constants.dart @@ -6,7 +6,7 @@ class Constants { } // TODO remove version once #46609 is fixed -const String kClientVersion = '5.0.41'; +const String kClientVersion = '5.0.42'; const String kMinServerVersion = '5.0.4'; const String kAppName = 'Invoice Ninja'; diff --git a/lib/redux/app/app_actions.dart b/lib/redux/app/app_actions.dart index 76b7dbb2e..09cc0dbb7 100644 --- a/lib/redux/app/app_actions.dart +++ b/lib/redux/app/app_actions.dart @@ -1407,7 +1407,7 @@ void selectEntity({ !entity.entityType.isSetting && entityUIState.selectedId == entity.id && state.prefState.isPreviewVisible) { - if ((entityUIState.tabIndex ?? 0) > 0) { + if (entityUIState.tabIndex > 0) { store.dispatch(PreviewEntity()); } else { editEntity(context: context, entity: entity); diff --git a/lib/redux/client/client_reducer.dart b/lib/redux/client/client_reducer.dart index dc18eb96a..50b78cc18 100644 --- a/lib/redux/client/client_reducer.dart +++ b/lib/redux/client/client_reducer.dart @@ -27,7 +27,7 @@ final tabIndexReducer = combineReducers([ return action.tabIndex; }), TypedReducer((completer, action) { - return null; + return 0; }), ]); diff --git a/lib/redux/client/client_state.dart b/lib/redux/client/client_state.dart index eb008683b..348a3ab5f 100644 --- a/lib/redux/client/client_state.dart +++ b/lib/redux/client/client_state.dart @@ -59,6 +59,7 @@ abstract class ClientUIState extends Object editing: ClientEntity(), editingContact: ContactEntity(), saveCompleter: null, + tabIndex: 0, ); } diff --git a/lib/redux/company_gateway/company_gateway_state.dart b/lib/redux/company_gateway/company_gateway_state.dart index d5e5ec5ae..bf60774a8 100644 --- a/lib/redux/company_gateway/company_gateway_state.dart +++ b/lib/redux/company_gateway/company_gateway_state.dart @@ -46,6 +46,7 @@ abstract class CompanyGatewayUIState extends Object listUIState: ListUIState(CompanyGatewayFields.name), editing: CompanyGatewayEntity(), selectedId: '', + tabIndex: 0, ); } CompanyGatewayUIState._(); diff --git a/lib/redux/credit/credit_reducer.dart b/lib/redux/credit/credit_reducer.dart index 151560d31..00b9c39a7 100644 --- a/lib/redux/credit/credit_reducer.dart +++ b/lib/redux/credit/credit_reducer.dart @@ -25,7 +25,7 @@ final tabIndexReducer = combineReducers([ return action.tabIndex; }), TypedReducer((completer, action) { - return null; + return 0; }), ]); diff --git a/lib/redux/credit/credit_state.dart b/lib/redux/credit/credit_state.dart index b81c1f55d..019c53a02 100644 --- a/lib/redux/credit/credit_state.dart +++ b/lib/redux/credit/credit_state.dart @@ -58,6 +58,7 @@ abstract class CreditUIState extends Object listUIState: ListUIState(CreditFields.number, sortAscending: false), editing: InvoiceEntity(), selectedId: '', + tabIndex: 0, ); } diff --git a/lib/redux/design/design_state.dart b/lib/redux/design/design_state.dart index a19feac53..48fbf9d3f 100644 --- a/lib/redux/design/design_state.dart +++ b/lib/redux/design/design_state.dart @@ -60,6 +60,7 @@ abstract class DesignUIState extends Object listUIState: ListUIState(DesignFields.name), editing: DesignEntity(), selectedId: '', + tabIndex: 0, ); } diff --git a/lib/redux/document/document_state.dart b/lib/redux/document/document_state.dart index 8ebf71e37..f897fa169 100644 --- a/lib/redux/document/document_state.dart +++ b/lib/redux/document/document_state.dart @@ -38,6 +38,7 @@ abstract class DocumentUIState extends Object listUIState: ListUIState(DocumentFields.name), editing: DocumentEntity(), selectedId: '', + tabIndex: 0, ); } DocumentUIState._(); diff --git a/lib/redux/expense/expense_reducer.dart b/lib/redux/expense/expense_reducer.dart index ba0332bc7..37584bddd 100644 --- a/lib/redux/expense/expense_reducer.dart +++ b/lib/redux/expense/expense_reducer.dart @@ -21,7 +21,7 @@ final tabIndexReducer = combineReducers([ return action.tabIndex; }), TypedReducer((completer, action) { - return null; + return 0; }), ]); diff --git a/lib/redux/expense/expense_state.dart b/lib/redux/expense/expense_state.dart index 866f1aaa5..c3b19a2de 100644 --- a/lib/redux/expense/expense_state.dart +++ b/lib/redux/expense/expense_state.dart @@ -58,6 +58,7 @@ abstract class ExpenseUIState extends Object listUIState: ListUIState(ExpenseFields.number, sortAscending: false), editing: ExpenseEntity(), selectedId: '', + tabIndex: 0, ); } ExpenseUIState._(); diff --git a/lib/redux/expense_category/expense_category_state.dart b/lib/redux/expense_category/expense_category_state.dart index c2603e8c2..643f67068 100644 --- a/lib/redux/expense_category/expense_category_state.dart +++ b/lib/redux/expense_category/expense_category_state.dart @@ -59,6 +59,7 @@ abstract class ExpenseCategoryUIState extends Object listUIState: ListUIState(ExpenseCategoryFields.name), editing: ExpenseCategoryEntity(), selectedId: '', + tabIndex: 0, ); } ExpenseCategoryUIState._(); diff --git a/lib/redux/group/group_state.dart b/lib/redux/group/group_state.dart index acc72a16a..d9ee7b79b 100644 --- a/lib/redux/group/group_state.dart +++ b/lib/redux/group/group_state.dart @@ -44,6 +44,7 @@ abstract class GroupUIState extends Object listUIState: ListUIState(GroupFields.name), editing: GroupEntity(), selectedId: '', + tabIndex: 0, ); } GroupUIState._(); diff --git a/lib/redux/invoice/invoice_reducer.dart b/lib/redux/invoice/invoice_reducer.dart index ac04c44b7..2c120e90b 100644 --- a/lib/redux/invoice/invoice_reducer.dart +++ b/lib/redux/invoice/invoice_reducer.dart @@ -26,7 +26,7 @@ final tabIndexReducer = combineReducers([ return action.tabIndex; }), TypedReducer((completer, action) { - return null; + return 0; }), ]); diff --git a/lib/redux/invoice/invoice_state.dart b/lib/redux/invoice/invoice_state.dart index 632f1be6f..ceab6cef7 100644 --- a/lib/redux/invoice/invoice_state.dart +++ b/lib/redux/invoice/invoice_state.dart @@ -59,6 +59,7 @@ abstract class InvoiceUIState extends Object listUIState: ListUIState(InvoiceFields.number, sortAscending: false), editing: InvoiceEntity(), selectedId: '', + tabIndex: 0, ); } diff --git a/lib/redux/payment/payment_reducer.dart b/lib/redux/payment/payment_reducer.dart index 1853548f3..23eaa5c97 100644 --- a/lib/redux/payment/payment_reducer.dart +++ b/lib/redux/payment/payment_reducer.dart @@ -21,7 +21,7 @@ final tabIndexReducer = combineReducers([ return action.tabIndex; }), TypedReducer((completer, action) { - return null; + return 0; }), ]); diff --git a/lib/redux/payment/payment_state.dart b/lib/redux/payment/payment_state.dart index fc06a19d1..fb1dee94b 100644 --- a/lib/redux/payment/payment_state.dart +++ b/lib/redux/payment/payment_state.dart @@ -60,6 +60,7 @@ abstract class PaymentUIState extends Object listUIState: ListUIState(PaymentFields.number, sortAscending: false), editing: PaymentEntity(), selectedId: '', + tabIndex: 0, ); } diff --git a/lib/redux/payment_term/payment_term_state.dart b/lib/redux/payment_term/payment_term_state.dart index b8d4b0bb7..d875e7dcd 100644 --- a/lib/redux/payment_term/payment_term_state.dart +++ b/lib/redux/payment_term/payment_term_state.dart @@ -50,6 +50,7 @@ abstract class PaymentTermUIState extends Object listUIState: ListUIState(PaymentTermFields.name), editing: PaymentTermEntity(), selectedId: '', + tabIndex: 0, ); } PaymentTermUIState._(); diff --git a/lib/redux/product/product_reducer.dart b/lib/redux/product/product_reducer.dart index 1c84053ae..3b6b9d521 100644 --- a/lib/redux/product/product_reducer.dart +++ b/lib/redux/product/product_reducer.dart @@ -22,7 +22,7 @@ final tabIndexReducer = combineReducers([ return action.tabIndex; }), TypedReducer((completer, action) { - return null; + return 0; }), ]); diff --git a/lib/redux/product/product_state.dart b/lib/redux/product/product_state.dart index 947f4429c..0e5aa9787 100644 --- a/lib/redux/product/product_state.dart +++ b/lib/redux/product/product_state.dart @@ -49,6 +49,7 @@ abstract class ProductUIState extends Object listUIState: ListUIState(ProductFields.productKey), editing: ProductEntity(), selectedId: '', + tabIndex: 0, ); } ProductUIState._(); diff --git a/lib/redux/project/project_reducer.dart b/lib/redux/project/project_reducer.dart index 75e9fad11..720bb90bc 100644 --- a/lib/redux/project/project_reducer.dart +++ b/lib/redux/project/project_reducer.dart @@ -25,7 +25,7 @@ final tabIndexReducer = combineReducers([ return action.tabIndex; }), TypedReducer((completer, action) { - return null; + return 0; }), ]); diff --git a/lib/redux/project/project_state.dart b/lib/redux/project/project_state.dart index 092381243..90bbc475b 100644 --- a/lib/redux/project/project_state.dart +++ b/lib/redux/project/project_state.dart @@ -59,6 +59,7 @@ abstract class ProjectUIState extends Object listUIState: ListUIState(ProjectFields.number, sortAscending: false), editing: ProjectEntity(), selectedId: '', + tabIndex: 0, ); } ProjectUIState._(); diff --git a/lib/redux/quote/quote_reducer.dart b/lib/redux/quote/quote_reducer.dart index 49d51dec7..635b270f3 100644 --- a/lib/redux/quote/quote_reducer.dart +++ b/lib/redux/quote/quote_reducer.dart @@ -26,7 +26,7 @@ final tabIndexReducer = combineReducers([ return action.tabIndex; }), TypedReducer((completer, action) { - return null; + return 0; }), ]); diff --git a/lib/redux/quote/quote_state.dart b/lib/redux/quote/quote_state.dart index 8da426472..46d31caa2 100644 --- a/lib/redux/quote/quote_state.dart +++ b/lib/redux/quote/quote_state.dart @@ -60,6 +60,7 @@ abstract class QuoteUIState extends Object listUIState: ListUIState(QuoteFields.number, sortAscending: false), editing: InvoiceEntity(), selectedId: '', + tabIndex: 0, ); } diff --git a/lib/redux/recurring_invoice/recurring_invoice_reducer.dart b/lib/redux/recurring_invoice/recurring_invoice_reducer.dart index d0f95f194..fead11bc9 100644 --- a/lib/redux/recurring_invoice/recurring_invoice_reducer.dart +++ b/lib/redux/recurring_invoice/recurring_invoice_reducer.dart @@ -27,7 +27,7 @@ final tabIndexReducer = combineReducers([ return action.tabIndex; }), TypedReducer((completer, action) { - return null; + return 0; }), ]); diff --git a/lib/redux/recurring_invoice/recurring_invoice_state.dart b/lib/redux/recurring_invoice/recurring_invoice_state.dart index c7056a361..0ade1cd2a 100644 --- a/lib/redux/recurring_invoice/recurring_invoice_state.dart +++ b/lib/redux/recurring_invoice/recurring_invoice_state.dart @@ -61,6 +61,7 @@ abstract class RecurringInvoiceUIState extends Object listUIState: ListUIState(InvoiceFields.number), editing: InvoiceEntity(), selectedId: '', + tabIndex: 0, ); } diff --git a/lib/redux/task/task_reducer.dart b/lib/redux/task/task_reducer.dart index 85e1ba0dd..979326340 100644 --- a/lib/redux/task/task_reducer.dart +++ b/lib/redux/task/task_reducer.dart @@ -22,7 +22,7 @@ final tabIndexReducer = combineReducers([ return action.tabIndex; }), TypedReducer((completer, action) { - return null; + return 0; }), ]); diff --git a/lib/redux/task/task_state.dart b/lib/redux/task/task_state.dart index 6ae76e9c9..fcc34a087 100644 --- a/lib/redux/task/task_state.dart +++ b/lib/redux/task/task_state.dart @@ -57,6 +57,7 @@ abstract class TaskUIState extends Object listUIState: ListUIState(TaskFields.number, sortAscending: false), editing: TaskEntity(), selectedId: '', + tabIndex: 0, ); } TaskUIState._(); diff --git a/lib/redux/task_status/task_status_state.dart b/lib/redux/task_status/task_status_state.dart index 8b971d886..11644f894 100644 --- a/lib/redux/task_status/task_status_state.dart +++ b/lib/redux/task_status/task_status_state.dart @@ -59,6 +59,7 @@ abstract class TaskStatusUIState extends Object listUIState: ListUIState(TaskStatusFields.name), editing: TaskStatusEntity(), selectedId: '', + tabIndex: 0, ); } TaskStatusUIState._(); diff --git a/lib/redux/tax_rate/tax_rate_state.dart b/lib/redux/tax_rate/tax_rate_state.dart index ebc277f99..71800f3ed 100644 --- a/lib/redux/tax_rate/tax_rate_state.dart +++ b/lib/redux/tax_rate/tax_rate_state.dart @@ -37,6 +37,7 @@ abstract class TaxRateUIState extends Object listUIState: ListUIState(TaxRateFields.name), editing: TaxRateEntity(), selectedId: '', + tabIndex: 0, ); } TaxRateUIState._(); diff --git a/lib/redux/token/token_state.dart b/lib/redux/token/token_state.dart index f135be729..339452045 100644 --- a/lib/redux/token/token_state.dart +++ b/lib/redux/token/token_state.dart @@ -48,6 +48,7 @@ abstract class TokenUIState extends Object listUIState: ListUIState(TokenFields.name), editing: TokenEntity(), selectedId: '', + tabIndex: 0, ); } TokenUIState._(); diff --git a/lib/redux/ui/entity_ui_state.dart b/lib/redux/ui/entity_ui_state.dart index 903cf71af..1cca7d64e 100644 --- a/lib/redux/ui/entity_ui_state.dart +++ b/lib/redux/ui/entity_ui_state.dart @@ -12,7 +12,6 @@ abstract class EntityUIState { @nullable String get selectedId; - @nullable int get tabIndex; @nullable diff --git a/lib/redux/ui/ui_reducer.dart b/lib/redux/ui/ui_reducer.dart index 46f337dcb..98e284703 100644 --- a/lib/redux/ui/ui_reducer.dart +++ b/lib/redux/ui/ui_reducer.dart @@ -198,7 +198,7 @@ Reducer settingsUIReducer = combineReducers([ ..origUser.replace(action.user ?? state.origUser) ..updatedAt = DateTime.now().millisecondsSinceEpoch ..section = action.section ?? state.section - ..tabIndex = action.tabIndex ?? 0 + ..tabIndex = action.tabIndex ..isChanged = false ..entityType = action.client != null ? EntityType.client diff --git a/lib/redux/user/user_state.dart b/lib/redux/user/user_state.dart index 59831e795..0fc80a7bb 100644 --- a/lib/redux/user/user_state.dart +++ b/lib/redux/user/user_state.dart @@ -44,6 +44,7 @@ abstract class UserUIState extends Object listUIState: ListUIState(UserFields.firstName), editing: UserEntity(), selectedId: '', + tabIndex: 0, ); } UserUIState._(); diff --git a/lib/redux/vendor/vendor_reducer.dart b/lib/redux/vendor/vendor_reducer.dart index 07f0651b4..183b4a10c 100644 --- a/lib/redux/vendor/vendor_reducer.dart +++ b/lib/redux/vendor/vendor_reducer.dart @@ -27,7 +27,7 @@ final tabIndexReducer = combineReducers([ return action.tabIndex; }), TypedReducer((completer, action) { - return null; + return 0; }), ]); diff --git a/lib/redux/vendor/vendor_state.dart b/lib/redux/vendor/vendor_state.dart index 1125cbf7b..65d6d10a9 100644 --- a/lib/redux/vendor/vendor_state.dart +++ b/lib/redux/vendor/vendor_state.dart @@ -60,6 +60,7 @@ abstract class VendorUIState extends Object editing: VendorEntity(), editingContact: VendorContactEntity(), selectedId: '', + tabIndex: 0, ); } diff --git a/lib/redux/webhook/webhook_state.dart b/lib/redux/webhook/webhook_state.dart index 12925daa7..069fc0cc2 100644 --- a/lib/redux/webhook/webhook_state.dart +++ b/lib/redux/webhook/webhook_state.dart @@ -49,6 +49,7 @@ abstract class WebhookUIState extends Object listUIState: ListUIState(WebhookFields.targetUrl), editing: WebhookEntity(), selectedId: '', + tabIndex: 0, ); } WebhookUIState._(); diff --git a/lib/ui/client/view/client_view.dart b/lib/ui/client/view/client_view.dart index cbdb7442f..d64f6bc81 100644 --- a/lib/ui/client/view/client_view.dart +++ b/lib/ui/client/view/client_view.dart @@ -42,9 +42,7 @@ class _ClientViewState extends State final state = widget.viewModel.state; _controller = TabController( - vsync: this, - length: 6, - initialIndex: state.clientUIState.tabIndex ?? 0); + vsync: this, length: 6, initialIndex: state.clientUIState.tabIndex); _controller.addListener(_onTabChanged); } @@ -58,7 +56,7 @@ class _ClientViewState extends State super.didUpdateWidget(oldWidget); if (oldWidget.tabIndex != widget.tabIndex) { - _controller.index = widget.tabIndex ?? 0; + _controller.index = widget.tabIndex; } } diff --git a/lib/ui/expense/view/expense_view.dart b/lib/ui/expense/view/expense_view.dart index ed96a9525..0d0fa34e6 100644 --- a/lib/ui/expense/view/expense_view.dart +++ b/lib/ui/expense/view/expense_view.dart @@ -42,9 +42,7 @@ class _ExpenseViewState extends State final state = widget.viewModel.state; _controller = TabController( - vsync: this, - length: 2, - initialIndex: state.expenseUIState.tabIndex ?? 0); + vsync: this, length: 2, initialIndex: state.expenseUIState.tabIndex); _controller.addListener(_onTabChanged); } @@ -58,7 +56,7 @@ class _ExpenseViewState extends State super.didUpdateWidget(oldWidget); if (oldWidget.tabIndex != widget.tabIndex) { - _controller.index = widget.tabIndex ?? 0; + _controller.index = widget.tabIndex; } } diff --git a/lib/ui/invoice/view/invoice_view.dart b/lib/ui/invoice/view/invoice_view.dart index 4d3054a2d..29adb8ed5 100644 --- a/lib/ui/invoice/view/invoice_view.dart +++ b/lib/ui/invoice/view/invoice_view.dart @@ -59,7 +59,7 @@ class _InvoiceViewState extends State _controller = TabController( vsync: this, length: invoice.isRecurring ? 5 : 4, - initialIndex: tabIndex ?? 0); + initialIndex: tabIndex); _controller.addListener(_onTabChanged); } @@ -83,7 +83,7 @@ class _InvoiceViewState extends State super.didUpdateWidget(oldWidget); if (oldWidget.tabIndex != widget.tabIndex) { - _controller.index = widget.tabIndex ?? 0; + _controller.index = widget.tabIndex; } } diff --git a/lib/ui/product/view/product_view.dart b/lib/ui/product/view/product_view.dart index a727383f3..5afd09b29 100644 --- a/lib/ui/product/view/product_view.dart +++ b/lib/ui/product/view/product_view.dart @@ -38,9 +38,7 @@ class _ProductViewState extends State final state = widget.viewModel.state; _controller = TabController( - vsync: this, - length: 2, - initialIndex: state.productUIState.tabIndex ?? 0); + vsync: this, length: 2, initialIndex: state.productUIState.tabIndex); _controller.addListener(_onTabChanged); } @@ -54,7 +52,7 @@ class _ProductViewState extends State super.didUpdateWidget(oldWidget); if (oldWidget.tabIndex != widget.tabIndex) { - _controller.index = widget.tabIndex ?? 0; + _controller.index = widget.tabIndex; } } diff --git a/lib/ui/project/view/project_view.dart b/lib/ui/project/view/project_view.dart index 319b400e9..abf2cdb56 100644 --- a/lib/ui/project/view/project_view.dart +++ b/lib/ui/project/view/project_view.dart @@ -38,9 +38,7 @@ class _ProjectViewState extends State final state = widget.viewModel.state; _controller = TabController( - vsync: this, - length: 2, - initialIndex: state.projectUIState.tabIndex ?? 0); + vsync: this, length: 2, initialIndex: state.projectUIState.tabIndex); _controller.addListener(_onTabChanged); } @@ -54,7 +52,7 @@ class _ProjectViewState extends State super.didUpdateWidget(oldWidget); if (oldWidget.tabIndex != widget.tabIndex) { - _controller.index = widget.tabIndex ?? 0; + _controller.index = widget.tabIndex; } } diff --git a/lib/ui/task/view/task_view.dart b/lib/ui/task/view/task_view.dart index f52c3e444..5e0e38bb9 100644 --- a/lib/ui/task/view/task_view.dart +++ b/lib/ui/task/view/task_view.dart @@ -38,7 +38,7 @@ class _TaskViewState extends State final state = widget.viewModel.state; _controller = TabController( - vsync: this, length: 2, initialIndex: state.taskUIState.tabIndex ?? 0); + vsync: this, length: 2, initialIndex: state.taskUIState.tabIndex); _controller.addListener(_onTabChanged); } @@ -52,7 +52,7 @@ class _TaskViewState extends State super.didUpdateWidget(oldWidget); if (oldWidget.tabIndex != widget.tabIndex) { - _controller.index = widget.tabIndex ?? 0; + _controller.index = widget.tabIndex; } } diff --git a/lib/ui/vendor/view/vendor_view.dart b/lib/ui/vendor/view/vendor_view.dart index 62c53f804..1a1486628 100644 --- a/lib/ui/vendor/view/vendor_view.dart +++ b/lib/ui/vendor/view/vendor_view.dart @@ -37,9 +37,7 @@ class _VendorViewState extends State final state = widget.viewModel.state; _controller = TabController( - vsync: this, - length: 3, - initialIndex: state.vendorUIState.tabIndex ?? 0); + vsync: this, length: 3, initialIndex: state.vendorUIState.tabIndex); _controller.addListener(_onTabChanged); } @@ -53,7 +51,7 @@ class _VendorViewState extends State super.didUpdateWidget(oldWidget); if (oldWidget.tabIndex != widget.tabIndex) { - _controller.index = widget.tabIndex ?? 0; + _controller.index = widget.tabIndex; } } diff --git a/pubspec.yaml b/pubspec.yaml index 27f579358..3d6c1afcb 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: invoiceninja_flutter description: Client for Invoice Ninja -version: 5.0.41+41 +version: 5.0.42+42 author: Hillel Coren homepage: https://invoiceninja.com documentation: http://docs.invoiceninja.com diff --git a/stubs/redux/stub/stub_reducer b/stubs/redux/stub/stub_reducer index 4cc20e9cd..b6f2d9364 100644 --- a/stubs/redux/stub/stub_reducer +++ b/stubs/redux/stub/stub_reducer @@ -23,7 +23,7 @@ final tabIndexReducer = combineReducers([ return action.tabIndex; }), TypedReducer((completer, action) { - return null; + return 0; }), ]); diff --git a/stubs/redux/stub/stub_state b/stubs/redux/stub/stub_state index ae29a8e6b..14d8765ab 100644 --- a/stubs/redux/stub/stub_state +++ b/stubs/redux/stub/stub_state @@ -57,6 +57,7 @@ abstract class StubUIState extends Object with EntityUIState implements Built