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.
138 lines
4.2 KiB
Dart
138 lines
4.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../../l10n/l10n.dart';
|
|
|
|
import 'package:cutdex_ui/widgets.dart';
|
|
|
|
import '../../workspace/project_state.dart';
|
|
|
|
class TouchProjectsHeader extends StatelessWidget {
|
|
const TouchProjectsHeader({super.key, required this.onCreate});
|
|
final VoidCallback? onCreate;
|
|
|
|
@override
|
|
Widget build(BuildContext context) => Row(
|
|
children: [
|
|
Expanded(child: Text(context.l10n.projects)),
|
|
SizedBox.square(
|
|
dimension: 48,
|
|
child: IconButton(
|
|
key: const Key('create-project'),
|
|
tooltip: context.l10n.newProject,
|
|
onPressed: onCreate,
|
|
icon: const Icon(Icons.add),
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
|
|
/// Touch navigation keeps its actions visible and uses finger-sized targets.
|
|
class TouchProjectTile extends StatelessWidget {
|
|
const TouchProjectTile({
|
|
super.key,
|
|
required this.project,
|
|
required this.selected,
|
|
required this.expanded,
|
|
required this.availabilityLabel,
|
|
required this.onSelect,
|
|
required this.onToggle,
|
|
required this.onNewConversation,
|
|
required this.onRename,
|
|
required this.onRemove,
|
|
});
|
|
final RecentProject project;
|
|
final bool selected;
|
|
final bool expanded;
|
|
final String availabilityLabel;
|
|
final VoidCallback onSelect;
|
|
final VoidCallback onToggle;
|
|
final VoidCallback? onNewConversation;
|
|
final VoidCallback? onRename;
|
|
final VoidCallback? onRemove;
|
|
|
|
@override
|
|
Widget build(BuildContext context) => ListTile(
|
|
key: ValueKey('sidebar-project-${project.id}'),
|
|
contentPadding: EdgeInsets.zero,
|
|
minTileHeight: 56,
|
|
selected: selected,
|
|
leading: IconButton(
|
|
key: ValueKey('sidebar-project-toggle-${project.id}'),
|
|
constraints: const BoxConstraints.tightFor(width: 48, height: 48),
|
|
tooltip: expanded
|
|
? context.l10n.collapseProject
|
|
: context.l10n.expandProject,
|
|
onPressed: onToggle,
|
|
icon: Icon(expanded ? Icons.expand_more : Icons.chevron_right),
|
|
),
|
|
title: Text(project.name, maxLines: 1, overflow: TextOverflow.ellipsis),
|
|
subtitle: project.availability.canOpen ? null : Text(availabilityLabel),
|
|
trailing: Row(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
IconButton(
|
|
key: ValueKey('new-agent-conversation-${project.id}'),
|
|
constraints: const BoxConstraints.tightFor(width: 48, height: 48),
|
|
tooltip: context.l10n.agentNewConversation,
|
|
onPressed: onNewConversation,
|
|
icon: const Icon(Icons.edit_square),
|
|
),
|
|
AppPopover(
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
AppMenuItem(label: context.l10n.rename, onPressed: onRename),
|
|
AppMenuItem(
|
|
label: context.l10n.removeProjectFromSidebar,
|
|
onPressed: onRemove,
|
|
),
|
|
],
|
|
),
|
|
builder: (context, toggle) => IconButton(
|
|
key: ValueKey('sidebar-project-more-${project.id}'),
|
|
constraints: const BoxConstraints.tightFor(width: 48, height: 48),
|
|
onPressed: toggle,
|
|
icon: const Icon(Icons.more_horiz),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
onTap: onSelect,
|
|
);
|
|
}
|
|
|
|
class TouchConversationTile extends StatelessWidget {
|
|
const TouchConversationTile({
|
|
super.key,
|
|
required this.id,
|
|
required this.title,
|
|
required this.selected,
|
|
required this.onSelect,
|
|
required this.actions,
|
|
});
|
|
final String id;
|
|
final String title;
|
|
final bool selected;
|
|
final VoidCallback onSelect;
|
|
final List<Widget> Function(BuildContext) actions;
|
|
|
|
@override
|
|
Widget build(BuildContext context) => ListTile(
|
|
key: ValueKey('sidebar-conversation-$id'),
|
|
minTileHeight: 48,
|
|
selected: selected,
|
|
title: Text(title, maxLines: 1, overflow: TextOverflow.ellipsis),
|
|
onTap: onSelect,
|
|
trailing: AppPopover(
|
|
child: Column(mainAxisSize: MainAxisSize.min, children: actions(context)),
|
|
builder: (context, toggle) => IconButton(
|
|
key: ValueKey('sidebar-conversation-more-$id'),
|
|
constraints: const BoxConstraints.tightFor(width: 48, height: 48),
|
|
onPressed: toggle,
|
|
icon: const Icon(Icons.more_horiz),
|
|
),
|
|
),
|
|
);
|
|
}
|