Files
cutdex/lib/app/shells/tablet_workspace_shell.dart
T
lingjhf 2e0033ce2d
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
feat(workspace): refresh desktop editing experience and prepare 0.1.2
2026-10-09 01:56:01 +08:00

101 lines
3.2 KiB
Dart

import 'dart:math' as math;
import 'package:cutdex_ui/icons.dart';
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(
AppIcons.chat,
key: Key('workspace-agent-destination'),
),
label: Text(context.l10n.workspaceAgent),
),
NavigationRailDestination(
icon: const Icon(
AppIcons.video,
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,
),
),
],
),
);
}