Single Flutter package at the repo root. All code, tests, assets, and platform directories moved from app/ to root. Package renamed from clide_app to clide — all imports rewritten. Merged pubspec combines core (ffi) and app (flutter, yaml, xterm) dependencies. Makefile simplified: no APP_PRESENT conditionals, no cd, no daemon lifecycle. 317 tests pass. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
54 lines
1.3 KiB
Dart
54 lines
1.3 KiB
Dart
import 'package:clide/clide.dart';
|
|
import 'package:clide/builtin/theme_picker/src/picker_view.dart';
|
|
import 'package:clide/extension/extension.dart';
|
|
|
|
class ThemePickerExtension extends ClideExtension {
|
|
@override
|
|
String get id => 'builtin.theme-picker';
|
|
@override
|
|
String get title => 'Theme picker';
|
|
@override
|
|
String get version => '0.1.0';
|
|
|
|
ClideExtensionContext? _ctx;
|
|
|
|
@override
|
|
Future<void> activate(ClideExtensionContext ctx) async {
|
|
_ctx = ctx;
|
|
}
|
|
|
|
@override
|
|
List<ContributionPoint> get contributions => [
|
|
CommandContribution(
|
|
id: 'theme.pick',
|
|
command: 'theme.pick',
|
|
title: 'Theme: Pick…',
|
|
defaultBinding: 'ctrl+k',
|
|
run: _pick,
|
|
),
|
|
];
|
|
|
|
Future<IpcResponse> _pick(List<String> args) async {
|
|
final ctx = _ctx;
|
|
if (ctx == null) {
|
|
return IpcResponse.err(
|
|
id: '',
|
|
error: IpcError(
|
|
code: IpcExitCode.toolError,
|
|
kind: IpcErrorKind.toolError,
|
|
message: 'theme-picker not activated',
|
|
),
|
|
);
|
|
}
|
|
final selected = await ctx.dialog.show<String>(
|
|
(context, dismiss) => ThemePickerView(
|
|
controller: ctx.theme,
|
|
onDismiss: dismiss,
|
|
),
|
|
);
|
|
return IpcResponse.ok(id: '', data: {
|
|
'selected': selected ?? ctx.theme.currentName,
|
|
});
|
|
}
|
|
}
|