From 4956f79ba33eb33ebcc45131090ddc74cd0c896c Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Tue, 12 Nov 2019 08:48:51 +0200 Subject: [PATCH] Settings --- lib/redux/app/app_state.dart | 2 +- lib/ui/company_gateway/company_gateway_list.dart | 11 ++++++----- lib/ui/company_gateway/company_gateway_screen.dart | 1 + .../company_gateway/edit/company_gateway_edit.dart | 13 ++++++++++--- 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/lib/redux/app/app_state.dart b/lib/redux/app/app_state.dart index eaf877c3c..c6731a556 100644 --- a/lib/redux/app/app_state.dart +++ b/lib/redux/app/app_state.dart @@ -406,7 +406,7 @@ abstract class AppState implements Built { String toString() { //return 'Custom fields [UI]: ${uiState.settingsUIState.userCompany.company.customFields}, [DB] ${selectedCompany.customFields}'; //return 'item: ${uiState.invoiceUIState.editing.lineItems}'; - return 'Gateway IDs: ${uiState.settingsUIState.settings.companyGatewayIds}'; + return 'Gateway: ${uiState.companyGatewayUIState.editing.feesAndLimitsMap}'; //return 'Routes: Current: ${uiState.currentRoute} Prev: ${uiState.previousRoute}'; //return 'Route: ${uiState.currentRoute}, Setting Type: ${uiState.settingsUIState.entityType}, Name: ${uiState.settingsUIState.settings.name}, Updated: ${uiState.settingsUIState.updatedAt}'; //return 'Route: ${uiState.currentRoute}, Previous: ${uiState.previousRoute}, Layout: ${uiState.layout}, Menu: ${uiState.isMenuVisible}, History: ${uiState.isHistoryVisible}'; diff --git a/lib/ui/company_gateway/company_gateway_list.dart b/lib/ui/company_gateway/company_gateway_list.dart index 6eb51d2ac..36331620c 100644 --- a/lib/ui/company_gateway/company_gateway_list.dart +++ b/lib/ui/company_gateway/company_gateway_list.dart @@ -1,5 +1,6 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/material.dart' as prefix0; import 'package:flutter_redux/flutter_redux.dart'; import 'package:invoiceninja_flutter/data/models/company_gateway_model.dart'; import 'package:invoiceninja_flutter/data/models/models.dart'; @@ -35,7 +36,8 @@ class CompanyGatewayList extends StatelessWidget { return Column( children: [ - Expanded( + Flexible( + fit: FlexFit.tight, child: !viewModel.isLoaded ? LoadingIndicator() : RefreshIndicator( @@ -44,8 +46,6 @@ class CompanyGatewayList extends StatelessWidget { ? HelpText(AppLocalization.of(context).noRecordsFound) : ReorderableListView( onReorder: (oldIndex, newIndex) { - print('REORDER: $oldIndex $newIndex'); - // https://stackoverflow.com/a/54164333/497368 // These two lines are workarounds for ReorderableListView problems if (newIndex > @@ -56,8 +56,6 @@ class CompanyGatewayList extends StatelessWidget { newIndex--; } - print('REORDER FIXED: $oldIndex $newIndex'); - viewModel.onSortChanged(oldIndex, newIndex); }, children: viewModel.companyGatewayList @@ -90,6 +88,9 @@ class CompanyGatewayList extends StatelessWidget { ), ), ), + Expanded( + child: SizedBox(), + ), ], ); } diff --git a/lib/ui/company_gateway/company_gateway_screen.dart b/lib/ui/company_gateway/company_gateway_screen.dart index 3c52cd3f8..7f910984f 100644 --- a/lib/ui/company_gateway/company_gateway_screen.dart +++ b/lib/ui/company_gateway/company_gateway_screen.dart @@ -79,6 +79,7 @@ class CompanyGatewayScreen extends StatelessWidget { ) else SaveCancelButtons( + isSaving: state.isSaving, onSavePressed: viewModel.onSavePressed, onCancelPressed: viewModel.onCancelPressed, ), diff --git a/lib/ui/company_gateway/edit/company_gateway_edit.dart b/lib/ui/company_gateway/edit/company_gateway_edit.dart index 87e204b18..f48981499 100644 --- a/lib/ui/company_gateway/edit/company_gateway_edit.dart +++ b/lib/ui/company_gateway/edit/company_gateway_edit.dart @@ -100,7 +100,8 @@ class _CompanyGatewayEditState extends State viewModel.onChanged( companyGateway.rebuild((b) => b ..feesAndLimitsMap[(gateway as GatewayEntity) - .defaultGatewayTypeId ?? kGatewayTypeCreditCard] = FeesAndLimitsSettings() + .defaultGatewayTypeId ?? + kGatewayTypeCreditCard] = FeesAndLimitsSettings() ..gatewayId = gateway.id ..config = '{}'), ), @@ -212,11 +213,13 @@ class _CompanyGatewayEditState extends State ], ), LimitEditor( + key: ValueKey('__${_gatewayTypeId}__'), gatewayTypeId: _gatewayTypeId, viewModel: viewModel, companyGateway: companyGateway, ), FeesEditor( + key: ValueKey('__${_gatewayTypeId}__'), gatewayTypeId: _gatewayTypeId, viewModel: viewModel, companyGateway: companyGateway, @@ -409,7 +412,9 @@ class _GatewayConfigFieldState extends State { } class LimitEditor extends StatefulWidget { - const LimitEditor({this.companyGateway, this.viewModel, this.gatewayTypeId}); + const LimitEditor( + {Key key, this.companyGateway, this.viewModel, this.gatewayTypeId}) + : super(key: key); final CompanyGatewayEntity companyGateway; final CompanyGatewayEditVM viewModel; @@ -583,7 +588,9 @@ class _LimitEditorState extends State { } class FeesEditor extends StatefulWidget { - const FeesEditor({this.companyGateway, this.viewModel, this.gatewayTypeId}); + const FeesEditor( + {Key key, this.companyGateway, this.viewModel, this.gatewayTypeId}) + : super(key: key); final CompanyGatewayEntity companyGateway; final CompanyGatewayEditVM viewModel;