Files
cutdex/lib/app/shells/tablet_workspace_shell.dart
T
lingjhf abc1868550
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
feat(workspace): 桌面工作区、主题与交互更新,发布 0.1.2
2026-10-08 18:17:12 +00: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,
),
),
],
),
);
}