Feature request: Turn off PDF / HTML invoice preview #361
This commit is contained in:
parent
a09d7edcba
commit
971abbf293
|
|
@ -148,6 +148,7 @@ class UpdateUserPreferences implements PersistPrefs {
|
|||
this.persistData,
|
||||
this.persistUi,
|
||||
this.tapSelectedToEdit,
|
||||
this.showPdfPreview,
|
||||
});
|
||||
|
||||
final AppLayout appLayout;
|
||||
|
|
@ -167,6 +168,7 @@ class UpdateUserPreferences implements PersistPrefs {
|
|||
final bool persistData;
|
||||
final bool persistUi;
|
||||
final bool tapSelectedToEdit;
|
||||
final bool showPdfPreview;
|
||||
final BuiltMap<String, String> customColors;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ abstract class PrefState implements Built<PrefState, PrefStateBuilder> {
|
|||
tapSelectedToEdit: false,
|
||||
hideDesktopWarning: false,
|
||||
showKanban: false,
|
||||
showPdfPreview: true,
|
||||
persistData: false,
|
||||
persistUI: true,
|
||||
companyPrefs: BuiltMap<String, CompanyPrefState>(),
|
||||
|
|
@ -98,6 +99,8 @@ abstract class PrefState implements Built<PrefState, PrefStateBuilder> {
|
|||
|
||||
bool get showKanban;
|
||||
|
||||
bool get showPdfPreview;
|
||||
|
||||
bool get isHistoryVisible;
|
||||
|
||||
bool get enableDarkMode;
|
||||
|
|
@ -186,6 +189,7 @@ abstract class PrefState implements Built<PrefState, PrefStateBuilder> {
|
|||
..tapSelectedToEdit = false
|
||||
..persistData = false
|
||||
..persistUI = true
|
||||
..showPdfPreview = true
|
||||
..colorTheme =
|
||||
builder.enableDarkMode == true ? kColorThemeLight : kColorThemeLight;
|
||||
|
||||
|
|
|
|||
|
|
@ -142,6 +142,9 @@ class _$PrefStateSerializer implements StructuredSerializer<PrefState> {
|
|||
'showKanban',
|
||||
serializers.serialize(object.showKanban,
|
||||
specifiedType: const FullType(bool)),
|
||||
'showPdfPreview',
|
||||
serializers.serialize(object.showPdfPreview,
|
||||
specifiedType: const FullType(bool)),
|
||||
'isHistoryVisible',
|
||||
serializers.serialize(object.isHistoryVisible,
|
||||
specifiedType: const FullType(bool)),
|
||||
|
|
@ -241,6 +244,10 @@ class _$PrefStateSerializer implements StructuredSerializer<PrefState> {
|
|||
result.showKanban = serializers.deserialize(value,
|
||||
specifiedType: const FullType(bool)) as bool;
|
||||
break;
|
||||
case 'showPdfPreview':
|
||||
result.showPdfPreview = serializers.deserialize(value,
|
||||
specifiedType: const FullType(bool)) as bool;
|
||||
break;
|
||||
case 'isHistoryVisible':
|
||||
result.isHistoryVisible = serializers.deserialize(value,
|
||||
specifiedType: const FullType(bool)) as bool;
|
||||
|
|
@ -548,6 +555,8 @@ class _$PrefState extends PrefState {
|
|||
@override
|
||||
final bool showKanban;
|
||||
@override
|
||||
final bool showPdfPreview;
|
||||
@override
|
||||
final bool isHistoryVisible;
|
||||
@override
|
||||
final bool enableDarkMode;
|
||||
|
|
@ -587,6 +596,7 @@ class _$PrefState extends PrefState {
|
|||
this.isPreviewVisible,
|
||||
this.isMenuVisible,
|
||||
this.showKanban,
|
||||
this.showPdfPreview,
|
||||
this.isHistoryVisible,
|
||||
this.enableDarkMode,
|
||||
this.isFilterVisible,
|
||||
|
|
@ -618,6 +628,8 @@ class _$PrefState extends PrefState {
|
|||
isMenuVisible, 'PrefState', 'isMenuVisible');
|
||||
BuiltValueNullFieldError.checkNotNull(
|
||||
showKanban, 'PrefState', 'showKanban');
|
||||
BuiltValueNullFieldError.checkNotNull(
|
||||
showPdfPreview, 'PrefState', 'showPdfPreview');
|
||||
BuiltValueNullFieldError.checkNotNull(
|
||||
isHistoryVisible, 'PrefState', 'isHistoryVisible');
|
||||
BuiltValueNullFieldError.checkNotNull(
|
||||
|
|
@ -665,6 +677,7 @@ class _$PrefState extends PrefState {
|
|||
isPreviewVisible == other.isPreviewVisible &&
|
||||
isMenuVisible == other.isMenuVisible &&
|
||||
showKanban == other.showKanban &&
|
||||
showPdfPreview == other.showPdfPreview &&
|
||||
isHistoryVisible == other.isHistoryVisible &&
|
||||
enableDarkMode == other.enableDarkMode &&
|
||||
isFilterVisible == other.isFilterVisible &&
|
||||
|
|
@ -701,13 +714,13 @@ class _$PrefState extends PrefState {
|
|||
$jc(
|
||||
$jc(
|
||||
$jc(
|
||||
$jc($jc($jc($jc(0, appLayout.hashCode), moduleLayout.hashCode), menuSidebarMode.hashCode),
|
||||
historySidebarMode.hashCode),
|
||||
useSidebarEditor.hashCode),
|
||||
customColors.hashCode),
|
||||
isPreviewVisible.hashCode),
|
||||
isMenuVisible.hashCode),
|
||||
showKanban.hashCode),
|
||||
$jc($jc($jc($jc($jc(0, appLayout.hashCode), moduleLayout.hashCode), menuSidebarMode.hashCode), historySidebarMode.hashCode),
|
||||
useSidebarEditor.hashCode),
|
||||
customColors.hashCode),
|
||||
isPreviewVisible.hashCode),
|
||||
isMenuVisible.hashCode),
|
||||
showKanban.hashCode),
|
||||
showPdfPreview.hashCode),
|
||||
isHistoryVisible.hashCode),
|
||||
enableDarkMode.hashCode),
|
||||
isFilterVisible.hashCode),
|
||||
|
|
@ -735,6 +748,7 @@ class _$PrefState extends PrefState {
|
|||
..add('isPreviewVisible', isPreviewVisible)
|
||||
..add('isMenuVisible', isMenuVisible)
|
||||
..add('showKanban', showKanban)
|
||||
..add('showPdfPreview', showPdfPreview)
|
||||
..add('isHistoryVisible', isHistoryVisible)
|
||||
..add('enableDarkMode', enableDarkMode)
|
||||
..add('isFilterVisible', isFilterVisible)
|
||||
|
|
@ -800,6 +814,11 @@ class PrefStateBuilder implements Builder<PrefState, PrefStateBuilder> {
|
|||
bool get showKanban => _$this._showKanban;
|
||||
set showKanban(bool showKanban) => _$this._showKanban = showKanban;
|
||||
|
||||
bool _showPdfPreview;
|
||||
bool get showPdfPreview => _$this._showPdfPreview;
|
||||
set showPdfPreview(bool showPdfPreview) =>
|
||||
_$this._showPdfPreview = showPdfPreview;
|
||||
|
||||
bool _isHistoryVisible;
|
||||
bool get isHistoryVisible => _$this._isHistoryVisible;
|
||||
set isHistoryVisible(bool isHistoryVisible) =>
|
||||
|
|
@ -879,6 +898,7 @@ class PrefStateBuilder implements Builder<PrefState, PrefStateBuilder> {
|
|||
_isPreviewVisible = $v.isPreviewVisible;
|
||||
_isMenuVisible = $v.isMenuVisible;
|
||||
_showKanban = $v.showKanban;
|
||||
_showPdfPreview = $v.showPdfPreview;
|
||||
_isHistoryVisible = $v.isHistoryVisible;
|
||||
_enableDarkMode = $v.enableDarkMode;
|
||||
_isFilterVisible = $v.isFilterVisible;
|
||||
|
|
@ -930,8 +950,9 @@ class PrefStateBuilder implements Builder<PrefState, PrefStateBuilder> {
|
|||
isMenuVisible, 'PrefState', 'isMenuVisible'),
|
||||
showKanban: BuiltValueNullFieldError.checkNotNull(
|
||||
showKanban, 'PrefState', 'showKanban'),
|
||||
isHistoryVisible: BuiltValueNullFieldError.checkNotNull(
|
||||
isHistoryVisible, 'PrefState', 'isHistoryVisible'),
|
||||
showPdfPreview: BuiltValueNullFieldError.checkNotNull(
|
||||
showPdfPreview, 'PrefState', 'showPdfPreview'),
|
||||
isHistoryVisible: BuiltValueNullFieldError.checkNotNull(isHistoryVisible, 'PrefState', 'isHistoryVisible'),
|
||||
enableDarkMode: BuiltValueNullFieldError.checkNotNull(enableDarkMode, 'PrefState', 'enableDarkMode'),
|
||||
isFilterVisible: BuiltValueNullFieldError.checkNotNull(isFilterVisible, 'PrefState', 'isFilterVisible'),
|
||||
persistData: BuiltValueNullFieldError.checkNotNull(persistData, 'PrefState', 'persistData'),
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ class _DeviceSettingsState extends State<DeviceSettings>
|
|||
disabledLabel: localization.showOrHide,
|
||||
),
|
||||
],
|
||||
if (isDesktop(context))
|
||||
if (isDesktop(context)) ...[
|
||||
BoolDropdownButton(
|
||||
label: localization.clickSelected,
|
||||
value: prefState.tapSelectedToEdit,
|
||||
|
|
@ -158,8 +158,19 @@ class _DeviceSettingsState extends State<DeviceSettings>
|
|||
},
|
||||
enabledLabel: localization.editRecord,
|
||||
disabledLabel: localization.hidePreview,
|
||||
)
|
||||
else
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 10),
|
||||
child: SwitchListTile(
|
||||
title: Text(localization.showPdfPreview),
|
||||
value: prefState.showPdfPreview,
|
||||
onChanged: (value) =>
|
||||
viewModel.onShowPdfChanged(context, value),
|
||||
activeColor: Theme.of(context).colorScheme.secondary,
|
||||
secondary: Icon(MdiIcons.filePdfBox),
|
||||
),
|
||||
),
|
||||
] else
|
||||
BoolDropdownButton(
|
||||
label: localization.listLongPress,
|
||||
value: !prefState.longPressSelectionIsDefault,
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ class DeviceSettingsVM {
|
|||
@required this.onCustomColorsChanged,
|
||||
@required this.onPersistDataChanged,
|
||||
@required this.onPersistUiChanged,
|
||||
@required this.onShowPdfChanged,
|
||||
@required this.onTapSelectedChanged,
|
||||
});
|
||||
|
||||
|
|
@ -98,6 +99,9 @@ class DeviceSettingsVM {
|
|||
onTapSelectedChanged: (context, value) async {
|
||||
store.dispatch(UpdateUserPreferences(tapSelectedToEdit: value));
|
||||
},
|
||||
onShowPdfChanged: (context, value) {
|
||||
store.dispatch(UpdateUserPreferences(showPdfPreview: value));
|
||||
},
|
||||
onColorThemeChanged: (context, value) async {
|
||||
if (store.state.prefState.colorTheme != value) {
|
||||
store.dispatch(UpdateUserPreferences(colorTheme: value));
|
||||
|
|
@ -182,5 +186,6 @@ class DeviceSettingsVM {
|
|||
final Function(BuildContext, bool) onRequireAuthenticationChanged;
|
||||
final Function(BuildContext, bool) onPersistDataChanged;
|
||||
final Function(BuildContext, bool) onPersistUiChanged;
|
||||
final Function(BuildContext, bool) onShowPdfChanged;
|
||||
final Future<bool> authenticationSupported;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
|||
static final Map<String, Map<String, String>> _localizedValues = {
|
||||
'en': {
|
||||
// STARTER: lang key - do not remove comment
|
||||
'show_pdf_preview': 'Show PDF Preview',
|
||||
'print_pdf': 'Print PDF',
|
||||
'remind_me': 'Remind Me',
|
||||
'instant_bank_pay': 'Instant Bank Pay',
|
||||
|
|
@ -62844,6 +62845,10 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
|||
_localizedValues[localeCode]['print_pdf'] ??
|
||||
_localizedValues['en']['print_pdf'];
|
||||
|
||||
String get showPdfPreview =>
|
||||
_localizedValues[localeCode]['show_pdf_preview'] ??
|
||||
_localizedValues['en']['show_pdf_preview'];
|
||||
|
||||
// STARTER: lang field - do not remove comment
|
||||
|
||||
String lookup(String key) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue