From 7abd166fca4bf1f60790867b94f35343a27d8fe0 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Wed, 10 Nov 2021 13:18:23 +0200 Subject: [PATCH] Add edit icon to tables if tapSelectedToEdit is disabled --- lib/redux/app/app_actions.dart | 2 ++ lib/ui/app/tables/entity_datatable.dart | 10 +++++++++- lib/ui/settings/device_settings.dart | 2 +- lib/utils/i18n.dart | 10 +++++----- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/lib/redux/app/app_actions.dart b/lib/redux/app/app_actions.dart index 8da8009cb..ec611bade 100644 --- a/lib/redux/app/app_actions.dart +++ b/lib/redux/app/app_actions.dart @@ -1433,6 +1433,8 @@ void selectEntity({ store.dispatch(PreviewEntity()); } else if (state.prefState.tapSelectedToEdit) { editEntity(context: context, entity: entity); + } else { + store.dispatch(TogglePreviewSidebar()); } } else { ClientEntity client; diff --git a/lib/ui/app/tables/entity_datatable.dart b/lib/ui/app/tables/entity_datatable.dart index 8154f7d98..a15cc2c27 100644 --- a/lib/ui/app/tables/entity_datatable.dart +++ b/lib/ui/app/tables/entity_datatable.dart @@ -11,7 +11,9 @@ import 'package:invoiceninja_flutter/ui/app/presenters/entity_presenter.dart'; import 'package:invoiceninja_flutter/ui/app/tables/app_data_table.dart'; import 'package:invoiceninja_flutter/ui/app/tables/app_data_table_source.dart'; import 'package:invoiceninja_flutter/utils/colors.dart'; +import 'package:invoiceninja_flutter/utils/localization.dart'; import 'package:invoiceninja_flutter/utils/platforms.dart'; +import 'package:material_design_icons_flutter/material_design_icons_flutter.dart'; class EntityDataTableSource extends AppDataTableSource { EntityDataTableSource( @@ -95,10 +97,16 @@ class EntityDataTableSource extends AppDataTableSource { DataCell( Row( children: [ + if (!state.prefState.tapSelectedToEdit) + IconButton( + tooltip: AppLocalization.of(context).editRecord, + onPressed: () => + editEntity(context: context, entity: entity), + icon: Icon(MdiIcons.circleEditOutline), + ), ActionMenuButton( entityActions: entity.getActions( userCompany: state.userCompany, - includeEdit: true, client: entity is BelongsToClient ? state.clientState .map[(entity as BelongsToClient)?.clientId] diff --git a/lib/ui/settings/device_settings.dart b/lib/ui/settings/device_settings.dart index bca337a82..65991a49d 100644 --- a/lib/ui/settings/device_settings.dart +++ b/lib/ui/settings/device_settings.dart @@ -152,7 +152,7 @@ class _DeviceSettingsState extends State viewModel.onTapSelectedChanged(context, value); }, enabledLabel: localization.editRecord, - disabledLabel: localization.noAction, + disabledLabel: localization.hidePreview, ) else BoolDropdownButton( diff --git a/lib/utils/i18n.dart b/lib/utils/i18n.dart index c54726b3c..2ee542776 100644 --- a/lib/utils/i18n.dart +++ b/lib/utils/i18n.dart @@ -16,7 +16,7 @@ mixin LocalizationsProvider on LocaleCodeAware { 'en': { // STARTER: lang key - do not remove comment 'click_selected': 'Click Selected', - 'no_action': 'No Action', + 'hide_preview': 'Hide Preview', 'edit_record': 'Edit Record', 'credit_is_more_than_invoice': 'The credit amount can not be more than the invoice amount', @@ -62820,14 +62820,14 @@ mixin LocalizationsProvider on LocaleCodeAware { _localizedValues[localeCode]['click_selected'] ?? _localizedValues['en']['click_selected']; - String get noAction => - _localizedValues[localeCode]['no_action'] ?? - _localizedValues['en']['no_action']; - String get editRecord => _localizedValues[localeCode]['edit_record'] ?? _localizedValues['en']['edit_record']; + String get hidePreview => + _localizedValues[localeCode]['hide_preview'] ?? + _localizedValues['en']['hide_preview']; + // STARTER: lang field - do not remove comment String lookup(String key) {