refactor(desktop): reorganize workspace panels and navigation
This commit is contained in:
1 parent
826745b407
commit
1f73765745
92 files changed
+5811
-2650
No files matched your search
@@ -14,7 +14,9 @@ import 'package:cutdex_ui/widgets.dart';
|
||||
import '../media/background_tasks_dialog.dart';
|
||||
|
||||
class BackgroundTasksButton extends ConsumerWidget {
|
||||
const BackgroundTasksButton({super.key});
|
||||
const BackgroundTasksButton({super.key, this.iconSize = AppIconSize.header});
|
||||
|
||||
final double iconSize;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
@@ -40,7 +42,7 @@ class BackgroundTasksButton extends ConsumerWidget {
|
||||
onPressed: toggle,
|
||||
icon: Badge(
|
||||
isLabelVisible: hasRunningTasks(),
|
||||
child: const Icon(Icons.task_alt_outlined, size: AppIconSize.header),
|
||||
child: Icon(Icons.task_alt_outlined, size: iconSize),
|
||||
),
|
||||
);
|
||||
return AppPopover(
|
||||
|
||||
@@ -22,6 +22,7 @@ import '../properties/properties_editor_page.dart';
|
||||
import '../properties/properties_panel.dart';
|
||||
import '../timeline/timeline_panel.dart';
|
||||
import 'editor_presentation_controller.dart';
|
||||
import 'editor_panel_defaults.dart';
|
||||
import 'layouts/bounded_editor_layout.dart';
|
||||
import 'layouts/expanded_editor_layout.dart';
|
||||
|
||||
@@ -34,10 +35,12 @@ class EditorWorkspace extends ConsumerStatefulWidget {
|
||||
required this.projectName,
|
||||
required this.integratedTitlebar,
|
||||
required this.headerLeading,
|
||||
this.projectLoading = false,
|
||||
this.showProjectName = true,
|
||||
this.experience = DeviceExperience.desktop,
|
||||
});
|
||||
|
||||
final bool projectLoading;
|
||||
final String projectId;
|
||||
final String timelineId;
|
||||
final String projectName;
|
||||
@@ -79,53 +82,170 @@ class _EditorWorkspaceState extends ConsumerState<EditorWorkspace> {
|
||||
child: EditorPreviewPanel(
|
||||
projectId: widget.projectId,
|
||||
timelineId: widget.timelineId,
|
||||
pending: widget.projectLoading,
|
||||
),
|
||||
);
|
||||
final timeline = EditorTimelinePanel(
|
||||
projectId: widget.projectId,
|
||||
timelineId: widget.timelineId,
|
||||
pending: widget.projectLoading,
|
||||
);
|
||||
final properties = EditorPropertiesPanel(
|
||||
projectId: widget.projectId,
|
||||
timelineId: widget.timelineId,
|
||||
);
|
||||
final media = MediaPanel(projectId: widget.projectId);
|
||||
final properties = widget.projectLoading
|
||||
? const EditorEmptyPanel()
|
||||
: EditorPropertiesPanel(
|
||||
projectId: widget.projectId,
|
||||
timelineId: widget.timelineId,
|
||||
);
|
||||
final media = widget.projectLoading
|
||||
? const EditorEmptyPanel()
|
||||
: MediaPanel(projectId: widget.projectId);
|
||||
return ListenableBuilder(
|
||||
listenable: ref.watch(editorPresentationProvider(widget.projectId)),
|
||||
builder: (context, _) => LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final desktop = widget.experience == DeviceExperience.desktop;
|
||||
final sideWidth =
|
||||
(_presentation.mediaOpen
|
||||
? WorkspaceLayoutMetrics.mediaPanelWidth + 1
|
||||
: 0) +
|
||||
(_propertiesOpen
|
||||
? WorkspaceLayoutMetrics.propertiesPanelWidth + 1
|
||||
: 0);
|
||||
final sideWidth = (_propertiesOpen
|
||||
? WorkspaceLayoutMetrics.propertiesPanelWidth + 1
|
||||
: 0);
|
||||
final dockPanels =
|
||||
desktop &&
|
||||
constraints.maxWidth >=
|
||||
WorkspaceLayoutMetrics.previewMinimumWidth + sideWidth;
|
||||
final desktopTool = sideWidth == 0
|
||||
? null
|
||||
: _presentation.desktopTool(propertiesOpen: _propertiesOpen);
|
||||
final headerHeight = desktop ? AppControlSize.panelHeader : 48.0;
|
||||
final mediaOpen = desktop
|
||||
? dockPanels
|
||||
? _presentation.mediaOpen
|
||||
: desktopTool == EditorTool.media
|
||||
: _presentation.activeTool == EditorTool.media;
|
||||
final desktopTool = _propertiesOpen ? EditorTool.properties : null;
|
||||
final headerHeight = desktop ? AppControlSize.panelToolbar : 48.0;
|
||||
final mediaOpen = _presentation.activeTool == EditorTool.media;
|
||||
final propertiesOpen = desktop
|
||||
? dockPanels
|
||||
? _propertiesOpen
|
||||
: desktopTool == EditorTool.properties
|
||||
: _presentation.activeTool == EditorTool.properties;
|
||||
final header = Material(
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
child: SizedBox(
|
||||
key: const Key('editor-content-header'),
|
||||
height: headerHeight,
|
||||
child: Padding(
|
||||
padding: desktop
|
||||
? const EdgeInsets.symmetric(
|
||||
horizontal: AppSidebarMetrics.outerPadding,
|
||||
vertical: AppSpacing.gap,
|
||||
)
|
||||
: EdgeInsets.zero,
|
||||
child: WindowHeaderPadding(
|
||||
child: Row(
|
||||
children: [
|
||||
widget.headerLeading,
|
||||
Expanded(
|
||||
child: widget.showProjectName
|
||||
? Row(
|
||||
children: [
|
||||
Flexible(
|
||||
fit: FlexFit.loose,
|
||||
child: Text(
|
||||
widget.projectName,
|
||||
key: const Key('workspace-project-title'),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.titleSmall,
|
||||
),
|
||||
),
|
||||
Flexible(
|
||||
fit: FlexFit.loose,
|
||||
child: widget.projectLoading
|
||||
? const SizedBox.shrink()
|
||||
: _TimelineSaveStatus(
|
||||
projectId: widget.projectId,
|
||||
timelineId: widget.timelineId,
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
: const SizedBox.shrink(),
|
||||
),
|
||||
if (!desktop)
|
||||
HeaderControlRegion(
|
||||
child: SizedBox.square(
|
||||
dimension: desktop
|
||||
? AppControlSize.headerButton
|
||||
: 48,
|
||||
child: IconButton(
|
||||
key: const Key('editor-media-button'),
|
||||
tooltip: context.l10n.materials,
|
||||
isSelected: mediaOpen,
|
||||
onPressed: () {
|
||||
if (desktop) {
|
||||
if (!dockPanels &&
|
||||
desktopTool != EditorTool.media &&
|
||||
_presentation.mediaOpen) {
|
||||
_presentation.preferDesktopTool(
|
||||
EditorTool.media,
|
||||
);
|
||||
} else {
|
||||
_presentation.toggleMedia();
|
||||
}
|
||||
} else {
|
||||
_presentation.toggleTool(EditorTool.media);
|
||||
}
|
||||
},
|
||||
icon: const Icon(Icons.perm_media_outlined),
|
||||
),
|
||||
),
|
||||
),
|
||||
if (!desktop) const SizedBox(width: AppSpacing.tiny),
|
||||
HeaderControlRegion(
|
||||
child: SizedBox.square(
|
||||
dimension: desktop ? AppControlSize.headerButton : 48,
|
||||
child: IconButton(
|
||||
key: const Key('editor-properties-button'),
|
||||
tooltip: propertiesOpen
|
||||
? context.l10n.collapseProperties
|
||||
: context.l10n.expandProperties,
|
||||
isSelected: propertiesOpen,
|
||||
onPressed: !viewSettings.hasValue
|
||||
? null
|
||||
: () {
|
||||
if (desktop) {
|
||||
if (dockPanels ||
|
||||
desktopTool ==
|
||||
EditorTool.properties ||
|
||||
!_propertiesOpen) {
|
||||
_viewController.setPropertiesOpen(
|
||||
!_propertiesOpen,
|
||||
);
|
||||
_saveViewSettings();
|
||||
}
|
||||
_presentation.preferDesktopTool(
|
||||
EditorTool.properties,
|
||||
);
|
||||
} else {
|
||||
_presentation.toggleTool(
|
||||
EditorTool.properties,
|
||||
);
|
||||
}
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.tune,
|
||||
size: AppIconSize.header,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
if (!desktop) const SizedBox(width: AppSpacing.compact),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
Widget dockedEditing({required bool showTools}) =>
|
||||
ExpandedEditorLayout(
|
||||
preview: preview,
|
||||
header: header,
|
||||
properties: properties,
|
||||
media: media,
|
||||
showMedia: showTools && _presentation.mediaOpen,
|
||||
showMedia: false,
|
||||
showProperties: showTools && _propertiesOpen,
|
||||
timelineHeight: _timelineHeight,
|
||||
onTimelineHeightChanged: (height) {
|
||||
@@ -141,121 +261,7 @@ class _EditorWorkspaceState extends ConsumerState<EditorWorkspace> {
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
Material(
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
child: SizedBox(
|
||||
key: const Key('editor-content-header'),
|
||||
height: headerHeight,
|
||||
child: WindowHeaderPadding(
|
||||
child: Row(
|
||||
children: [
|
||||
widget.headerLeading,
|
||||
Expanded(
|
||||
child: widget.showProjectName
|
||||
? Row(
|
||||
children: [
|
||||
Flexible(
|
||||
fit: FlexFit.loose,
|
||||
child: Text(
|
||||
widget.projectName,
|
||||
key: const Key(
|
||||
'workspace-project-title',
|
||||
),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.titleSmall,
|
||||
),
|
||||
),
|
||||
Flexible(
|
||||
fit: FlexFit.loose,
|
||||
child: _TimelineSaveStatus(
|
||||
projectId: widget.projectId,
|
||||
timelineId: widget.timelineId,
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
: const SizedBox.shrink(),
|
||||
),
|
||||
HeaderControlRegion(
|
||||
child: SizedBox.square(
|
||||
dimension: desktop
|
||||
? AppControlSize.headerButton
|
||||
: 48,
|
||||
child: IconButton(
|
||||
key: const Key('editor-media-button'),
|
||||
tooltip: context.l10n.materials,
|
||||
isSelected: mediaOpen,
|
||||
onPressed: () {
|
||||
if (desktop) {
|
||||
if (!dockPanels &&
|
||||
desktopTool != EditorTool.media &&
|
||||
_presentation.mediaOpen) {
|
||||
_presentation.preferDesktopTool(
|
||||
EditorTool.media,
|
||||
);
|
||||
} else {
|
||||
_presentation.toggleMedia();
|
||||
}
|
||||
} else {
|
||||
_presentation.toggleTool(
|
||||
EditorTool.media,
|
||||
);
|
||||
}
|
||||
},
|
||||
icon: const Icon(Icons.perm_media_outlined),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: AppSpacing.tiny),
|
||||
HeaderControlRegion(
|
||||
child: SizedBox.square(
|
||||
dimension: desktop
|
||||
? AppControlSize.headerButton
|
||||
: 48,
|
||||
child: IconButton(
|
||||
key: const Key('editor-properties-button'),
|
||||
tooltip: propertiesOpen
|
||||
? context.l10n.collapseProperties
|
||||
: context.l10n.expandProperties,
|
||||
isSelected: propertiesOpen,
|
||||
onPressed: !viewSettings.hasValue
|
||||
? null
|
||||
: () {
|
||||
if (desktop) {
|
||||
if (dockPanels ||
|
||||
desktopTool ==
|
||||
EditorTool.properties ||
|
||||
!_propertiesOpen) {
|
||||
_viewController.setPropertiesOpen(
|
||||
!_propertiesOpen,
|
||||
);
|
||||
_saveViewSettings();
|
||||
}
|
||||
_presentation.preferDesktopTool(
|
||||
EditorTool.properties,
|
||||
);
|
||||
} else {
|
||||
_presentation.toggleTool(
|
||||
EditorTool.properties,
|
||||
);
|
||||
}
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.tune,
|
||||
size: AppIconSize.header,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: AppSpacing.compact),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
if (!desktop) header,
|
||||
Expanded(
|
||||
child: dockPanels
|
||||
? dockedEditing(showTools: true)
|
||||
@@ -270,26 +276,33 @@ class _EditorWorkspaceState extends ConsumerState<EditorWorkspace> {
|
||||
tool: desktop
|
||||
? desktopTool
|
||||
: _presentation.activeTool,
|
||||
media: switch (widget.experience) {
|
||||
DeviceExperience.desktop => media,
|
||||
DeviceExperience.tablet => MediaBrowserDrawer(
|
||||
projectId: widget.projectId,
|
||||
),
|
||||
DeviceExperience.phone => MediaBrowserPage(
|
||||
projectId: widget.projectId,
|
||||
),
|
||||
},
|
||||
properties: switch (widget.experience) {
|
||||
DeviceExperience.desktop => properties,
|
||||
DeviceExperience.tablet => PropertiesToolPanel(
|
||||
projectId: widget.projectId,
|
||||
timelineId: widget.timelineId,
|
||||
),
|
||||
DeviceExperience.phone => PropertiesEditorPage(
|
||||
projectId: widget.projectId,
|
||||
timelineId: widget.timelineId,
|
||||
),
|
||||
},
|
||||
media: widget.projectLoading
|
||||
? media
|
||||
: switch (widget.experience) {
|
||||
DeviceExperience.desktop => media,
|
||||
DeviceExperience.tablet =>
|
||||
MediaBrowserDrawer(
|
||||
projectId: widget.projectId,
|
||||
),
|
||||
DeviceExperience.phone => MediaBrowserPage(
|
||||
projectId: widget.projectId,
|
||||
),
|
||||
},
|
||||
properties: widget.projectLoading
|
||||
? properties
|
||||
: switch (widget.experience) {
|
||||
DeviceExperience.desktop => properties,
|
||||
DeviceExperience.tablet =>
|
||||
PropertiesToolPanel(
|
||||
projectId: widget.projectId,
|
||||
timelineId: widget.timelineId,
|
||||
),
|
||||
DeviceExperience.phone =>
|
||||
PropertiesEditorPage(
|
||||
projectId: widget.projectId,
|
||||
timelineId: widget.timelineId,
|
||||
),
|
||||
},
|
||||
onCloseTool: () {
|
||||
if (!desktop) {
|
||||
_presentation.closeTool();
|
||||
@@ -304,14 +317,15 @@ class _EditorWorkspaceState extends ConsumerState<EditorWorkspace> {
|
||||
),
|
||||
],
|
||||
),
|
||||
Positioned(
|
||||
key: const Key('editing-top-divider'),
|
||||
top: headerHeight,
|
||||
left: 0,
|
||||
right: 0,
|
||||
height: 1,
|
||||
child: const Divider(height: 1),
|
||||
),
|
||||
if (!desktop)
|
||||
Positioned(
|
||||
key: const Key('editing-top-divider'),
|
||||
top: headerHeight,
|
||||
left: 0,
|
||||
right: 0,
|
||||
height: 1,
|
||||
child: const Divider(height: 1),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
import 'package:cutdex_ui/widgets.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// Empty values while a project's content is being bound to its cards.
|
||||
class EditorEmptyPanel extends StatelessWidget {
|
||||
const EditorEmptyPanel({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) =>
|
||||
const WorkspacePanel(child: SizedBox.expand());
|
||||
}
|
||||
|
||||
class EditorTimelineDefaults extends StatelessWidget {
|
||||
const EditorTimelineDefaults({super.key, this.showTabs = true});
|
||||
|
||||
final bool showTabs;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Column(
|
||||
children: [
|
||||
if (showTabs) ...[
|
||||
const SizedBox(
|
||||
key: Key('timeline-tabs-bar'),
|
||||
height: 26,
|
||||
child: Row(
|
||||
children: [
|
||||
IconButton(onPressed: null, icon: Icon(Icons.add, size: 16)),
|
||||
],
|
||||
),
|
||||
),
|
||||
const Divider(height: 1),
|
||||
],
|
||||
Expanded(
|
||||
child: WorkspacePanel(
|
||||
headerHeight: 32,
|
||||
headerPadding: EdgeInsets.zero,
|
||||
controls: SizedBox(
|
||||
key: const Key('timeline-toolbar'),
|
||||
height: 32,
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: Row(
|
||||
children: [
|
||||
for (final icon in [
|
||||
Icons.undo,
|
||||
Icons.redo,
|
||||
Icons.content_cut,
|
||||
Icons.align_horizontal_left,
|
||||
Icons.align_horizontal_right,
|
||||
Icons.delete_outline,
|
||||
])
|
||||
IconButton(onPressed: null, icon: Icon(icon, size: 16)),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
child: const SizedBox.expand(key: Key('timeline-default-tracks')),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
@@ -36,7 +36,7 @@ class BoundedEditorLayout extends StatelessWidget {
|
||||
Widget toolSurface() => Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: desktop ? AppControlSize.panelHeader : 48,
|
||||
height: desktop ? AppControlSize.panelToolbar : 48,
|
||||
child: Row(
|
||||
children: [
|
||||
SizedBox.square(
|
||||
@@ -92,7 +92,7 @@ class BoundedEditorLayout extends StatelessWidget {
|
||||
),
|
||||
if (tool != null)
|
||||
Positioned(
|
||||
top: 0,
|
||||
top: desktop ? AppControlSize.panelToolbar + 1 : 0,
|
||||
bottom: 0,
|
||||
right: 0,
|
||||
width: page
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
import 'dart:math' as math;
|
||||
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cutdex_ui/theme.dart';
|
||||
|
||||
import '../../../shared/layout/workspace_layout_metrics.dart';
|
||||
import '../../../shared/widgets/workspace_card.dart';
|
||||
import '../../../shared/widgets/workspace_resize_handle.dart';
|
||||
|
||||
class ExpandedEditorLayout extends StatefulWidget {
|
||||
const ExpandedEditorLayout({
|
||||
super.key,
|
||||
required this.preview,
|
||||
required this.header,
|
||||
required this.properties,
|
||||
required this.media,
|
||||
required this.showMedia,
|
||||
@@ -20,6 +23,7 @@ class ExpandedEditorLayout extends StatefulWidget {
|
||||
});
|
||||
|
||||
final Widget preview;
|
||||
final Widget header;
|
||||
final Widget properties;
|
||||
final Widget media;
|
||||
final bool showMedia;
|
||||
@@ -34,15 +38,20 @@ class ExpandedEditorLayout extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _ExpandedEditorLayoutState extends State<ExpandedEditorLayout> {
|
||||
double? _timelineDragStartY;
|
||||
double _timelineDragStartHeight = 0;
|
||||
static const gap = WorkspaceLayoutMetrics.desktopSpacing;
|
||||
|
||||
Widget _card(String name, Widget child) =>
|
||||
WorkspaceCard(key: Key('editor-$name-card'), child: child);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final maximum = math.max(
|
||||
0.0,
|
||||
constraints.maxHeight - WorkspaceLayoutMetrics.timelineMinimumHeight,
|
||||
constraints.maxHeight -
|
||||
gap -
|
||||
AppControlSize.panelToolbar -
|
||||
WorkspaceLayoutMetrics.timelineMinimumHeight,
|
||||
);
|
||||
final minimum = math.min(
|
||||
WorkspaceLayoutMetrics.timelineMinimumHeight,
|
||||
@@ -66,76 +75,72 @@ class _ExpandedEditorLayoutState extends State<ExpandedEditorLayout> {
|
||||
Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
if (widget.showMedia) ...[
|
||||
SizedBox(
|
||||
key: const Key('editor-media-region'),
|
||||
width: mediaWidth,
|
||||
child: widget.media,
|
||||
child: _card(
|
||||
'preview',
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
widget.header,
|
||||
Expanded(
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
if (widget.showMedia) ...[
|
||||
SizedBox(
|
||||
key: const Key('editor-media-region'),
|
||||
width: mediaWidth,
|
||||
child: widget.media,
|
||||
),
|
||||
const VerticalDivider(width: 1),
|
||||
],
|
||||
Expanded(child: widget.preview),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const VerticalDivider(width: 1),
|
||||
if (widget.showProperties) ...[
|
||||
const VerticalDivider(
|
||||
key: Key('editor-properties-divider'),
|
||||
width: 1,
|
||||
),
|
||||
SizedBox(
|
||||
key: const Key('editor-properties-region'),
|
||||
width: propertiesWidth,
|
||||
child: widget.properties,
|
||||
),
|
||||
],
|
||||
],
|
||||
Expanded(child: widget.preview),
|
||||
if (widget.showProperties) ...[
|
||||
const VerticalDivider(width: 1),
|
||||
SizedBox(
|
||||
key: const Key('editor-properties-region'),
|
||||
width: propertiesWidth,
|
||||
child: widget.properties,
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 1),
|
||||
SizedBox(height: timelineHeight, child: widget.timeline),
|
||||
const SizedBox(height: gap),
|
||||
SizedBox(
|
||||
height: timelineHeight,
|
||||
child: _card('timeline', widget.timeline),
|
||||
),
|
||||
],
|
||||
),
|
||||
Positioned(
|
||||
key: const Key('editor-timeline-divider'),
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: timelineHeight - 4,
|
||||
height: 8,
|
||||
child: MouseRegion(
|
||||
cursor: SystemMouseCursors.resizeRow,
|
||||
child: GestureDetector(
|
||||
key: const Key('editor-timeline-resize'),
|
||||
behavior: HitTestBehavior.opaque,
|
||||
dragStartBehavior: DragStartBehavior.down,
|
||||
onVerticalDragStart: (details) {
|
||||
_timelineDragStartY = details.globalPosition.dy;
|
||||
_timelineDragStartHeight = timelineHeight;
|
||||
},
|
||||
onVerticalDragUpdate: (details) {
|
||||
final start = _timelineDragStartY;
|
||||
if (start == null) return;
|
||||
widget.onTimelineHeightChanged(
|
||||
(_timelineDragStartHeight +
|
||||
start -
|
||||
details.globalPosition.dy)
|
||||
.clamp(minimum, maximum)
|
||||
.toDouble(),
|
||||
);
|
||||
},
|
||||
onVerticalDragEnd: (_) {
|
||||
_timelineDragStartY = null;
|
||||
widget.onTimelineHeightChangeEnd();
|
||||
},
|
||||
onVerticalDragCancel: () {
|
||||
_timelineDragStartY = null;
|
||||
widget.onTimelineHeightChangeEnd();
|
||||
},
|
||||
child: const Center(
|
||||
child: SizedBox(
|
||||
height: 1,
|
||||
width: double.infinity,
|
||||
child: Divider(height: 1),
|
||||
),
|
||||
),
|
||||
bottom: timelineHeight - WorkspaceLayoutMetrics.desktopResizeSlop,
|
||||
height: WorkspaceLayoutMetrics.desktopResizeHitExtent,
|
||||
child: WorkspaceResizeHandle(
|
||||
key: const Key('editor-timeline-resize'),
|
||||
axis: Axis.vertical,
|
||||
initialValue: timelineHeight,
|
||||
direction: -1,
|
||||
onResize: (height) => widget.onTimelineHeightChanged(
|
||||
height.clamp(minimum, maximum).toDouble(),
|
||||
),
|
||||
onEnd: widget.onTimelineHeightChangeEnd,
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
Reference in new issue
Block a user