Gitea CI / Assemble and validate CI artifacts (push) Successful in 1m47s
Gitea CI / Check code and tests (push) Successful in 7m15s
Gitea CI / Build Android APK (push) Successful in 4m6s
Gitea CI / Build Windows x64 app (push) Successful in 3m34s
Gitea CI / Audit and package Windows x64 (push) Successful in 1m29s
Gitea CI / Gitea CI passed (push) Successful in 1s
Gitea Release / Prepare draft Release (push) Failing after 8s
Gitea Release / Upload Android to draft Release (push) Skipped
Gitea Release / Upload Windows to draft Release (push) Skipped
Gitea Release / Verify and publish Release (push) Skipped
252 lines
11 KiB
Dart
252 lines
11 KiB
Dart
import 'package:cutdex_native/cutdex_native.dart';
|
|
import 'package:cutdex_ui/icons.dart';
|
|
import 'package:cutdex_ui/theme.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
import '../../integrations/platform/editor_window_chrome.dart';
|
|
import '../../l10n/l10n.dart';
|
|
import '../../shared/layout/workspace_layout_metrics.dart';
|
|
import '../editor_theme.dart';
|
|
|
|
/// Keeps window chrome outside the shared workspace surface.
|
|
class DesktopWindowFrame extends StatelessWidget {
|
|
const DesktopWindowFrame({
|
|
super.key,
|
|
required this.integratedTitlebar,
|
|
required this.headerControls,
|
|
this.projectTabs,
|
|
this.headerTrailing = const SizedBox.shrink(),
|
|
this.settingsSelected = false,
|
|
this.workflowSelected = false,
|
|
required this.onHomePressed,
|
|
required this.onWorkflowPressed,
|
|
required this.onSettingsPressed,
|
|
required this.child,
|
|
});
|
|
|
|
static const railWidth = 44.0;
|
|
static const railButtonSize = 32.0;
|
|
static const railIconSize = 20.0;
|
|
static const headerHeight = AppDesktopMetrics.windowHeader;
|
|
static const headerInset = (railWidth - AppControlSize.headerButton) / 2;
|
|
static const contentInset = WorkspaceLayoutMetrics.desktopOuterSpacing;
|
|
final bool integratedTitlebar;
|
|
final Widget headerControls;
|
|
final Widget? projectTabs;
|
|
final Widget headerTrailing;
|
|
final bool settingsSelected;
|
|
final bool workflowSelected;
|
|
final VoidCallback onHomePressed;
|
|
final VoidCallback onWorkflowPressed;
|
|
final VoidCallback onSettingsPressed;
|
|
final Widget child;
|
|
|
|
@override
|
|
Widget build(BuildContext context) => Theme(
|
|
data: EditorTheme.desktop(Theme.of(context)),
|
|
child: Builder(builder: _buildFrame),
|
|
);
|
|
|
|
Widget _buildFrame(BuildContext context) => ColoredBox(
|
|
color: Theme.of(context).colorScheme.surfaceContainer,
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
children: [
|
|
SizedBox(
|
|
key: const Key('desktop-window-header'),
|
|
height: headerHeight,
|
|
child: WindowHeaderPadding(
|
|
child: Row(
|
|
children: [
|
|
Expanded(
|
|
child: projectTabs != null
|
|
? LayoutBuilder(
|
|
builder: (context, constraints) =>
|
|
SingleChildScrollView(
|
|
scrollDirection: Axis.horizontal,
|
|
child: SizedBox(
|
|
width: constraints.maxWidth.clamp(
|
|
240.0,
|
|
double.infinity,
|
|
),
|
|
child: Row(
|
|
children: [
|
|
if (integratedTitlebar)
|
|
SizedBox(
|
|
key: const Key(
|
|
'native-window-controls-space',
|
|
),
|
|
width:
|
|
EditorWindowChrome.leadingWidth,
|
|
height: headerHeight,
|
|
),
|
|
headerControls,
|
|
Expanded(
|
|
child: Padding(
|
|
padding: const EdgeInsets.symmetric(
|
|
horizontal: headerInset,
|
|
),
|
|
child: projectTabs!,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
)
|
|
: SingleChildScrollView(
|
|
scrollDirection: Axis.horizontal,
|
|
child: Row(
|
|
children: [
|
|
if (integratedTitlebar)
|
|
SizedBox(
|
|
key: const Key(
|
|
'native-window-controls-space',
|
|
),
|
|
width: EditorWindowChrome.leadingWidth,
|
|
height: headerHeight,
|
|
),
|
|
headerControls,
|
|
],
|
|
),
|
|
),
|
|
),
|
|
headerTrailing,
|
|
],
|
|
),
|
|
),
|
|
),
|
|
Expanded(
|
|
child: Row(
|
|
children: [
|
|
SizedBox(
|
|
key: const Key('desktop-navigation-rail'),
|
|
width: railWidth,
|
|
child: LayoutBuilder(
|
|
builder: (context, constraints) => SingleChildScrollView(
|
|
child: ConstrainedBox(
|
|
constraints: BoxConstraints(
|
|
minHeight: constraints.maxHeight,
|
|
),
|
|
child: IntrinsicHeight(
|
|
child: Padding(
|
|
padding: const EdgeInsets.symmetric(vertical: 10),
|
|
child: Column(
|
|
children: [
|
|
IconButton.filledTonal(
|
|
key: const ValueKey('desktop-rail-home'),
|
|
tooltip: context.l10n.navigationHome,
|
|
isSelected:
|
|
!settingsSelected && !workflowSelected,
|
|
style: IconButton.styleFrom(
|
|
fixedSize: const Size.square(railButtonSize),
|
|
minimumSize: const Size.square(
|
|
railButtonSize,
|
|
),
|
|
maximumSize: const Size.square(
|
|
railButtonSize,
|
|
),
|
|
padding: EdgeInsets.zero,
|
|
iconSize: railIconSize,
|
|
tapTargetSize:
|
|
MaterialTapTargetSize.shrinkWrap,
|
|
backgroundColor:
|
|
settingsSelected || workflowSelected
|
|
? Colors.transparent
|
|
: null,
|
|
),
|
|
onPressed: onHomePressed,
|
|
icon: const Icon(AppIcons.home),
|
|
),
|
|
const SizedBox(height: 8),
|
|
IconButton.filledTonal(
|
|
key: const ValueKey('desktop-rail-workflow'),
|
|
tooltip: context.l10n.workflow,
|
|
isSelected: workflowSelected,
|
|
style: IconButton.styleFrom(
|
|
fixedSize: const Size.square(railButtonSize),
|
|
minimumSize: const Size.square(
|
|
railButtonSize,
|
|
),
|
|
maximumSize: const Size.square(
|
|
railButtonSize,
|
|
),
|
|
padding: EdgeInsets.zero,
|
|
iconSize: railIconSize,
|
|
tapTargetSize:
|
|
MaterialTapTargetSize.shrinkWrap,
|
|
backgroundColor: workflowSelected
|
|
? null
|
|
: Colors.transparent,
|
|
),
|
|
onPressed: onWorkflowPressed,
|
|
icon: const Icon(AppIcons.timeline),
|
|
),
|
|
const Spacer(),
|
|
IconButton(
|
|
key: const Key('desktop-rail-settings'),
|
|
tooltip: context.l10n.settings,
|
|
isSelected: settingsSelected,
|
|
onPressed: onSettingsPressed,
|
|
style: IconButton.styleFrom(
|
|
fixedSize: const Size.square(railButtonSize),
|
|
minimumSize: const Size.square(
|
|
railButtonSize,
|
|
),
|
|
maximumSize: const Size.square(
|
|
railButtonSize,
|
|
),
|
|
padding: EdgeInsets.zero,
|
|
iconSize: railIconSize,
|
|
tapTargetSize:
|
|
MaterialTapTargetSize.shrinkWrap,
|
|
),
|
|
icon: const Icon(AppIcons.settings),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
Expanded(
|
|
child: Padding(
|
|
padding: const EdgeInsets.only(
|
|
left: contentInset,
|
|
right: contentInset,
|
|
bottom: contentInset,
|
|
),
|
|
child: SizedBox(
|
|
key: const Key('desktop-content-container'),
|
|
child: WindowHeaderPane(
|
|
offset: const Offset(
|
|
railWidth + contentInset,
|
|
headerHeight,
|
|
),
|
|
child: LayoutBuilder(
|
|
builder: (context, constraints) =>
|
|
constraints.maxWidth < 200
|
|
? SingleChildScrollView(
|
|
scrollDirection: Axis.horizontal,
|
|
child: SizedBox(
|
|
width: 200,
|
|
height: constraints.maxHeight,
|
|
child: child,
|
|
),
|
|
)
|
|
: child,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|