This commit is contained in:
Hillel Coren 2019-11-12 08:48:51 +02:00
parent 3d9ee44575
commit 4956f79ba3
4 changed files with 18 additions and 9 deletions

View File

@ -406,7 +406,7 @@ abstract class AppState implements Built<AppState, AppStateBuilder> {
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}';

View File

@ -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: <Widget>[
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(),
),
],
);
}

View File

@ -79,6 +79,7 @@ class CompanyGatewayScreen extends StatelessWidget {
)
else
SaveCancelButtons(
isSaving: state.isSaving,
onSavePressed: viewModel.onSavePressed,
onCancelPressed: viewModel.onCancelPressed,
),

View File

@ -100,7 +100,8 @@ class _CompanyGatewayEditState extends State<CompanyGatewayEdit>
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<CompanyGatewayEdit>
],
),
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<GatewayConfigField> {
}
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<LimitEditor> {
}
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;