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
+1 -1
View File
@@ -18,7 +18,7 @@ class HatBar extends StatelessWidget {
@override
Widget build(BuildContext context) {
final tokens = ClideTheme.of(context).surface;
final tokens = ClideSettings.theme.of(context).surface;
return GestureDetector(
onPanStart: (_) => kernel.window.startDrag(),
child: Container(
+5 -5
View File
@@ -65,7 +65,7 @@ class RootLayout extends StatelessWidget {
height: dockHeight,
child: DecoratedBox(
decoration: BoxDecoration(
border: Border(top: BorderSide(color: ClideTheme.of(ctx).surface.chromeBorder)),
border: Border(top: BorderSide(color: ClideSettings.theme.of(ctx).surface.chromeBorder)),
),
child: SlotHost(slot: Slots.dock),
),
@@ -74,7 +74,7 @@ class RootLayout extends StatelessWidget {
Container(
height: statusHeight,
decoration: BoxDecoration(
border: Border(top: BorderSide(color: ClideTheme.of(ctx).surface.chromeBorder)),
border: Border(top: BorderSide(color: ClideSettings.theme.of(ctx).surface.chromeBorder)),
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.stretch,
@@ -136,7 +136,7 @@ class _BottomRail extends StatelessWidget {
@override
Widget build(BuildContext context) {
final kernel = ClideKernel.of(context);
final tokens = ClideTheme.of(context).surface;
final tokens = ClideSettings.theme.of(context).surface;
return ListenableBuilder(
listenable: kernel.panels,
builder: (ctx, _) {
@@ -202,7 +202,7 @@ class StatusbarCollapseToggle extends StatelessWidget {
@override
Widget build(BuildContext context) {
final kernel = ClideKernel.of(context);
final tokens = ClideTheme.of(context).surface;
final tokens = ClideSettings.theme.of(context).surface;
if (!visible) return const SizedBox(width: 24);
// The chevron points the DIRECTION OF THE ACTION: collapsing tucks the pane
// toward its own edge, expanding brings it back toward the centre.
@@ -231,7 +231,7 @@ class StatusbarHost extends StatelessWidget {
@override
Widget build(BuildContext context) {
final kernel = ClideKernel.of(context);
final tokens = ClideTheme.of(context).surface;
final tokens = ClideSettings.theme.of(context).surface;
return ListenableBuilder(
listenable: kernel.panels,
builder: (ctx, _) {
+1 -1
View File
@@ -102,7 +102,7 @@ class _ProjectSwitcherDropdownState extends State<_ProjectSwitcherDropdown> {
@override
Widget build(BuildContext context) {
final tokens = ClideTheme.of(context).surface;
final tokens = ClideSettings.theme.of(context).surface;
final recents = widget.kernel.project.recents;
final lf = _filter.toLowerCase();
final filtered = lf.isEmpty ? recents : recents.where((r) => r.name.toLowerCase().contains(lf) || r.path.toLowerCase().contains(lf)).toList();
+2 -2
View File
@@ -73,7 +73,7 @@ class RootShellState extends State<RootShell> {
@override
Widget build(BuildContext context) {
final tokens = ClideTheme.of(context).surface;
final tokens = ClideSettings.theme.of(context).surface;
// Resolve the user-selected fonts once (Settings → Appearance, T-460/T-471)
// and publish them via ClideFonts; the settings listener rebuilds this on a
// change so descendants re-read live. The UI font flows through the
@@ -326,7 +326,7 @@ class _WelcomeOverlay extends StatelessWidget {
listenable: kernel.project,
builder: (ctx, _) {
if (kernel.project.isOpen) return const SizedBox.shrink();
final tokens = ClideTheme.of(ctx).surface;
final tokens = ClideSettings.theme.of(ctx).surface;
return ColoredBox(color: tokens.globalBackground, child: const WelcomeView());
},
);
+7 -7
View File
@@ -52,7 +52,7 @@ class _SlotHostState extends State<SlotHost> {
@override
Widget build(BuildContext context) {
final kernel = ClideKernel.of(context);
final tokens = ClideTheme.of(context).surface;
final tokens = ClideSettings.theme.of(context).surface;
return FocusScope(
node: _scope,
onFocusChange: _onFocusChange,
@@ -84,7 +84,7 @@ class _SlotBody extends StatelessWidget {
@override
Widget build(BuildContext context) {
final kernel = ClideKernel.of(context);
final tokens = ClideTheme.of(context).surface;
final tokens = ClideSettings.theme.of(context).surface;
if (slot == Slots.sidebar) {
return _SidebarSlot(tabs: tabs, active: active, activeId: activeId, onSelect: (id) => kernel.panels.activateTab(slot, id));
@@ -125,7 +125,7 @@ class _SidebarSlot extends StatelessWidget {
@override
Widget build(BuildContext context) {
final tokens = ClideTheme.of(context).surface;
final tokens = ClideSettings.theme.of(context).surface;
return Container(
color: tokens.chromeBackground,
alignment: Alignment.topLeft,
@@ -156,7 +156,7 @@ class _WorkspaceSlot extends StatelessWidget {
@override
Widget build(BuildContext context) {
final kernel = ClideKernel.of(context);
final tokens = ClideTheme.of(context).surface;
final tokens = ClideSettings.theme.of(context).surface;
return ListenableBuilder(
listenable: kernel.arrangement,
builder: (ctx, _) {
@@ -218,7 +218,7 @@ class _RevealedTab extends StatelessWidget {
@override
Widget build(BuildContext context) {
final tokens = ClideTheme.of(context).surface;
final tokens = ClideSettings.theme.of(context).surface;
return Column(
children: [
Container(
@@ -277,7 +277,7 @@ class _EditorDragHandleState extends State<_EditorDragHandle> {
@override
Widget build(BuildContext context) {
final tokens = ClideTheme.of(context).surface;
final tokens = ClideSettings.theme.of(context).surface;
final lineColor = (_hovered || _focused) ? tokens.panelActiveBorder : tokens.panelBorder;
final ratio = widget.arrangement.editorRatio;
@@ -356,7 +356,7 @@ class _ContextSlot extends StatelessWidget {
@override
Widget build(BuildContext context) {
final tokens = ClideTheme.of(context).surface;
final tokens = ClideSettings.theme.of(context).surface;
return Container(color: tokens.panelBackground, alignment: Alignment.topLeft, padding: const EdgeInsets.only(right: 2), child: active.build(context));
}
}