Add the Flutter video editing application with project management, media import, timeline editing, preview, AI assistance, diagnostics and settings. Include shared UI and native host packages, platform runners, application tests and release tooling. Provide usage and contribution guides, the MIT license and third-party notices. Exclude local credentials, build outputs and validation data.
65 lines
2.2 KiB
Dart
65 lines
2.2 KiB
Dart
import 'dart:async';
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
|
|
import 'package:cutdex_ui/theme.dart';
|
|
|
|
import '../../workspace/project_state.dart';
|
|
|
|
import '../projects/conversation_sidebar.dart';
|
|
import 'agent_chat_panel.dart';
|
|
import 'agent_composer_store.dart';
|
|
import 'composer_project_selector.dart';
|
|
|
|
/// Shared conversation presentation, independent of the navigation sidebar.
|
|
class WorkspaceAgentSurface extends ConsumerWidget {
|
|
const WorkspaceAgentSurface({
|
|
super.key,
|
|
required this.state,
|
|
required this.onSelectProject,
|
|
required this.onCreateProject,
|
|
});
|
|
|
|
final ProjectState state;
|
|
final ValueChanged<RecentProject>? onSelectProject;
|
|
final VoidCallback? onCreateProject;
|
|
|
|
@override
|
|
Widget build(BuildContext context, WidgetRef ref) {
|
|
final selection = ref.watch(
|
|
conversationSelectionProvider(state.activeProject?.id),
|
|
);
|
|
final conversations = ref.read(conversationSidebarProvider.notifier);
|
|
final composers = ref.watch(agentComposerStoreProvider);
|
|
final projectId = state.activeProject?.id;
|
|
final conversationId = selection.selectedId;
|
|
return AgentChatPanel(
|
|
key: ValueKey((projectId, conversationId ?? selection.draftKey)),
|
|
inputController: composers.input(projectId, conversationId),
|
|
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,
|
|
),
|
|
composerColor: AppSurfaces.of(context).composerBackground,
|
|
projectId: projectId,
|
|
timelineId: state.timeline?.id,
|
|
conversationId: conversationId,
|
|
draftKey: conversationId == null ? selection.draftKey : null,
|
|
onConversationCreated: (item) => unawaited(
|
|
conversations.updateListing(item, selectIfDraftKey: selection.draftKey),
|
|
),
|
|
onConversationUpdated: (item) =>
|
|
unawaited(conversations.updateListing(item)),
|
|
);
|
|
}
|
|
}
|