feat(workspace): refresh desktop editing experience and prepare 0.1.2
Gitea CI / Build Android APK (pull_request) Canceled after 0s
Gitea CI / Build Windows x64 app (pull_request) Canceled after 0s
Gitea CI / Audit and package Windows x64 (pull_request) Canceled after 0s
Gitea CI / Assemble and validate CI artifacts (pull_request) Canceled after 0s
Gitea CI / Gitea CI passed (pull_request) Canceled after 0s
Gitea CI / Check code and tests (pull_request) Canceled after 6m29s
Gitea CI / Build Android APK (pull_request) Canceled after 0s
Gitea CI / Build Windows x64 app (pull_request) Canceled after 0s
Gitea CI / Audit and package Windows x64 (pull_request) Canceled after 0s
Gitea CI / Assemble and validate CI artifacts (pull_request) Canceled after 0s
Gitea CI / Gitea CI passed (pull_request) Canceled after 0s
Gitea CI / Check code and tests (pull_request) Canceled after 6m29s
This commit is contained in:
1 parent
aa5255d1e4
commit
2e0033ce2d
260 files changed
+43963
-5591
No files matched your search
@@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
|
||||
|
||||
import '../media/media_asset_cover.dart';
|
||||
|
||||
import 'package:cutdex_ui/icons.dart';
|
||||
import 'package:cutdex_ui/theme.dart';
|
||||
|
||||
import '../media/audio_asset_tile.dart';
|
||||
@@ -25,13 +26,13 @@ class AgentAttachmentCard extends StatelessWidget {
|
||||
fit: BoxFit.cover,
|
||||
fallback: Center(
|
||||
child: Icon(
|
||||
kind == 'image' ? Icons.image_outlined : Icons.movie_outlined,
|
||||
kind == 'image' ? AppIcons.image : AppIcons.video,
|
||||
color: colors.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
errorFallback: Center(
|
||||
child: Icon(
|
||||
Icons.broken_image_outlined,
|
||||
AppIcons.imageUnavailable,
|
||||
color: colors.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
@@ -42,12 +43,7 @@ class AgentAttachmentCard extends StatelessWidget {
|
||||
showName: false,
|
||||
aspectRatio: 132 / 96,
|
||||
),
|
||||
_ => Center(
|
||||
child: Icon(
|
||||
Icons.insert_drive_file_outlined,
|
||||
color: colors.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
_ => Center(child: Icon(AppIcons.file, color: colors.onSurfaceVariant)),
|
||||
};
|
||||
return SizedBox(
|
||||
width: 132,
|
||||
@@ -93,7 +89,7 @@ class AgentAttachmentCard extends StatelessWidget {
|
||||
backgroundColor: colors.surface,
|
||||
foregroundColor: colors.onSurface,
|
||||
),
|
||||
icon: const Icon(Icons.close, size: 13),
|
||||
icon: const Icon(AppIcons.close, size: 13),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -0,0 +1,127 @@
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
import '../../integrations/platform/platform_capabilities.dart';
|
||||
import '../../integrations/platform/native_project_drop_region.dart';
|
||||
import '../../integrations/platform/native_file_drop_policy.dart';
|
||||
import '../../workspace/projects.dart';
|
||||
import '../../workspace/media_import.dart';
|
||||
import '../../workspace/external_media_import.dart';
|
||||
import '../../shared/widgets/drop_to_add_overlay.dart';
|
||||
import '../media/media_asset_drag.dart';
|
||||
import 'agent_composer_controller.dart';
|
||||
|
||||
/// Shared attachment drop handling for docked and floating chat presentations.
|
||||
class AgentAttachmentDropRegion extends ConsumerStatefulWidget {
|
||||
const AgentAttachmentDropRegion({
|
||||
super.key,
|
||||
required this.projectId,
|
||||
required this.composer,
|
||||
required this.child,
|
||||
this.shrinkWrap = false,
|
||||
});
|
||||
final String? projectId;
|
||||
final AgentComposerController composer;
|
||||
final Widget child;
|
||||
final bool shrinkWrap;
|
||||
@override
|
||||
ConsumerState<AgentAttachmentDropRegion> createState() =>
|
||||
_AgentAttachmentDropRegionState();
|
||||
}
|
||||
|
||||
class _AgentAttachmentDropRegionState
|
||||
extends ConsumerState<AgentAttachmentDropRegion> {
|
||||
bool _hovering = false;
|
||||
bool _canAttach(MediaAssetDrag drag) {
|
||||
final workspace = ref.read(projectsProvider).value;
|
||||
return widget.projectId == drag.projectId &&
|
||||
workspace?.activeProject?.id == drag.projectId &&
|
||||
!widget.composer.attachments.any((item) => item.id == drag.assetId) &&
|
||||
workspace!.assets.any((asset) => asset.id == drag.assetId);
|
||||
}
|
||||
|
||||
bool _canAttachFiles(List<ExternalMediaFile> files) {
|
||||
if (files.isEmpty) return true;
|
||||
final assets = ref.read(projectsProvider).value?.assets;
|
||||
if (assets == null) return false;
|
||||
final ids = {for (final item in widget.composer.attachments) item.id};
|
||||
final locations = {
|
||||
for (final asset in assets)
|
||||
if (ids.contains(asset.id)) ?mediaSourceLocation(asset),
|
||||
};
|
||||
return files.any((file) => !locations.contains(file.sourceUri.toString()));
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final workspace = ref.watch(
|
||||
projectsProvider.select(
|
||||
(value) => value.value?.copyWith(
|
||||
recent: const [],
|
||||
timelines: const [],
|
||||
error: null,
|
||||
creatingTimeline: false,
|
||||
),
|
||||
),
|
||||
);
|
||||
final native = ref.watch(platformCapabilitiesProvider).nativeFileDrop;
|
||||
final importing =
|
||||
widget.composer.busy ||
|
||||
widget.projectId != null &&
|
||||
ref.watch(
|
||||
externalMediaImportProvider(widget.projectId!)
|
||||
.select((value) => value.isLoading),
|
||||
);
|
||||
final internal = DragTarget<MediaAssetDrag>(
|
||||
key: const Key('agent-panel-drop-target'),
|
||||
onWillAcceptWithDetails: (details) => _canAttach(details.data),
|
||||
onAcceptWithDetails: (details) {
|
||||
if (_canAttach(details.data)) {
|
||||
widget.composer.attach(
|
||||
ref
|
||||
.read(projectsProvider)
|
||||
.value!
|
||||
.assets
|
||||
.firstWhere((asset) => asset.id == details.data.assetId),
|
||||
);
|
||||
}
|
||||
},
|
||||
builder: (context, candidates, _) => Stack(
|
||||
fit: widget.shrinkWrap ? StackFit.loose : StackFit.expand,
|
||||
children: [
|
||||
widget.child,
|
||||
if (candidates.isNotEmpty || _hovering)
|
||||
const Positioned.fill(
|
||||
child: DropToAddOverlay(key: Key('agent-drop-overlay')),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
if (!native) return internal;
|
||||
return NativeProjectDropRegion(
|
||||
regionId: 'attachments',
|
||||
policy: NativeFileDropPolicy.attachments,
|
||||
enabled:
|
||||
widget.projectId != null &&
|
||||
workspace?.activeProject?.id == widget.projectId &&
|
||||
(workspace?.projectBusy == false || importing),
|
||||
onEnter: (files) {
|
||||
if (!importing && _canAttachFiles(files)) {
|
||||
setState(() => _hovering = true);
|
||||
}
|
||||
},
|
||||
onExit: () {
|
||||
if (mounted && _hovering) setState(() => _hovering = false);
|
||||
},
|
||||
onDrop: (files) async {
|
||||
setState(() => _hovering = false);
|
||||
try {
|
||||
await widget.composer.importAttachments(files);
|
||||
} catch (_) {
|
||||
/* Shared composer publishes import feedback. */
|
||||
}
|
||||
},
|
||||
child: internal,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
import '../../l10n/l10n.dart';
|
||||
import 'chat_state.dart';
|
||||
import 'agent_composer_controller.dart';
|
||||
import 'composer_document.dart';
|
||||
import 'agent_message_codec.dart';
|
||||
|
||||
/// Consume one draft after the shared chat controller's send preconditions pass.
|
||||
String takeAgentDraft(
|
||||
ComposerDocumentController input,
|
||||
AgentComposerController composer,
|
||||
) {
|
||||
final text = AgentComposerMessage.encodeDocument(
|
||||
input.segments,
|
||||
composer.attachments,
|
||||
);
|
||||
input.clearDocument();
|
||||
composer.clear();
|
||||
return text;
|
||||
}
|
||||
|
||||
String agentChatErrorMessage(BuildContext context, AgentChatError error) =>
|
||||
switch (error) {
|
||||
AgentChatError.configurationReadFailed =>
|
||||
context.l10n.agentConfigurationReadFailed,
|
||||
AgentChatError.configurationRequired =>
|
||||
context.l10n.agentConfigurationRequired,
|
||||
AgentChatError.sessionRestoreFailed =>
|
||||
context.l10n.agentSessionRestoreFailed,
|
||||
AgentChatError.contextBudget => context.l10n.agentContextBudgetExceeded,
|
||||
AgentChatError.authentication => context.l10n.agentAuthenticationFailed,
|
||||
AgentChatError.exportReplyFailed => context.l10n.agentExportReplyFailed,
|
||||
AgentChatError.connection => context.l10n.agentConnectionFailed,
|
||||
AgentChatError.protocol => context.l10n.agentProtocolFailed,
|
||||
AgentChatError.turnLimit => context.l10n.agentTurnLimitReached,
|
||||
AgentChatError.interrupted => context.l10n.agentTaskInterrupted,
|
||||
AgentChatError.recoveryRequired => context.l10n.agentRecoveryRequired,
|
||||
AgentChatError.replyFailed => context.l10n.replyFailed,
|
||||
AgentChatError.requestFailed => context.l10n.chatFailed,
|
||||
};
|
||||
@@ -1,3 +1,5 @@
|
||||
import 'agent_reply_region.dart';
|
||||
|
||||
import 'package:cutdex/shared/widgets/error_notification_host.dart';
|
||||
|
||||
import '../../shared/layout/composer_layout.dart';
|
||||
@@ -9,6 +11,8 @@ import 'package:cutdex_sdk/project.dart';
|
||||
|
||||
import '../../integrations/platform/platform_capabilities.dart';
|
||||
import 'agent_composer_controller.dart';
|
||||
import 'agent_attachment_drop_region.dart';
|
||||
import 'agent_chat_actions.dart';
|
||||
import 'agent_composer_store.dart';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -16,21 +20,17 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
import '../../integrations/agent/agent_provider.dart';
|
||||
|
||||
import 'package:cutdex_ui/icons.dart';
|
||||
import 'package:cutdex_ui/theme.dart';
|
||||
import 'package:cutdex_ui/widgets.dart';
|
||||
|
||||
import '../../shared/widgets/drop_to_add_overlay.dart';
|
||||
import '../settings/settings_page.dart';
|
||||
import 'chat_controller.dart';
|
||||
import 'chat_state.dart';
|
||||
import '../../integrations/agent/conversation_repository.dart';
|
||||
import '../../integrations/platform/native_project_drop_region.dart';
|
||||
import '../../integrations/platform/native_file_drop_policy.dart';
|
||||
import '../../workspace/media_import.dart';
|
||||
import '../../workspace/external_media_import.dart';
|
||||
import '../../settings/settings_operation.dart';
|
||||
import '../../workspace/projects.dart';
|
||||
import '../media/media_asset_drag.dart';
|
||||
import '../media/media_browser_feedback.dart';
|
||||
import 'agent_attachment_card.dart';
|
||||
import 'agent_media_attachments.dart';
|
||||
@@ -97,8 +97,7 @@ class _AgentChatPanelState extends ConsumerState<AgentChatPanel> {
|
||||
'agent-model-${widget.projectId}-${widget.conversationId ?? widget.draftKey ?? 'new'}';
|
||||
bool get _choosingModel =>
|
||||
ref.read(settingsOperationProvider(_modelOperation)).isLoading;
|
||||
bool _usingDraftModel = false;
|
||||
bool _dropHovering = false;
|
||||
bool get _usingDraftModel => _composer.usingDraftModel;
|
||||
bool get _importingAttachments =>
|
||||
_composer.busy ||
|
||||
widget.projectId != null &&
|
||||
@@ -143,33 +142,12 @@ class _AgentChatPanelState extends ConsumerState<AgentChatPanel> {
|
||||
if (oldWidget.conversationId != widget.conversationId ||
|
||||
oldWidget.projectId != widget.projectId ||
|
||||
oldWidget.draftKey != widget.draftKey) {
|
||||
_usingDraftModel = false;
|
||||
_composer.removeListener(_composerChanged);
|
||||
_composer = _resolveComposer();
|
||||
_composer.addListener(_composerChanged);
|
||||
}
|
||||
}
|
||||
|
||||
String _errorMessage(BuildContext context, AgentChatError error) =>
|
||||
switch (error) {
|
||||
AgentChatError.configurationReadFailed =>
|
||||
context.l10n.agentConfigurationReadFailed,
|
||||
AgentChatError.configurationRequired =>
|
||||
context.l10n.agentConfigurationRequired,
|
||||
AgentChatError.sessionRestoreFailed =>
|
||||
context.l10n.agentSessionRestoreFailed,
|
||||
AgentChatError.contextBudget => context.l10n.agentContextBudgetExceeded,
|
||||
AgentChatError.authentication => context.l10n.agentAuthenticationFailed,
|
||||
AgentChatError.exportReplyFailed => context.l10n.agentExportReplyFailed,
|
||||
AgentChatError.connection => context.l10n.agentConnectionFailed,
|
||||
AgentChatError.protocol => context.l10n.agentProtocolFailed,
|
||||
AgentChatError.turnLimit => context.l10n.agentTurnLimitReached,
|
||||
AgentChatError.interrupted => context.l10n.agentTaskInterrupted,
|
||||
AgentChatError.recoveryRequired => context.l10n.agentRecoveryRequired,
|
||||
AgentChatError.replyFailed => context.l10n.replyFailed,
|
||||
AgentChatError.requestFailed => context.l10n.chatFailed,
|
||||
};
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
@@ -189,41 +167,6 @@ class _AgentChatPanelState extends ConsumerState<AgentChatPanel> {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
bool _canAttach(MediaAssetDrag drag) {
|
||||
final workspace = ref.read(projectsProvider).asData?.value;
|
||||
return widget.projectId == drag.projectId &&
|
||||
workspace?.activeProject?.id == drag.projectId &&
|
||||
!_attachments.any((item) => item.id == drag.assetId) &&
|
||||
workspace!.assets.any((asset) => asset.id == drag.assetId);
|
||||
}
|
||||
|
||||
bool _canAttachExternalFiles(List<ExternalMediaFile> files) {
|
||||
if (files.isEmpty) return true;
|
||||
final assets = ref.read(projectsProvider).asData?.value.assets;
|
||||
if (assets == null) return false;
|
||||
final attachedIds = {for (final item in _attachments) item.id};
|
||||
final attachedLocations = {
|
||||
for (final asset in assets)
|
||||
if (attachedIds.contains(asset.id)) ?mediaSourceLocation(asset),
|
||||
};
|
||||
return files.any(
|
||||
(file) => !attachedLocations.contains(file.sourceUri.toString()),
|
||||
);
|
||||
}
|
||||
|
||||
void _attachAsset(AssetDocument asset) => _composer.attach(asset);
|
||||
|
||||
bool get _desktop => ref.read(platformCapabilitiesProvider).nativeFileDrop;
|
||||
|
||||
Future<void> _dropExternalFiles(List<ExternalMediaFile> files) async {
|
||||
setState(() => _dropHovering = false);
|
||||
try {
|
||||
await _composer.importAttachments(files);
|
||||
} catch (_) {
|
||||
// Feedback belongs to the composer even if this panel is hidden.
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _pickAttachments() async {
|
||||
try {
|
||||
await _composer.pickAttachments();
|
||||
@@ -232,64 +175,27 @@ class _AgentChatPanelState extends ConsumerState<AgentChatPanel> {
|
||||
}
|
||||
}
|
||||
|
||||
Widget _agentDropRegion(Widget child) {
|
||||
final workspace = ref.watch(projectsProvider).asData?.value;
|
||||
final enabled =
|
||||
_desktop &&
|
||||
widget.projectId != null &&
|
||||
workspace?.activeProject?.id == widget.projectId &&
|
||||
(workspace?.projectBusy == false || _importingAttachments);
|
||||
final internal = DragTarget<MediaAssetDrag>(
|
||||
key: const Key('agent-panel-drop-target'),
|
||||
hitTestBehavior: HitTestBehavior.opaque,
|
||||
onWillAcceptWithDetails: (details) => _canAttach(details.data),
|
||||
onAcceptWithDetails: (details) {
|
||||
final drag = details.data;
|
||||
if (!_canAttach(drag)) return;
|
||||
final asset = ref
|
||||
.read(projectsProvider)
|
||||
.asData!
|
||||
.value
|
||||
.assets
|
||||
.firstWhere((item) => item.id == drag.assetId);
|
||||
_attachAsset(asset);
|
||||
},
|
||||
builder: (context, candidates, rejected) => Stack(
|
||||
fit: StackFit.expand,
|
||||
children: [
|
||||
child,
|
||||
if (candidates.isNotEmpty || _dropHovering)
|
||||
const Positioned.fill(
|
||||
child: DropToAddOverlay(key: Key('agent-drop-overlay')),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
if (!_desktop) return internal;
|
||||
return NativeProjectDropRegion(
|
||||
regionId: 'attachments',
|
||||
policy: NativeFileDropPolicy.attachments,
|
||||
enabled: enabled,
|
||||
onEnter: (files) {
|
||||
if (!_importingAttachments && _canAttachExternalFiles(files)) {
|
||||
setState(() => _dropHovering = true);
|
||||
}
|
||||
},
|
||||
onExit: () {
|
||||
if (mounted && _dropHovering) setState(() => _dropHovering = false);
|
||||
},
|
||||
onDrop: _dropExternalFiles,
|
||||
child: internal,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
ref.watch(settingsOperationProvider(_modelOperation));
|
||||
ref.watch(
|
||||
settingsOperationProvider(_modelOperation)
|
||||
.select((value) => value.isLoading),
|
||||
);
|
||||
if (widget.projectId != null) {
|
||||
ref.watch(externalMediaImportProvider(widget.projectId!));
|
||||
ref.watch(
|
||||
externalMediaImportProvider(widget.projectId!)
|
||||
.select((value) => value.isLoading),
|
||||
);
|
||||
}
|
||||
final workspace = ref.watch(projectsProvider).asData?.value;
|
||||
final workspace = ref.watch(
|
||||
projectsProvider.select(
|
||||
(value) => value.asData?.value.copyWith(
|
||||
recent: const [],
|
||||
error: null,
|
||||
creatingTimeline: false,
|
||||
),
|
||||
),
|
||||
);
|
||||
final referenceValidator = ComposerReferenceValidator(
|
||||
workspace: workspace,
|
||||
projectId: widget.projectId,
|
||||
@@ -305,7 +211,9 @@ class _AgentChatPanelState extends ConsumerState<AgentChatPanel> {
|
||||
draftKey: widget.draftKey,
|
||||
)
|
||||
: null;
|
||||
final state = provider == null ? const ChatState() : ref.watch(provider);
|
||||
final state = provider == null
|
||||
? const ChatState()
|
||||
: ref.watch(provider.select(chatChrome));
|
||||
final settings = ref.watch(agentSettingsProvider).asData?.value;
|
||||
final available =
|
||||
settings?.providers
|
||||
@@ -360,7 +268,7 @@ class _AgentChatPanelState extends ConsumerState<AgentChatPanel> {
|
||||
});
|
||||
if (!mounted || !context.mounted) return;
|
||||
if (saved) {
|
||||
setState(() => _usingDraftModel = true);
|
||||
_composer.useDraftModel();
|
||||
} else {
|
||||
ErrorNotificationHost.of(context).show(
|
||||
ErrorNotification(
|
||||
@@ -379,7 +287,7 @@ class _AgentChatPanelState extends ConsumerState<AgentChatPanel> {
|
||||
key: const Key('agent-configure-model'),
|
||||
style: compactButtonStyle,
|
||||
onPressed: () => showSettingsPage(context, initialTab: 1),
|
||||
icon: const Icon(Icons.tune, size: 16),
|
||||
icon: const Icon(AppIcons.tune, size: 16),
|
||||
label: Text(context.l10n.agentConfigureModel),
|
||||
);
|
||||
}
|
||||
@@ -423,14 +331,14 @@ class _AgentChatPanelState extends ConsumerState<AgentChatPanel> {
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
const Icon(Icons.expand_more, size: 14),
|
||||
const Icon(AppIcons.expandMore, size: 14),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
if (provider != null) {
|
||||
if (provider != null && TickerMode.valuesOf(context).enabled) {
|
||||
ref.listen(provider, (previous, next) {
|
||||
if (_follow) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
@@ -453,12 +361,7 @@ class _AgentChatPanelState extends ConsumerState<AgentChatPanel> {
|
||||
(_input.text.trim().isEmpty && _attachments.isEmpty)) {
|
||||
return;
|
||||
}
|
||||
final text = AgentComposerMessage.encodeDocument(
|
||||
_input.segments,
|
||||
_attachments,
|
||||
);
|
||||
_input.clearDocument();
|
||||
_composer.clear();
|
||||
final text = takeAgentDraft(_input, _composer);
|
||||
_follow = true;
|
||||
ref
|
||||
.read(provider.notifier)
|
||||
@@ -471,8 +374,10 @@ class _AgentChatPanelState extends ConsumerState<AgentChatPanel> {
|
||||
}
|
||||
|
||||
final theme = Theme.of(context);
|
||||
final content = _agentDropRegion(
|
||||
LayoutBuilder(
|
||||
final content = AgentAttachmentDropRegion(
|
||||
projectId: widget.projectId,
|
||||
composer: _composer,
|
||||
child: LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final panelWidth =
|
||||
(constraints.maxWidth - ComposerLayout.horizontalInset * 2)
|
||||
@@ -562,8 +467,8 @@ class _AgentChatPanelState extends ConsumerState<AgentChatPanel> {
|
||||
),
|
||||
),
|
||||
Icon(
|
||||
Icons
|
||||
.chevron_right,
|
||||
AppIcons
|
||||
.chevronRight,
|
||||
size: 14,
|
||||
color:
|
||||
AppTheme.chatMetaTextStyle(
|
||||
@@ -575,7 +480,6 @@ class _AgentChatPanelState extends ConsumerState<AgentChatPanel> {
|
||||
),
|
||||
Divider(
|
||||
height: 1,
|
||||
thickness: 1,
|
||||
color:
|
||||
theme.dividerColor,
|
||||
),
|
||||
@@ -640,32 +544,39 @@ class _AgentChatPanelState extends ConsumerState<AgentChatPanel> {
|
||||
in AgentComposerMessage.decode(
|
||||
message.text,
|
||||
).attachments)
|
||||
if (ref
|
||||
.watch(
|
||||
projectsProvider,
|
||||
)
|
||||
.asData
|
||||
?.value
|
||||
.assets
|
||||
.where(
|
||||
(
|
||||
asset,
|
||||
) =>
|
||||
asset.id ==
|
||||
attachment.id,
|
||||
)
|
||||
.firstOrNull
|
||||
case final asset?)
|
||||
AgentAttachmentCard(
|
||||
asset: asset,
|
||||
)
|
||||
else
|
||||
Chip(
|
||||
label: Text(
|
||||
attachment
|
||||
.name,
|
||||
),
|
||||
),
|
||||
Consumer(
|
||||
builder: (context, ref, _) {
|
||||
final asset = ref.watch(
|
||||
projectsProvider.select(
|
||||
(
|
||||
value,
|
||||
) => value
|
||||
.asData
|
||||
?.value
|
||||
.assets
|
||||
.where(
|
||||
(
|
||||
asset,
|
||||
) =>
|
||||
asset.id ==
|
||||
attachment.id,
|
||||
)
|
||||
.firstOrNull,
|
||||
),
|
||||
);
|
||||
return asset ==
|
||||
null
|
||||
? Chip(
|
||||
label: Text(
|
||||
attachment.name,
|
||||
),
|
||||
)
|
||||
: AgentAttachmentCard(
|
||||
asset:
|
||||
asset,
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -681,44 +592,12 @@ class _AgentChatPanelState extends ConsumerState<AgentChatPanel> {
|
||||
],
|
||||
),
|
||||
),
|
||||
if (state.busy) ...[
|
||||
if (state
|
||||
.partialResponse
|
||||
.isNotEmpty)
|
||||
SelectableText(
|
||||
state.partialResponse,
|
||||
style:
|
||||
AppTheme.chatMessageTextStyle(
|
||||
context,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
state.stopping
|
||||
? context.l10n.stopping
|
||||
: switch (state.activity) {
|
||||
AgentChatActivity
|
||||
.compacting =>
|
||||
context
|
||||
.l10n
|
||||
.agentCompacting,
|
||||
AgentChatActivity
|
||||
.editing =>
|
||||
context
|
||||
.l10n
|
||||
.agentEditing,
|
||||
AgentChatActivity
|
||||
.verifying =>
|
||||
context
|
||||
.l10n
|
||||
.agentVerifying,
|
||||
AgentChatActivity
|
||||
.replying =>
|
||||
context.l10n.replying,
|
||||
},
|
||||
style:
|
||||
theme.textTheme.bodySmall,
|
||||
),
|
||||
],
|
||||
AgentReplyRegion(
|
||||
projectId: widget.projectId,
|
||||
conversationId:
|
||||
widget.conversationId,
|
||||
draftKey: widget.draftKey,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -751,7 +630,7 @@ class _AgentChatPanelState extends ConsumerState<AgentChatPanel> {
|
||||
horizontal: AppSpacing.compact,
|
||||
),
|
||||
child: Text(
|
||||
_errorMessage(context, error),
|
||||
agentChatErrorMessage(context, error),
|
||||
style: theme.textTheme.bodySmall,
|
||||
),
|
||||
),
|
||||
@@ -1045,7 +924,7 @@ class _AgentChatPanelState extends ConsumerState<AgentChatPanel> {
|
||||
? _pickAttachments
|
||||
: null,
|
||||
icon: const Icon(
|
||||
Icons.add,
|
||||
AppIcons.add,
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
@@ -1085,7 +964,7 @@ class _AgentChatPanelState extends ConsumerState<AgentChatPanel> {
|
||||
)
|
||||
.stop,
|
||||
icon: const Icon(
|
||||
Icons.stop,
|
||||
AppIcons.stop,
|
||||
),
|
||||
)
|
||||
else
|
||||
@@ -1120,7 +999,7 @@ class _AgentChatPanelState extends ConsumerState<AgentChatPanel> {
|
||||
? send
|
||||
: null,
|
||||
icon: const Icon(
|
||||
Icons.arrow_upward,
|
||||
AppIcons.arrowUp,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -22,6 +22,14 @@ class AgentComposerController extends ChangeNotifier {
|
||||
final List<AgentMediaAttachment> attachments;
|
||||
final feedback = MediaImportFeedbackController();
|
||||
bool _busy = false;
|
||||
bool _usingDraftModel = false;
|
||||
bool get usingDraftModel => _usingDraftModel;
|
||||
void useDraftModel() {
|
||||
if (_disposed) return;
|
||||
_usingDraftModel = true;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
bool _disposed = false;
|
||||
bool get busy => _busy;
|
||||
|
||||
|
||||
@@ -37,12 +37,24 @@ final class AgentComposerStore {
|
||||
final AgentComposerController Function(String?) createComposer;
|
||||
ComposerDocumentController _draft = ComposerDocumentController();
|
||||
ComposerDocumentController get draft => _draft;
|
||||
final _projectDrafts = <String?, ComposerDocumentController>{};
|
||||
final _inputs = <(String?, String), ComposerDocumentController>{};
|
||||
final _composers = <(String?, String), AgentComposerController>{};
|
||||
|
||||
ComposerDocumentController input(String? projectId, String? conversationId) =>
|
||||
conversationId == null
|
||||
? draft
|
||||
ComposerDocumentController input(
|
||||
String? projectId,
|
||||
String? conversationId, {
|
||||
bool projectScoped = false,
|
||||
}) => conversationId == null
|
||||
? projectScoped
|
||||
? _projectDrafts.putIfAbsent(
|
||||
projectId,
|
||||
() => projectId == null
|
||||
? ComposerDocumentController()
|
||||
: _projectDrafts.remove(null) ??
|
||||
ComposerDocumentController(),
|
||||
)
|
||||
: draft
|
||||
: _inputs.putIfAbsent((
|
||||
projectId,
|
||||
conversationId,
|
||||
@@ -57,8 +69,9 @@ final class AgentComposerStore {
|
||||
void promoteDraft(String projectId, String draftKey, String conversationId) {
|
||||
final destination = (projectId, conversationId);
|
||||
_inputs.remove(destination)?.dispose();
|
||||
_inputs[destination] = _draft;
|
||||
_draft = ComposerDocumentController();
|
||||
final scoped = _projectDrafts.remove(projectId);
|
||||
_inputs[destination] = scoped ?? _draft;
|
||||
if (scoped == null) _draft = ComposerDocumentController();
|
||||
final composer = _composers.remove((projectId, draftKey));
|
||||
if (composer != null) {
|
||||
_composers.remove(destination)?.dispose();
|
||||
@@ -77,6 +90,10 @@ final class AgentComposerStore {
|
||||
|
||||
void dispose() {
|
||||
draft.dispose();
|
||||
for (final input in _projectDrafts.values) {
|
||||
input.dispose();
|
||||
}
|
||||
_projectDrafts.clear();
|
||||
for (final input in _inputs.values) {
|
||||
input.dispose();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
class AgentPanelPresentation extends InheritedWidget {
|
||||
const AgentPanelPresentation({
|
||||
super.key,
|
||||
required this.compact,
|
||||
this.expanded = false,
|
||||
this.onToggleExpanded,
|
||||
this.onDock,
|
||||
required super.child,
|
||||
});
|
||||
final bool compact;
|
||||
final bool expanded;
|
||||
final VoidCallback? onToggleExpanded;
|
||||
final VoidCallback? onDock;
|
||||
static AgentPanelPresentation? of(BuildContext context) =>
|
||||
context.dependOnInheritedWidgetOfExactType<AgentPanelPresentation>();
|
||||
static bool compactOf(BuildContext context) =>
|
||||
context
|
||||
.dependOnInheritedWidgetOfExactType<AgentPanelPresentation>()
|
||||
?.compact ??
|
||||
false;
|
||||
@override
|
||||
bool updateShouldNotify(AgentPanelPresentation oldWidget) =>
|
||||
compact != oldWidget.compact || expanded != oldWidget.expanded;
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:cutdex_ui/theme.dart';
|
||||
|
||||
import '../../l10n/l10n.dart';
|
||||
import 'chat_controller.dart';
|
||||
import 'chat_state.dart';
|
||||
|
||||
/// Streaming output observes its conversation independently of history/composer.
|
||||
class AgentReplyRegion extends ConsumerWidget {
|
||||
const AgentReplyRegion({
|
||||
super.key,
|
||||
required this.projectId,
|
||||
this.conversationId,
|
||||
this.draftKey,
|
||||
});
|
||||
|
||||
final String? projectId;
|
||||
final String? conversationId;
|
||||
final String? draftKey;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
if (projectId == null) return const SizedBox.shrink();
|
||||
final provider =
|
||||
chatControllerProvider(
|
||||
projectId!,
|
||||
conversationId: conversationId,
|
||||
draftKey: draftKey,
|
||||
).select(
|
||||
(state) => (
|
||||
state.busy,
|
||||
state.partialResponse,
|
||||
state.stopping,
|
||||
state.activity,
|
||||
),
|
||||
);
|
||||
final state = TickerMode.valuesOf(context).enabled
|
||||
? ref.watch(provider)
|
||||
: ref.read(provider);
|
||||
if (!state.$1) return const SizedBox.shrink();
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
if (state.$2.isNotEmpty)
|
||||
SelectionArea(
|
||||
child: Text(
|
||||
state.$2,
|
||||
style: AppTheme.chatMessageTextStyle(context),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
state.$3
|
||||
? context.l10n.stopping
|
||||
: switch (state.$4) {
|
||||
AgentChatActivity.compacting => context.l10n.agentCompacting,
|
||||
AgentChatActivity.editing => context.l10n.agentEditing,
|
||||
AgentChatActivity.verifying => context.l10n.agentVerifying,
|
||||
AgentChatActivity.replying => context.l10n.replying,
|
||||
},
|
||||
style: Theme.of(context).textTheme.bodySmall,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// Stable chrome/history snapshot; each streamed token belongs to reply region.
|
||||
ChatState chatChrome(ChatState state) =>
|
||||
state.copyWith(partialResponse: '', activity: AgentChatActivity.replying);
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
import 'package:cutdex_ui/icons.dart';
|
||||
import 'package:cutdex_ui/theme.dart';
|
||||
|
||||
part 'composer_document.freezed.dart';
|
||||
@@ -322,8 +323,8 @@ class ComposerDocumentController extends TextEditingController {
|
||||
padding: const EdgeInsets.only(right: 4),
|
||||
child: Icon(
|
||||
mark.reference.kind == ComposerReferenceKind.timeline
|
||||
? Icons.view_timeline_outlined
|
||||
: Icons.attach_file,
|
||||
? AppIcons.timeline
|
||||
: AppIcons.attachment,
|
||||
size: 14,
|
||||
color: color,
|
||||
),
|
||||
|
||||
@@ -4,6 +4,7 @@ import '../../l10n/l10n.dart';
|
||||
import '../../shared/layout/composer_layout.dart';
|
||||
import '../../shared/theme/composer_style.dart';
|
||||
|
||||
import 'package:cutdex_ui/icons.dart';
|
||||
import 'package:cutdex_ui/theme.dart';
|
||||
|
||||
import '../../workspace/project_state.dart';
|
||||
@@ -72,7 +73,7 @@ class _ComposerProjectSelectorState extends State<ComposerProjectSelector> {
|
||||
if (selected == true) ...[
|
||||
const SizedBox(width: ComposerLayout.menuIconGap),
|
||||
Icon(
|
||||
Icons.check,
|
||||
AppIcons.check,
|
||||
size: ComposerLayout.menuIconSize,
|
||||
color: colors.onSurfaceVariant,
|
||||
),
|
||||
@@ -85,10 +86,7 @@ class _ComposerProjectSelectorState extends State<ComposerProjectSelector> {
|
||||
|
||||
Widget _separator() => const Padding(
|
||||
padding: AppComposerStyle.menuSeparatorPadding,
|
||||
child: Divider(
|
||||
height: 1,
|
||||
thickness: AppComposerStyle.menuSeparatorThickness,
|
||||
),
|
||||
child: Divider(height: 1),
|
||||
);
|
||||
|
||||
@override
|
||||
@@ -141,6 +139,8 @@ class _ComposerProjectSelectorState extends State<ComposerProjectSelector> {
|
||||
controller: _search,
|
||||
autofocus: true,
|
||||
style: AppTheme.composerTextStyle(context),
|
||||
cursorHeight: AppTheme.composerCursorHeight(context),
|
||||
textAlignVertical: TextAlignVertical.center,
|
||||
onChanged: (_) => setState(() {}),
|
||||
decoration: AppComposerStyle.projectSearchDecoration(
|
||||
context,
|
||||
@@ -169,7 +169,7 @@ class _ComposerProjectSelectorState extends State<ComposerProjectSelector> {
|
||||
_item(
|
||||
key: ValueKey('composer-project-${project.id}'),
|
||||
label: project.name,
|
||||
icon: Icons.folder_outlined,
|
||||
icon: AppIcons.folder,
|
||||
selected: project.id == widget.selected?.id,
|
||||
onPressed:
|
||||
widget.busy || !project.availability.canOpen
|
||||
@@ -188,7 +188,7 @@ class _ComposerProjectSelectorState extends State<ComposerProjectSelector> {
|
||||
key: const Key('composer-new-project'),
|
||||
secondary: true,
|
||||
label: context.l10n.newProject,
|
||||
icon: Icons.add,
|
||||
icon: AppIcons.add,
|
||||
onPressed: widget.busy || widget.onCreate == null
|
||||
? null
|
||||
: () {
|
||||
@@ -209,7 +209,7 @@ class _ComposerProjectSelectorState extends State<ComposerProjectSelector> {
|
||||
: controller.open(),
|
||||
style: AppComposerStyle.projectTrigger(context),
|
||||
icon: const Icon(
|
||||
Icons.folder_outlined,
|
||||
AppIcons.folder,
|
||||
size: ComposerLayout.menuIconSize,
|
||||
),
|
||||
label: Text(
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:cutdex_sdk/project.dart';
|
||||
import 'package:cutdex_ui/icons.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../l10n/app_localizations.dart';
|
||||
@@ -62,10 +63,10 @@ abstract final class ComposerOptionCatalog {
|
||||
title: asset.name,
|
||||
subtitle: l10n.materials,
|
||||
icon: switch (asset.metadata['kind']) {
|
||||
'video' => Icons.movie_outlined,
|
||||
'audio' => Icons.audiotrack_outlined,
|
||||
'image' => Icons.image_outlined,
|
||||
_ => Icons.insert_drive_file_outlined,
|
||||
'video' => AppIcons.video,
|
||||
'audio' => AppIcons.audio,
|
||||
'image' => AppIcons.image,
|
||||
_ => AppIcons.file,
|
||||
},
|
||||
group: ComposerOptionGroup.media,
|
||||
reference: ComposerReference(
|
||||
@@ -80,7 +81,7 @@ abstract final class ComposerOptionCatalog {
|
||||
trigger: '@',
|
||||
title: timeline.name,
|
||||
subtitle: l10n.timelines,
|
||||
icon: Icons.view_timeline_outlined,
|
||||
icon: AppIcons.timeline,
|
||||
group: ComposerOptionGroup.timeline,
|
||||
reference: ComposerReference(
|
||||
kind: ComposerReferenceKind.timeline,
|
||||
|
||||
@@ -0,0 +1,792 @@
|
||||
import 'agent_reply_region.dart';
|
||||
import '../../workspace/projects.dart';
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:cutdex_ui/icons.dart';
|
||||
import 'package:cutdex_ui/theme.dart';
|
||||
import 'package:cutdex_ui/widgets.dart';
|
||||
|
||||
import '../../shared/layout/composer_layout.dart';
|
||||
import '../../shared/theme/composer_style.dart';
|
||||
import '../../shared/widgets/workspace_resize_handle.dart';
|
||||
|
||||
import '../../l10n/l10n.dart';
|
||||
import '../../workspace/project_state.dart';
|
||||
import '../../workspace/external_media_import.dart';
|
||||
import '../../integrations/agent/agent_provider.dart';
|
||||
import '../../integrations/agent/conversation_repository.dart';
|
||||
import '../projects/conversation_sidebar.dart';
|
||||
import '../media/media_browser_feedback.dart';
|
||||
import '../settings/settings_page.dart';
|
||||
import '../../settings/settings_operation.dart';
|
||||
import '../../shared/widgets/error_notification_host.dart';
|
||||
import 'agent_chat_actions.dart';
|
||||
import 'agent_attachment_card.dart';
|
||||
import 'agent_attachment_drop_region.dart';
|
||||
import 'agent_composer_controller.dart';
|
||||
import 'agent_message_codec.dart';
|
||||
import 'breakable_selectable_text.dart';
|
||||
import 'chat_controller.dart';
|
||||
import 'chat_state.dart';
|
||||
import 'composer_document.dart';
|
||||
import 'composer_reference_validator.dart';
|
||||
import 'composer_suggestion_surface.dart';
|
||||
|
||||
/// Independent floating presentation of the same conversation and draft stores.
|
||||
class FloatingAgentPanel extends ConsumerStatefulWidget {
|
||||
const FloatingAgentPanel({
|
||||
super.key,
|
||||
required this.state,
|
||||
required this.selection,
|
||||
required this.input,
|
||||
required this.composer,
|
||||
required this.expanded,
|
||||
required this.onToggleExpanded,
|
||||
required this.onDock,
|
||||
required this.onConversationCreated,
|
||||
required this.onConversationUpdated,
|
||||
});
|
||||
final ProjectState state;
|
||||
final ConversationSelectionState selection;
|
||||
final ComposerDocumentController input;
|
||||
final AgentComposerController composer;
|
||||
final bool expanded;
|
||||
final VoidCallback onToggleExpanded;
|
||||
final VoidCallback onDock;
|
||||
final ValueChanged<ConversationMetadata> onConversationCreated;
|
||||
final ValueChanged<ConversationMetadata> onConversationUpdated;
|
||||
@override
|
||||
ConsumerState<FloatingAgentPanel> createState() => _FloatingAgentPanelState();
|
||||
}
|
||||
|
||||
class _FloatingAgentPanelState extends ConsumerState<FloatingAgentPanel>
|
||||
with SingleTickerProviderStateMixin {
|
||||
final _scroll = ScrollController();
|
||||
late final AnimationController _reveal;
|
||||
bool _resizing = false;
|
||||
|
||||
void _animateReveal(bool expanded) {
|
||||
_reveal.animateTo(expanded ? 1 : 0, curve: Curves.easeOutCubic);
|
||||
}
|
||||
|
||||
void _startResize() {
|
||||
_reveal.stop();
|
||||
setState(() => _resizing = true);
|
||||
}
|
||||
|
||||
void _finishResize() {
|
||||
if (!_resizing) return;
|
||||
final expanded = _reveal.value >= .35;
|
||||
setState(() => _resizing = false);
|
||||
if (expanded != widget.expanded) {
|
||||
widget.onToggleExpanded();
|
||||
} else {
|
||||
_animateReveal(expanded);
|
||||
}
|
||||
}
|
||||
|
||||
void _changed() {
|
||||
if (mounted) setState(() {});
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_reveal = AnimationController(
|
||||
vsync: this,
|
||||
duration: const Duration(milliseconds: 220),
|
||||
value: widget.expanded ? 1 : 0,
|
||||
);
|
||||
widget.composer.addListener(_changed);
|
||||
}
|
||||
|
||||
@override
|
||||
void didUpdateWidget(FloatingAgentPanel oldWidget) {
|
||||
super.didUpdateWidget(oldWidget);
|
||||
if (widget.expanded != oldWidget.expanded) {
|
||||
_animateReveal(widget.expanded);
|
||||
}
|
||||
if (oldWidget.input != widget.input) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
if (mounted && _scroll.hasClients) {
|
||||
_scroll.jumpTo(_scroll.position.maxScrollExtent);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (oldWidget.composer != widget.composer) {
|
||||
oldWidget.composer.removeListener(_changed);
|
||||
widget.composer.addListener(_changed);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
widget.composer.removeListener(_changed);
|
||||
_reveal.dispose();
|
||||
_scroll.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final assets =
|
||||
ref.watch(
|
||||
projectsProvider.select(
|
||||
(value) =>
|
||||
value.asData?.value.activeProject?.id ==
|
||||
widget.state.activeProject?.id
|
||||
? value.asData?.value.assets
|
||||
: null,
|
||||
),
|
||||
) ??
|
||||
widget.state.assets;
|
||||
final workspace = widget.state.copyWith(assets: assets);
|
||||
final projectId = workspace.activeProject?.id;
|
||||
final timelineId = widget.state.timeline?.id;
|
||||
final selection = widget.selection;
|
||||
final provider = projectId == null
|
||||
? null
|
||||
: chatControllerProvider(
|
||||
projectId,
|
||||
conversationId: selection.selectedId,
|
||||
draftKey: selection.selectedId == null ? selection.draftKey : null,
|
||||
);
|
||||
final chat = provider == null
|
||||
? const ChatState()
|
||||
: ref.watch(provider.select(chatChrome));
|
||||
final settings = ref.watch(agentSettingsProvider).value;
|
||||
final available =
|
||||
settings?.providers
|
||||
.where(
|
||||
(p) =>
|
||||
p.enabled &&
|
||||
AgentApiType.values.any((type) => type.name == p.apiType) &&
|
||||
p.models.isNotEmpty,
|
||||
)
|
||||
.toList() ??
|
||||
[];
|
||||
final conversation = chat.conversation;
|
||||
final providerId = conversation?.providerId ?? settings?.selectedProviderId;
|
||||
final modelId = conversation?.modelId ?? settings?.selectedModelId;
|
||||
final selectedProvider = available
|
||||
.where((p) => p.id == providerId)
|
||||
.firstOrNull;
|
||||
final selectedModel = selectedProvider?.models
|
||||
.where((m) => m.id == modelId)
|
||||
.firstOrNull;
|
||||
final configured =
|
||||
conversation != null ||
|
||||
(selection.selectedId != null && !widget.composer.usingDraftModel)
|
||||
? conversation != null &&
|
||||
settings?.enabled == true &&
|
||||
selectedModel != null
|
||||
: ref.watch(agentRuntimeProvider).value != null;
|
||||
final importing =
|
||||
widget.composer.busy ||
|
||||
(projectId != null &&
|
||||
ref.watch(
|
||||
externalMediaImportProvider(projectId)
|
||||
.select((value) => value.isLoading),
|
||||
));
|
||||
final operation =
|
||||
'agent-model-$projectId-${selection.selectedId ?? selection.draftKey}';
|
||||
final choosingModel = ref.watch(
|
||||
settingsOperationProvider(operation).select((value) => value.isLoading),
|
||||
);
|
||||
final validator = ComposerReferenceValidator(
|
||||
workspace: workspace,
|
||||
projectId: projectId,
|
||||
);
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
if (mounted) validator.validate(widget.input);
|
||||
});
|
||||
if (provider != null && TickerMode.valuesOf(context).enabled) {
|
||||
ref.listen(provider, (old, next) {
|
||||
if (_scroll.hasClients && _scroll.position.extentAfter < 80) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
if (mounted && _scroll.hasClients) {
|
||||
_scroll.jumpTo(_scroll.position.maxScrollExtent);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
void send() {
|
||||
validator.validate(widget.input);
|
||||
if (provider == null ||
|
||||
timelineId == null ||
|
||||
!configured ||
|
||||
choosingModel ||
|
||||
chat.busy ||
|
||||
importing ||
|
||||
widget.input.hasInvalidReferences ||
|
||||
(widget.input.text.trim().isEmpty &&
|
||||
widget.composer.attachments.isEmpty)) {
|
||||
return;
|
||||
}
|
||||
final text = takeAgentDraft(widget.input, widget.composer);
|
||||
if (!widget.expanded) widget.onToggleExpanded();
|
||||
unawaited(
|
||||
ref
|
||||
.read(provider.notifier)
|
||||
.send(
|
||||
text,
|
||||
timelineId: timelineId,
|
||||
onCreated: widget.onConversationCreated,
|
||||
onUpdated: widget.onConversationUpdated,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> chooseModel(String p, String m) async {
|
||||
if (chat.busy || choosingModel) return;
|
||||
final composer = widget.composer;
|
||||
final saved = await ref
|
||||
.read(settingsOperationProvider(operation).notifier)
|
||||
.run(() async {
|
||||
if (provider == null) {
|
||||
await ref.read(agentSettingsProvider.notifier).selectModel(p, m);
|
||||
} else {
|
||||
await ref.read(provider.notifier).selectModel(p, m);
|
||||
}
|
||||
});
|
||||
if (!mounted || !context.mounted) return;
|
||||
if (saved) composer.useDraftModel();
|
||||
if (!saved && context.mounted) {
|
||||
ErrorNotificationHost.of(context).show(
|
||||
ErrorNotification(
|
||||
content: Text(context.l10n.agentSaveSettingsFailed),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
final groups = ref.watch(conversationSidebarProvider).value?.groups;
|
||||
final items = groups?[projectId] ?? const <ConversationMetadata>[];
|
||||
final title =
|
||||
conversation?.title ??
|
||||
items.where((c) => c.id == selection.selectedId).firstOrNull?.title ??
|
||||
context.l10n.agentNewConversation;
|
||||
final inputDecoration = AppComposerStyle.inputDecoration(
|
||||
context,
|
||||
hintText: context.l10n.assistantHint,
|
||||
);
|
||||
Widget modelButton() => AppDropdownMenu(
|
||||
enabled: !chat.busy && !choosingModel,
|
||||
minWidth: ComposerLayout.menuWidth,
|
||||
maxHeight: ComposerLayout.menuListMaxHeight,
|
||||
items: [
|
||||
for (final p in available) ...[
|
||||
AppMenuLabel(p.name),
|
||||
for (final m in p.models)
|
||||
AppMenuItem(
|
||||
label: m.id,
|
||||
selectOption: true,
|
||||
selected: p.id == providerId && m.id == modelId,
|
||||
onPressed: () => unawaited(chooseModel(p.id, m.id)),
|
||||
),
|
||||
],
|
||||
const Divider(height: 1),
|
||||
AppMenuItem(
|
||||
label: context.l10n.agentConfigureModel,
|
||||
onPressed: () => showSettingsPage(context, initialTab: 1),
|
||||
),
|
||||
],
|
||||
builder: (context, toggle, focus) => Tooltip(
|
||||
message: selectedModel?.id ?? context.l10n.agentConfigureModel,
|
||||
child: AppToolbarDropdownButton(
|
||||
buttonKey: const Key('floating-agent-model-picker'),
|
||||
focusNode: focus,
|
||||
onPressed: toggle,
|
||||
style: AppComposerStyle.controlButton(context),
|
||||
child: const Icon(AppIcons.model, size: ComposerLayout.iconSize),
|
||||
),
|
||||
),
|
||||
);
|
||||
final conversationView = ExcludeFocus(
|
||||
excluding: !widget.expanded && !_resizing,
|
||||
child: IgnorePointer(
|
||||
ignoring: !widget.expanded && !_resizing,
|
||||
child: LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final height = constraints.maxHeight.clamp(
|
||||
AppControlSize.panelToolbar + 1,
|
||||
double.infinity,
|
||||
);
|
||||
return ClipRect(
|
||||
child: OverflowBox(
|
||||
alignment: Alignment.topCenter,
|
||||
minHeight: height,
|
||||
maxHeight: height,
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: AppControlSize.panelToolbar,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: AppSpacing.small,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
IconButton(
|
||||
key: const Key('floating-agent-collapse'),
|
||||
style: AppComposerStyle.controlIcon(context),
|
||||
tooltip: context.l10n.agentCollapseConversation,
|
||||
onPressed: widget.onToggleExpanded,
|
||||
icon: const Icon(
|
||||
AppIcons.remove,
|
||||
size: AppIconSize.header,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: AppDropdownMenu(
|
||||
minWidth: ComposerLayout.menuWidth,
|
||||
maxHeight: ComposerLayout.menuListMaxHeight,
|
||||
items: [
|
||||
AppMenuItem(
|
||||
label: context.l10n.agentNewConversation,
|
||||
onPressed: () => ref
|
||||
.read(
|
||||
conversationSidebarProvider.notifier,
|
||||
)
|
||||
.newConversation(),
|
||||
),
|
||||
for (final item in items)
|
||||
AppMenuItem(
|
||||
label: item.title,
|
||||
selectOption: true,
|
||||
selected: item.id == selection.selectedId,
|
||||
onPressed: () {
|
||||
final controller = ref.read(
|
||||
conversationSidebarProvider.notifier,
|
||||
);
|
||||
controller.activate(item);
|
||||
unawaited(
|
||||
controller.rememberSelection(item),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
builder: (context, toggle, focus) =>
|
||||
AppToolbarDropdownButton(
|
||||
focusNode: focus,
|
||||
onPressed: toggle,
|
||||
child: Row(
|
||||
children: [
|
||||
Flexible(
|
||||
child: Text(
|
||||
title,
|
||||
key: const Key(
|
||||
'agent-floating-title',
|
||||
),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
width: AppSpacing.tiny,
|
||||
),
|
||||
const Icon(
|
||||
AppIcons.expandMore,
|
||||
size: AppIconSize.header,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
key: const Key('floating-agent-dock'),
|
||||
style: AppComposerStyle.controlIcon(context),
|
||||
tooltip: context.l10n.agentDock,
|
||||
onPressed: widget.onDock,
|
||||
icon: const Icon(
|
||||
AppIcons.exitFullscreen,
|
||||
size: AppIconSize.header,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: ListView(
|
||||
controller: _scroll,
|
||||
key: const Key('floating-agent-messages'),
|
||||
padding: const EdgeInsets.all(AppSpacing.medium),
|
||||
children: [
|
||||
for (final message in chat.messages)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
bottom: AppSpacing.large,
|
||||
),
|
||||
child: Align(
|
||||
alignment: message.isUser
|
||||
? Alignment.centerRight
|
||||
: Alignment.centerLeft,
|
||||
child: Container(
|
||||
constraints: const BoxConstraints(
|
||||
maxWidth: ComposerLayout.maxWidth,
|
||||
),
|
||||
padding: message.isUser
|
||||
? const EdgeInsets.symmetric(
|
||||
horizontal: AppSpacing.medium,
|
||||
vertical: AppSpacing.itemVertical,
|
||||
)
|
||||
: EdgeInsets.zero,
|
||||
decoration: message.isUser
|
||||
? AppTheme.userMessageDecoration(context)
|
||||
: null,
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
if (message.elapsedMs case final elapsed?)
|
||||
Text(
|
||||
context.l10n.agentElapsedTime(
|
||||
context.l10n.durationSeconds(
|
||||
(elapsed / 1000).ceil(),
|
||||
),
|
||||
),
|
||||
style: AppTheme.chatMetaTextStyle(
|
||||
context,
|
||||
),
|
||||
),
|
||||
if (message.isUser)
|
||||
BreakableSelectableText(
|
||||
text: AgentComposerMessage.decode(
|
||||
message.text,
|
||||
).text,
|
||||
style: AppTheme.chatMessageTextStyle(
|
||||
context,
|
||||
),
|
||||
)
|
||||
else
|
||||
SelectableText(
|
||||
AgentComposerMessage.decode(
|
||||
message.text,
|
||||
).text,
|
||||
style: AppTheme.chatMessageTextStyle(
|
||||
context,
|
||||
),
|
||||
),
|
||||
for (final attachment
|
||||
in AgentComposerMessage.decode(
|
||||
message.text,
|
||||
).attachments)
|
||||
Chip(label: Text(attachment.name)),
|
||||
if (message.interrupted)
|
||||
Text(context.l10n.replyInterrupted),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
AgentReplyRegion(
|
||||
projectId: projectId,
|
||||
conversationId: selection.selectedId,
|
||||
draftKey: selection.selectedId == null
|
||||
? selection.draftKey
|
||||
: null,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
final composerView = Padding(
|
||||
key: const Key('floating-agent-input-area'),
|
||||
padding: const EdgeInsets.all(AppSpacing.small),
|
||||
child: LayoutBuilder(
|
||||
builder: (context, constraints) => ComposerSuggestionSurface(
|
||||
controller: widget.input,
|
||||
width: constraints.maxWidth,
|
||||
projectId: projectId,
|
||||
assets: assets,
|
||||
timelines: widget.state.timelines,
|
||||
onSend: send,
|
||||
builder: (context, focus) {
|
||||
final attachment = IconButton(
|
||||
style: AppComposerStyle.controlIcon(context),
|
||||
tooltip: context.l10n.addAttachment,
|
||||
onPressed:
|
||||
projectId == null || importing || widget.state.projectBusy
|
||||
? null
|
||||
: () async {
|
||||
try {
|
||||
await widget.composer.pickAttachments();
|
||||
} catch (_) {
|
||||
/* Shared composer publishes import feedback. */
|
||||
}
|
||||
},
|
||||
icon: const Icon(AppIcons.add),
|
||||
);
|
||||
final input = TextField(
|
||||
key: const Key('floating-agent-input'),
|
||||
controller: widget.input,
|
||||
focusNode: focus,
|
||||
minLines: 1,
|
||||
maxLines: 5,
|
||||
style: AppTheme.composerTextStyle(context),
|
||||
cursorHeight: AppTheme.composerCursorHeight(context),
|
||||
decoration: inputDecoration.copyWith(
|
||||
constraints: const BoxConstraints(
|
||||
minHeight: ComposerLayout.controlSize,
|
||||
),
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
horizontal: AppSpacing.small,
|
||||
vertical: AppSpacing.tiny,
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
if (!widget.expanded) {
|
||||
widget.onToggleExpanded();
|
||||
}
|
||||
},
|
||||
);
|
||||
final submit = ValueListenableBuilder<TextEditingValue>(
|
||||
valueListenable: widget.input,
|
||||
builder: (context, value, _) => IconButton.filled(
|
||||
style: AppTheme.accentIconButtonStyle(context)
|
||||
.merge(AppComposerStyle.controlIcon(context)),
|
||||
tooltip: chat.busy
|
||||
? context.l10n.stopReply
|
||||
: context.l10n.sendMessage,
|
||||
onPressed: chat.busy
|
||||
? (chat.stopping ? null : ref.read(provider!.notifier).stop)
|
||||
: provider != null &&
|
||||
timelineId != null &&
|
||||
configured &&
|
||||
!importing &&
|
||||
!choosingModel &&
|
||||
!widget.input.hasInvalidReferences &&
|
||||
(value.text.trim().isNotEmpty ||
|
||||
widget.composer.attachments.isNotEmpty)
|
||||
? send
|
||||
: null,
|
||||
icon: Icon(
|
||||
chat.busy ? AppIcons.squareFilled : AppIcons.arrowUp,
|
||||
size: chat.busy ? 12 : ComposerLayout.iconSize,
|
||||
),
|
||||
),
|
||||
);
|
||||
// Keep the editor at the same tree position and bottom
|
||||
// anchor while the conversation opens above it.
|
||||
return Row(
|
||||
key: const Key('floating-agent-composer'),
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
attachment,
|
||||
Expanded(child: input),
|
||||
modelButton(),
|
||||
submit,
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
final content = LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final conversationHeight =
|
||||
(constraints.maxHeight -
|
||||
ComposerLayout.controlSize -
|
||||
AppSpacing.small * 2)
|
||||
.clamp(0.0, double.infinity);
|
||||
return AnimatedBuilder(
|
||||
animation: _reveal,
|
||||
builder: (context, _) => MediaImportFeedbackListener(
|
||||
feedback: widget.composer.feedback,
|
||||
child: Material(
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
child: Stack(
|
||||
children: [
|
||||
Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Flexible(
|
||||
child: SizedBox(
|
||||
key: const Key('floating-agent-conversation-region'),
|
||||
height: conversationHeight * _reveal.value,
|
||||
child: ClipRect(
|
||||
child: Stack(
|
||||
children: [
|
||||
Offstage(
|
||||
offstage: _reveal.value == 0,
|
||||
child: conversationView,
|
||||
),
|
||||
Positioned(
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
child: Divider(
|
||||
key: const Key(
|
||||
'floating-agent-input-divider',
|
||||
),
|
||||
height: 1,
|
||||
thickness: 1,
|
||||
color: AppTheme.floatingDialogDividerColor(
|
||||
context,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
if (chat.error case final error?)
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(AppSpacing.small),
|
||||
child: Text(
|
||||
agentChatErrorMessage(context, error),
|
||||
style: Theme.of(context).textTheme.bodySmall,
|
||||
),
|
||||
),
|
||||
if ({
|
||||
AgentChatError.recoveryRequired,
|
||||
AgentChatError.interrupted,
|
||||
AgentChatError.turnLimit,
|
||||
AgentChatError.exportReplyFailed,
|
||||
}.contains(chat.error))
|
||||
TextButton(
|
||||
onPressed:
|
||||
provider == null ||
|
||||
timelineId == null ||
|
||||
chat.busy
|
||||
? null
|
||||
: () => ref
|
||||
.read(provider.notifier)
|
||||
.send(
|
||||
chat.error ==
|
||||
AgentChatError.exportReplyFailed
|
||||
? context.l10n.agentRetrySummary
|
||||
: context.l10n.agentResumeTask,
|
||||
timelineId: timelineId,
|
||||
summaryOnly:
|
||||
chat.error ==
|
||||
AgentChatError.exportReplyFailed,
|
||||
resumeOnly:
|
||||
chat.error !=
|
||||
AgentChatError.exportReplyFailed,
|
||||
onUpdated: widget.onConversationUpdated,
|
||||
),
|
||||
child: Text(
|
||||
chat.error == AgentChatError.exportReplyFailed
|
||||
? context.l10n.agentRetrySummary
|
||||
: context.l10n.agentResumeTask,
|
||||
),
|
||||
),
|
||||
ValueListenableBuilder<TextEditingValue>(
|
||||
valueListenable: widget.input,
|
||||
builder: (context, _, _) =>
|
||||
widget.input.hasInvalidReferences
|
||||
? Padding(
|
||||
padding: const EdgeInsets.all(AppSpacing.small),
|
||||
child: Text(
|
||||
context.l10n.composerReferenceInvalid,
|
||||
style: AppSurfaces.of(context).errorText,
|
||||
),
|
||||
)
|
||||
: const SizedBox.shrink(),
|
||||
),
|
||||
if (widget.composer.attachments.isNotEmpty)
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(AppSpacing.small),
|
||||
child: Wrap(
|
||||
spacing: AppSpacing.gap,
|
||||
children: [
|
||||
for (final asset in widget.composer.attachments)
|
||||
if (assets
|
||||
.where((item) => item.id == asset.id)
|
||||
.firstOrNull
|
||||
case final document?)
|
||||
AgentAttachmentCard(
|
||||
asset: document,
|
||||
onRemove: () =>
|
||||
widget.composer.remove(asset.id),
|
||||
)
|
||||
else
|
||||
InputChip(
|
||||
label: Text(asset.name),
|
||||
onDeleted: () =>
|
||||
widget.composer.remove(asset.id),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
composerView,
|
||||
],
|
||||
),
|
||||
Positioned(
|
||||
top: 0,
|
||||
left: ComposerLayout.radius,
|
||||
right: ComposerLayout.radius,
|
||||
height: AppSpacing.small,
|
||||
child: Semantics(
|
||||
button: true,
|
||||
label: widget.expanded
|
||||
? context.l10n.agentCollapseConversation
|
||||
: context.l10n.agentExpandConversation,
|
||||
onTap: widget.onToggleExpanded,
|
||||
child: Stack(
|
||||
fit: StackFit.expand,
|
||||
children: [
|
||||
Center(
|
||||
child: Container(
|
||||
width: ComposerLayout.controlSize,
|
||||
height: 2,
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.onSurfaceVariant
|
||||
.withValues(alpha: .35),
|
||||
borderRadius: BorderRadius.circular(
|
||||
AppRadius.pill,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
WorkspaceResizeHandle(
|
||||
key: const Key('floating-agent-resize-handle'),
|
||||
axis: Axis.vertical,
|
||||
direction: -1,
|
||||
initialValue: _reveal.value * conversationHeight,
|
||||
onStart: _startResize,
|
||||
onResize: (height) {
|
||||
if (conversationHeight > 0) {
|
||||
_reveal.value = (height / conversationHeight)
|
||||
.clamp(0.0, 1.0);
|
||||
}
|
||||
},
|
||||
onEnd: _finishResize,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
return AgentAttachmentDropRegion(
|
||||
projectId: projectId,
|
||||
composer: widget.composer,
|
||||
shrinkWrap: true,
|
||||
child: content,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,8 @@ import '../../workspace/project_state.dart';
|
||||
|
||||
import '../projects/conversation_sidebar.dart';
|
||||
import 'agent_chat_panel.dart';
|
||||
import 'agent_panel_presentation.dart';
|
||||
import 'floating_agent_panel.dart';
|
||||
import 'agent_composer_store.dart';
|
||||
import 'composer_project_selector.dart';
|
||||
|
||||
@@ -19,11 +21,13 @@ class WorkspaceAgentSurface extends ConsumerWidget {
|
||||
required this.state,
|
||||
required this.onSelectProject,
|
||||
required this.onCreateProject,
|
||||
this.showProjectSelector = true,
|
||||
});
|
||||
|
||||
final ProjectState state;
|
||||
final ValueChanged<RecentProject>? onSelectProject;
|
||||
final VoidCallback? onCreateProject;
|
||||
final bool showProjectSelector;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
@@ -34,21 +38,54 @@ class WorkspaceAgentSurface extends ConsumerWidget {
|
||||
final composers = ref.watch(agentComposerStoreProvider);
|
||||
final projectId = state.activeProject?.id;
|
||||
final conversationId = selection.selectedId;
|
||||
final presentation = AgentPanelPresentation.of(context);
|
||||
if (presentation?.compact == true) {
|
||||
return FloatingAgentPanel(
|
||||
state: state,
|
||||
selection: selection,
|
||||
input: composers.input(
|
||||
projectId,
|
||||
conversationId,
|
||||
projectScoped: !showProjectSelector,
|
||||
),
|
||||
composer: composers.composer(
|
||||
projectId,
|
||||
conversationId ?? selection.draftKey,
|
||||
),
|
||||
expanded: presentation!.expanded,
|
||||
onToggleExpanded: presentation.onToggleExpanded!,
|
||||
onDock: presentation.onDock!,
|
||||
onConversationCreated: (item) => unawaited(
|
||||
conversations.updateListing(
|
||||
item,
|
||||
selectIfDraftKey: selection.draftKey,
|
||||
),
|
||||
),
|
||||
onConversationUpdated: (item) =>
|
||||
unawaited(conversations.updateListing(item)),
|
||||
);
|
||||
}
|
||||
return AgentChatPanel(
|
||||
key: ValueKey((projectId, conversationId ?? selection.draftKey)),
|
||||
inputController: composers.input(projectId, conversationId),
|
||||
inputController: composers.input(
|
||||
projectId,
|
||||
conversationId,
|
||||
projectScoped: !showProjectSelector,
|
||||
),
|
||||
composer: composers.composer(
|
||||
projectId,
|
||||
conversationId ?? selection.draftKey,
|
||||
),
|
||||
projectSelector: ComposerProjectSelector(
|
||||
backgroundColor: AppTheme.composerUtilityBackground(context),
|
||||
projects: state.recent,
|
||||
selected: state.activeProject,
|
||||
busy: state.projectBusy,
|
||||
onSelect: (project) => onSelectProject?.call(project),
|
||||
onCreate: onCreateProject,
|
||||
),
|
||||
projectSelector: showProjectSelector
|
||||
? ComposerProjectSelector(
|
||||
backgroundColor: AppTheme.composerUtilityBackground(context),
|
||||
projects: state.recent,
|
||||
selected: state.activeProject,
|
||||
busy: state.projectBusy,
|
||||
onSelect: (project) => onSelectProject?.call(project),
|
||||
onCreate: onCreateProject,
|
||||
)
|
||||
: null,
|
||||
composerColor: AppSurfaces.of(context).composerBackground,
|
||||
projectId: projectId,
|
||||
timelineId: state.timeline?.id,
|
||||
|
||||
Reference in new issue
Block a user