feat (Editor): Add an option to set the editor font family (#1078)

* feat (Editor): Add an option to set the editor font family

Add the `editorFontFamily` property to the settings storage and implement font family selection functionality on editor-related pages. Also, update all pages that use the editor settings to support the newly added font family option.

* refactor(editor): Optimize the logic for editor font settings
Standardize the method for retrieving font settings on the editor page to avoid redundant calls to the `fetch()` method. Extract the font retrieval logic into variables or anonymous functions to improve code readability and performance.
This commit is contained in:
GT610
2026-03-20 14:00:44 +08:00
committed by GitHub
parent 728116e11f
commit f858b150a5
9 changed files with 65 additions and 13 deletions

View File

@@ -465,6 +465,7 @@ extension _App on _AppSettingsPageState {
/// Encode [map] to String with indent `\t`
final text = jsonIndentEncoder.convert(mapForEditor);
final editorFont = _setting.editorFontFamily.fetch();
await EditorPage.route.go(
context,
args: EditorPageArgs(
@@ -472,9 +473,10 @@ extension _App on _AppSettingsPageState {
lang: ProgLang.json,
title: libL10n.setting,
onSave: onSave,
closeAfterSave: SettingStore.instance.closeAfterSave.fetch(),
softWrap: SettingStore.instance.editorSoftWrap.fetch(),
enableHighlight: SettingStore.instance.editorHighlight.fetch(),
closeAfterSave: _setting.closeAfterSave.fetch(),
softWrap: _setting.editorSoftWrap.fetch(),
enableHighlight: _setting.editorHighlight.fetch(),
fontFamily: editorFont.isEmpty ? null : editorFont,
),
);
}