refactor(theme): route consumer reads through ClideSettings.theme (T-473)

Migrate ClideTheme.of(context) reads across the widget, feature, and shell
layers to the unified ClideSettings.theme.of(context) facade (D-101), so
theme/i18n/fonts/settings share one widget-facing entry. The facade delegates
straight to ClideTheme, so behaviour is unchanged — goldens are unmoved.

The low-level theme provider keeps its direct ClideTheme.of: the facade is
built on it, and the two kernel sites (ClideTheme's own definition + the
panels drag-resize widget) stay direct to avoid a widgets→kernel import cycle.
Dead controller.dart/kernel.dart imports left by the sweep removed.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-17 21:47:15 +02:00
co-authored by Claude Opus 4.8
parent 1c79c9c4dc
commit 18cd945380
83 changed files with 174 additions and 187 deletions
@@ -68,7 +68,7 @@ class SettingsSearchResults extends StatelessWidget {
@override
Widget build(BuildContext context) {
final tokens = ClideTheme.of(context).surface;
final tokens = ClideSettings.theme.of(context).surface;
final i = ClideSettings.i18n.of(context);
final store = ClideKernel.of(context).settings;
final registry = ClideKernel.of(context).settingsRegistry;
@@ -119,7 +119,7 @@ class _SectionCard extends StatelessWidget {
@override
Widget build(BuildContext context) {
final tokens = ClideTheme.of(context).surface;
final tokens = ClideSettings.theme.of(context).surface;
return Padding(
padding: const EdgeInsets.only(bottom: 18),
child: Column(
@@ -164,7 +164,7 @@ class _FieldRow extends StatelessWidget {
@override
Widget build(BuildContext context) {
final tokens = ClideTheme.of(context).surface;
final tokens = ClideSettings.theme.of(context).surface;
final label = Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@@ -263,7 +263,7 @@ class _ToggleControl extends StatelessWidget {
@override
Widget build(BuildContext context) {
final tokens = ClideTheme.of(context).surface;
final tokens = ClideSettings.theme.of(context).surface;
return Semantics(
checked: checked,
excludeSemantics: true,
@@ -315,7 +315,7 @@ class _SelectControlState extends State<_SelectControl> {
@override
Widget build(BuildContext context) {
final tokens = ClideTheme.of(context).surface;
final tokens = ClideSettings.theme.of(context).surface;
return ClideAnchoredOverlay(
controller: _overlay,
align: ClideAnchorAlign.end,
@@ -427,7 +427,7 @@ class _EditControlState extends State<_EditControl> {
@override
Widget build(BuildContext context) {
final tokens = ClideTheme.of(context).surface;
final tokens = ClideSettings.theme.of(context).surface;
return Semantics(
textField: true,
label: widget.field.label,
@@ -504,7 +504,7 @@ class _ScopeTagState extends State<_ScopeTag> {
String _ns(String key, String fallback) => ClideSettings.i18n.of(context).string(key, namespace: _settingsNs, placeholder: fallback);
({String glyph, Color color, String tip, String label}) _appearance(SettingsScope? layer) {
final tokens = ClideTheme.of(context).surface;
final tokens = ClideSettings.theme.of(context).surface;
return switch (layer) {
SettingsScope.project => (
glyph: 'folder',
@@ -50,7 +50,7 @@ class _SettingsModalState extends State<SettingsModal> {
@override
Widget build(BuildContext context) {
final i = ClideSettings.i18n.of(context);
final tokens = ClideTheme.of(context).surface;
final tokens = ClideSettings.theme.of(context).surface;
final title = i.string('modal.title', namespace: SettingsModal.ns, placeholder: 'Settings');
return Focus(
@@ -117,7 +117,7 @@ class _Header extends StatelessWidget {
@override
Widget build(BuildContext context) {
final tokens = ClideTheme.of(context).surface;
final tokens = ClideSettings.theme.of(context).surface;
return Padding(
padding: const EdgeInsets.fromLTRB(16, 12, 10, 12),
child: Row(
@@ -139,7 +139,7 @@ class _CloseButton extends StatelessWidget {
@override
Widget build(BuildContext context) {
final tokens = ClideTheme.of(context).surface;
final tokens = ClideSettings.theme.of(context).surface;
final i = ClideSettings.i18n.of(context);
final label = i.string('modal.close', namespace: SettingsModal.ns, placeholder: 'Close');
final hint = i.string('modal.close.hint', namespace: SettingsModal.ns, placeholder: 'Close settings');
@@ -177,7 +177,7 @@ class _CategoryRail extends StatelessWidget {
@override
Widget build(BuildContext context) {
final tokens = ClideTheme.of(context).surface;
final tokens = ClideSettings.theme.of(context).surface;
final i = ClideSettings.i18n.of(context);
final registry = ClideKernel.of(context).settingsRegistry;
final searching = query.trim().isNotEmpty;
@@ -241,7 +241,7 @@ class _RailRow extends StatelessWidget {
@override
Widget build(BuildContext context) {
final tokens = ClideTheme.of(context).surface;
final tokens = ClideSettings.theme.of(context).surface;
final dim = matchCount == 0;
final fg = dim ? tokens.globalTextMuted : (selected ? tokens.globalForeground : tokens.sidebarForeground);
return Semantics(
@@ -311,7 +311,7 @@ class _EmptyState extends StatelessWidget {
@override
Widget build(BuildContext context) {
final tokens = ClideTheme.of(context).surface;
final tokens = ClideSettings.theme.of(context).surface;
final i = ClideSettings.i18n.of(context);
return Center(
child: Padding(