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

@@ -11,7 +11,7 @@ import 'package:server_box/data/model/sftp/worker.dart';
import 'package:server_box/data/provider/server/all.dart';
import 'package:server_box/data/provider/sftp.dart';
import 'package:server_box/data/res/misc.dart';
import 'package:server_box/data/store/setting.dart';
import 'package:server_box/data/res/store.dart';
import 'package:server_box/view/page/storage/sftp.dart';
import 'package:server_box/view/page/storage/sftp_mission.dart';
@@ -366,9 +366,13 @@ extension _OnTapFile on _LocalFilePageState {
context.showSnackBar(libL10n.saved);
setStateSafe(() {});
},
closeAfterSave: SettingStore.instance.closeAfterSave.fetch(),
softWrap: SettingStore.instance.editorSoftWrap.fetch(),
enableHighlight: SettingStore.instance.editorHighlight.fetch(),
closeAfterSave: Stores.setting.closeAfterSave.fetch(),
softWrap: Stores.setting.editorSoftWrap.fetch(),
enableHighlight: Stores.setting.editorHighlight.fetch(),
fontFamily: () {
final font = Stores.setting.editorFontFamily.fetch();
return font.isEmpty ? null : font;
}(),
),
);
}