Files
cutdex/lib/app/shells/tablet_workspace_shell.dart
T
lingjhf 27e77fff39 feat: initial Cutdex application
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.
2026-10-05 23:36:23 +08:00

100 lines
3.1 KiB
Dart

import 'dart:math' as math;
import 'package:flutter/material.dart';
import '../../l10n/l10n.dart';
import '../../workspace/workspace_mode.dart';
import '../adaptive/workspace_layout_policy.dart';
import 'workspace_frame.dart';
/// Two working surfaces when space permits, with project navigation on demand.
class TabletWorkspaceShell extends StatelessWidget {
const TabletWorkspaceShell({
super.key,
required this.mode,
required this.onModeChanged,
required this.navigation,
required this.headerActions,
required this.title,
required this.integratedTitlebar,
required this.agent,
required this.editor,
});
final WorkspaceMode mode;
final ValueChanged<WorkspaceMode> onModeChanged;
final Widget navigation;
final Widget headerActions;
final String title;
final bool integratedTitlebar;
final Widget agent;
final Widget editor;
@override
Widget build(BuildContext context) => WorkspaceFrame(
key: const Key('tablet-workspace-shell'),
navigation: navigation,
headerActions: headerActions,
title: title,
integratedTitlebar: integratedTitlebar,
child: Row(
children: [
SizedBox(
width: 72,
child: LayoutBuilder(
builder: (context, constraints) => SingleChildScrollView(
child: SizedBox(
height: math.max(240, constraints.maxHeight),
child: NavigationRail(
selectedIndex: mode == WorkspaceMode.agent ? 0 : 1,
labelType: NavigationRailLabelType.all,
onDestinationSelected: (index) => onModeChanged(
index == 0 ? WorkspaceMode.agent : WorkspaceMode.cut,
),
destinations: [
NavigationRailDestination(
icon: const Icon(
Icons.chat_bubble_outline,
key: Key('workspace-agent-destination'),
),
label: Text(context.l10n.workspaceAgent),
),
NavigationRailDestination(
icon: const Icon(
Icons.movie_outlined,
key: Key('workspace-cut-destination'),
),
label: Text(context.l10n.workspaceCut),
),
],
),
),
),
),
),
const VerticalDivider(width: 1),
Expanded(
child: LayoutBuilder(
builder: (context, constraints) =>
mode == WorkspaceMode.agent &&
WorkspaceLayoutPolicy.showAgentBesideEditor(
constraints.maxWidth,
)
? Row(
children: [
SizedBox(width: constraints.maxWidth * .38, child: agent),
const VerticalDivider(width: 1),
Expanded(child: editor),
],
)
: mode == WorkspaceMode.agent
? agent
: editor,
),
),
],
),
);
}