feat(settings): Appearance category + custom-control escape hatch (T-452)
Add the one bespoke control the schema engine defers to. New SettingsControlContribution routes a WidgetBuilder into a kernel SettingsControlRegistry under a customId; a SettingsFieldKind.custom field names that id, and the renderer draws the registered widget full-width (label on top, no scope tag — the control owns its own apply + scope). The theme-picker extension uses it: an Appearance category whose theme field is custom, backed by AppearanceThemeControl — base-theme chips + a high-contrast toggle that apply live through ThemeController (persisted by theme_persistence). Reuses the shared theme_families helpers. Tests: control registry (register/dup/unregister), the renderer's custom-field path, and the Appearance contribution + live theme apply. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -24,6 +24,12 @@ enum SettingsFieldKind {
|
||||
/// of editing a value inline — the action is a command id, keeping the
|
||||
/// schema widget-free.
|
||||
file,
|
||||
|
||||
/// A bespoke control rendered by a widget the owning subsystem registers
|
||||
/// (via `SettingsControlContribution`) under [SettingsField.customId]. Keeps
|
||||
/// the schema widget-free while allowing the one-off controls the generic
|
||||
/// kinds can't express (e.g. the Appearance theme picker).
|
||||
custom,
|
||||
}
|
||||
|
||||
/// One choice in a [SettingsFieldKind.select] field.
|
||||
@@ -53,6 +59,7 @@ class SettingsField {
|
||||
this.max,
|
||||
this.fileCommand,
|
||||
this.applyCommandPrefix,
|
||||
this.customId,
|
||||
});
|
||||
|
||||
final String key;
|
||||
@@ -81,6 +88,10 @@ class SettingsField {
|
||||
/// persists). The current value is still read from [key], so the scope tag
|
||||
/// and selection still work. Example: `'keymap.preset.'` → `keymap.preset.vim`.
|
||||
final String? applyCommandPrefix;
|
||||
|
||||
/// For [SettingsFieldKind.custom]: the id the renderer looks up in the
|
||||
/// `SettingsControlRegistry` to find the widget that draws this field.
|
||||
final String? customId;
|
||||
}
|
||||
|
||||
/// A carded group of fields (surface.md "sectioned cards"). [label] is the
|
||||
|
||||
Reference in New Issue
Block a user