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>
57 lines
1.8 KiB
Dart
57 lines
1.8 KiB
Dart
import 'package:clide/widgets/src/clide_icon.dart';
|
|
import 'package:clide/widgets/src/clide_settings.dart';
|
|
import 'package:clide/widgets/src/clide_tappable.dart';
|
|
import 'package:clide/widgets/src/clide_text.dart';
|
|
import 'package:clide/widgets/src/icons/phosphor.dart';
|
|
import 'package:clide/widgets/src/typography.dart';
|
|
import 'package:flutter/widgets.dart';
|
|
|
|
class ClideAccordion extends StatelessWidget {
|
|
const ClideAccordion({
|
|
super.key,
|
|
required this.label,
|
|
required this.count,
|
|
required this.expanded,
|
|
required this.onToggle,
|
|
required this.children,
|
|
this.leading,
|
|
});
|
|
|
|
final String label;
|
|
final int count;
|
|
final bool expanded;
|
|
final VoidCallback onToggle;
|
|
final List<Widget> children;
|
|
final Widget? leading;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final tokens = ClideSettings.theme.of(context).surface;
|
|
return Column(
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
children: [
|
|
ClideTappable(
|
|
onTap: onToggle,
|
|
builder: (ctx, hovered, _) => Padding(
|
|
padding: const EdgeInsets.only(left: 4, top: 10, bottom: 4),
|
|
child: Row(
|
|
children: [
|
|
ClideIcon(expanded ? PhosphorIcons.byName('caret-down') : PhosphorIcons.byName('caret-right'), size: 10, color: tokens.globalTextMuted),
|
|
const SizedBox(width: 6),
|
|
if (leading != null) ...[leading!, const SizedBox(width: 6)],
|
|
ClideText(
|
|
'$label · $count',
|
|
fontSize: clideFontSmall,
|
|
color: hovered ? tokens.globalForeground : tokens.sidebarSectionHeader,
|
|
fontFamily: ClideSettings.fonts.monoOf(context),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
if (expanded) ...children,
|
|
],
|
|
);
|
|
}
|
|
}
|