Gitea CI / Check code and tests (push) Successful in 6m37s
Gitea CI / Build Windows x64 app (push) Successful in 3m18s
Gitea CI / Build Android APK (push) Successful in 3m47s
Gitea CI / Audit and package Windows x64 (push) Successful in 1m7s
Gitea CI / Assemble and validate CI artifacts (push) Successful in 50s
Gitea CI / Gitea CI passed (push) Successful in 2s
Gitea Release / Prepare draft Release (push) Successful in 9s
Gitea Release / Upload Android to draft Release (push) Successful in 16s
Gitea Release / Upload Windows to draft Release (push) Successful in 22s
Gitea Release / Verify and publish Release (push) Successful in 14s
139 lines
4.2 KiB
Dart
139 lines
4.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../../l10n/l10n.dart';
|
|
|
|
import 'package:cutdex_ui/icons.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(AppIcons.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 ? AppIcons.expandMore : AppIcons.chevronRight),
|
|
),
|
|
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(AppIcons.edit),
|
|
),
|
|
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(AppIcons.more),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
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(AppIcons.more),
|
|
),
|
|
),
|
|
);
|
|
}
|