extract ClideTappable shared widget

Encapsulates the hover + click + cursor pattern repeated across
the codebase. Builder receives (context, hovered) so callers
control their own hover styling. Refactored _ThemeLink to use it.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-23 11:12:04 +02:00
co-authored by Claude Opus 4.6
parent 85b222efc3
commit c9870bb044
3 changed files with 45 additions and 21 deletions
+9 -21
View File
@@ -297,34 +297,22 @@ class _StatusLine extends StatelessWidget {
}
}
class _ThemeLink extends StatefulWidget {
class _ThemeLink extends StatelessWidget {
const _ThemeLink({required this.tokens, required this.kernel, required this.themeName});
final SurfaceTokens tokens;
final KernelServices kernel;
final String themeName;
@override
State<_ThemeLink> createState() => _ThemeLinkState();
}
class _ThemeLinkState extends State<_ThemeLink> {
bool _hover = false;
@override
Widget build(BuildContext context) {
return MouseRegion(
cursor: SystemMouseCursors.click,
onEnter: (_) => setState(() => _hover = true),
onExit: (_) => setState(() => _hover = false),
child: GestureDetector(
onTap: () => widget.kernel.commands.execute('theme.pick'),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
ClideText('theme: ', muted: true, fontSize: 12, fontFamily: clideMonoFamily),
ClideText(widget.themeName, fontSize: 12, fontFamily: clideMonoFamily, color: _hover ? widget.tokens.globalForeground : widget.tokens.globalFocus),
],
),
return ClideTappable(
onTap: () => kernel.commands.execute('theme.pick'),
builder: (ctx, hovered) => Row(
mainAxisSize: MainAxisSize.min,
children: [
ClideText('theme: ', muted: true, fontSize: 12, fontFamily: clideMonoFamily),
ClideText(themeName, fontSize: 12, fontFamily: clideMonoFamily, color: hovered ? tokens.globalForeground : tokens.globalFocus),
],
),
);
}