Add edit icon to tables if tapSelectedToEdit is disabled

This commit is contained in:
Hillel Coren 2021-11-10 13:18:23 +02:00
parent 7212d73524
commit 7abd166fca
4 changed files with 17 additions and 7 deletions

View File

@ -1433,6 +1433,8 @@ void selectEntity({
store.dispatch(PreviewEntity()); store.dispatch(PreviewEntity());
} else if (state.prefState.tapSelectedToEdit) { } else if (state.prefState.tapSelectedToEdit) {
editEntity(context: context, entity: entity); editEntity(context: context, entity: entity);
} else {
store.dispatch(TogglePreviewSidebar());
} }
} else { } else {
ClientEntity client; ClientEntity client;

View File

@ -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.dart';
import 'package:invoiceninja_flutter/ui/app/tables/app_data_table_source.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/colors.dart';
import 'package:invoiceninja_flutter/utils/localization.dart';
import 'package:invoiceninja_flutter/utils/platforms.dart'; import 'package:invoiceninja_flutter/utils/platforms.dart';
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
class EntityDataTableSource extends AppDataTableSource { class EntityDataTableSource extends AppDataTableSource {
EntityDataTableSource( EntityDataTableSource(
@ -95,10 +97,16 @@ class EntityDataTableSource extends AppDataTableSource {
DataCell( DataCell(
Row( Row(
children: <Widget>[ children: <Widget>[
if (!state.prefState.tapSelectedToEdit)
IconButton(
tooltip: AppLocalization.of(context).editRecord,
onPressed: () =>
editEntity(context: context, entity: entity),
icon: Icon(MdiIcons.circleEditOutline),
),
ActionMenuButton( ActionMenuButton(
entityActions: entity.getActions( entityActions: entity.getActions(
userCompany: state.userCompany, userCompany: state.userCompany,
includeEdit: true,
client: entity is BelongsToClient client: entity is BelongsToClient
? state.clientState ? state.clientState
.map[(entity as BelongsToClient)?.clientId] .map[(entity as BelongsToClient)?.clientId]

View File

@ -152,7 +152,7 @@ class _DeviceSettingsState extends State<DeviceSettings>
viewModel.onTapSelectedChanged(context, value); viewModel.onTapSelectedChanged(context, value);
}, },
enabledLabel: localization.editRecord, enabledLabel: localization.editRecord,
disabledLabel: localization.noAction, disabledLabel: localization.hidePreview,
) )
else else
BoolDropdownButton( BoolDropdownButton(

View File

@ -16,7 +16,7 @@ mixin LocalizationsProvider on LocaleCodeAware {
'en': { 'en': {
// STARTER: lang key - do not remove comment // STARTER: lang key - do not remove comment
'click_selected': 'Click Selected', 'click_selected': 'Click Selected',
'no_action': 'No Action', 'hide_preview': 'Hide Preview',
'edit_record': 'Edit Record', 'edit_record': 'Edit Record',
'credit_is_more_than_invoice': 'credit_is_more_than_invoice':
'The credit amount can not be more than the invoice amount', 'The credit amount can not be more than the invoice amount',
@ -62820,14 +62820,14 @@ mixin LocalizationsProvider on LocaleCodeAware {
_localizedValues[localeCode]['click_selected'] ?? _localizedValues[localeCode]['click_selected'] ??
_localizedValues['en']['click_selected']; _localizedValues['en']['click_selected'];
String get noAction =>
_localizedValues[localeCode]['no_action'] ??
_localizedValues['en']['no_action'];
String get editRecord => String get editRecord =>
_localizedValues[localeCode]['edit_record'] ?? _localizedValues[localeCode]['edit_record'] ??
_localizedValues['en']['edit_record']; _localizedValues['en']['edit_record'];
String get hidePreview =>
_localizedValues[localeCode]['hide_preview'] ??
_localizedValues['en']['hide_preview'];
// STARTER: lang field - do not remove comment // STARTER: lang field - do not remove comment
String lookup(String key) { String lookup(String key) {