From 05461017333dfb07f59b37f91763bd6cf0d462cd Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Wed, 5 Aug 2020 14:01:01 +0300 Subject: [PATCH] Online payments --- .../company_gateway_list_vm.dart | 5 +++-- .../company_gateway/company_gateway_screen.dart | 17 +++++++++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/lib/ui/company_gateway/company_gateway_list_vm.dart b/lib/ui/company_gateway/company_gateway_list_vm.dart index f67ce0fae..a93006106 100644 --- a/lib/ui/company_gateway/company_gateway_list_vm.dart +++ b/lib/ui/company_gateway/company_gateway_list_vm.dart @@ -94,8 +94,9 @@ class CompanyGatewayListVM { onRefreshed: (context) => _handleRefresh(context), onRemovePressed: (gatewayId) { gatewayIds.remove(gatewayId); - final settings = uiState.settings - .rebuild((b) => b..companyGatewayIds = gatewayIds.join(',')); + final settings = uiState.settings.rebuild((b) => b + ..companyGatewayIds = + gatewayIds.isEmpty ? '0' : gatewayIds.join(',')); store.dispatch(UpdateSettings(settings: settings)); }, onSortChanged: (int oldIndex, int newIndex) { diff --git a/lib/ui/company_gateway/company_gateway_screen.dart b/lib/ui/company_gateway/company_gateway_screen.dart index 94a7136e7..51dde526f 100644 --- a/lib/ui/company_gateway/company_gateway_screen.dart +++ b/lib/ui/company_gateway/company_gateway_screen.dart @@ -64,12 +64,25 @@ class CompanyGatewayScreen extends StatelessWidget { onCancelPressed: (context) => store.dispatch(ClearCompanyGatewayMultiselect()), ) - else + else ...[ + if (state.uiState.settingsUIState.isFiltered) ...[ + FlatButton( + child: Text(localization.reset, + style: TextStyle(color: store.state.headerTextColor)), + onPressed: () { + final settings = store.state.uiState.settingsUIState.settings + .rebuild((b) => b..companyGatewayIds = ''); + store.dispatch(UpdateSettings(settings: settings)); + }, + ), + SizedBox(width: 10), + ], SaveCancelButtons( isSaving: state.isSaving, onSavePressed: viewModel.onSavePressed, onCancelPressed: (_) => store.dispatch(ResetSettings()), - ), + ) + ], ], body: CompanyGatewayListBuilder(), bottomNavigationBar: AppBottomBar(