Move editor UI into the app and release verified Core dependencies (#14)
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
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
This commit was merged in pull request #14.
This commit is contained in:
1 parent
abc1868550
commit
06f1c26681
452 files changed
+43806
-2329
No files matched your search
@@ -1,12 +1,21 @@
|
||||
import 'dart:math' as math;
|
||||
|
||||
abstract final class WorkspaceLayoutMetrics {
|
||||
static const desktopSpacing = 6.0;
|
||||
static const desktopOuterSpacing = 6.0;
|
||||
static const desktopResizeSlop = 2.0;
|
||||
static const desktopResizeHitExtent = desktopSpacing + 2 * desktopResizeSlop;
|
||||
// Keep the cards compact; their two facing borders add another 2 px.
|
||||
static const desktopSpacing = 2.0;
|
||||
static const desktopOuterSpacing = desktopSpacing;
|
||||
// Resize targets overlap the panel edges without widening the visible gap.
|
||||
static const desktopResizeHitExtent = 10.0;
|
||||
// Cover the gutter and its facing borders without changing the hit target.
|
||||
static const desktopResizeHighlightThickness = 4.0;
|
||||
static const desktopResizeSlop =
|
||||
(desktopResizeHitExtent - desktopSpacing) / 2;
|
||||
static const dualPaneMinimumWidth = 840.0;
|
||||
|
||||
static const sidebarDefaultWidth = 240.0;
|
||||
static const sidebarMinimumWidth = 220.0;
|
||||
// Like VS Code SplitView, snap closed halfway past the minimum width.
|
||||
static const sidebarSnapThreshold = sidebarMinimumWidth / 2;
|
||||
static const sidebarWidthLimit = 320.0;
|
||||
static const contentMinimumWidth = 320.0;
|
||||
|
||||
@@ -15,9 +24,24 @@ abstract final class WorkspaceLayoutMetrics {
|
||||
static const previewMinimumHeight = 180.0;
|
||||
|
||||
static const mediaPanelWidth = 260.0;
|
||||
static const propertiesPanelWidth = 260.0;
|
||||
static const mediaPanelMinimumWidth = 220.0;
|
||||
static const propertiesPanelWidth = 240.0;
|
||||
static const previewMinimumWidth = 320.0;
|
||||
|
||||
static double resolveTimelineHeight(
|
||||
double availableHeight,
|
||||
double? requestedHeight,
|
||||
) {
|
||||
final maximum = math.max(
|
||||
0.0,
|
||||
availableHeight - desktopSpacing - previewMinimumHeight,
|
||||
);
|
||||
final minimum = math.min(timelineMinimumHeight, maximum);
|
||||
return (requestedHeight ?? availableHeight * timelineDefaultHeightFraction)
|
||||
.clamp(minimum, maximum)
|
||||
.toDouble();
|
||||
}
|
||||
|
||||
static double sidebarMaximumWidth(double availableWidth) =>
|
||||
(availableWidth - contentMinimumWidth)
|
||||
.clamp(sidebarMinimumWidth, sidebarWidthLimit)
|
||||
|
||||
@@ -4,7 +4,6 @@ import 'package:flutter/material.dart';
|
||||
import 'package:cutdex_ui/theme.dart';
|
||||
import 'package:cutdex_ui/widgets.dart';
|
||||
|
||||
|
||||
/// Shared layout for downloading a processing resource before a task starts.
|
||||
class ProcessingResourceDownloadDialog extends StatelessWidget {
|
||||
const ProcessingResourceDownloadDialog({
|
||||
|
||||
@@ -1,5 +1,94 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/scheduler.dart';
|
||||
|
||||
import '../layout/workspace_layout_metrics.dart';
|
||||
|
||||
enum WorkspaceResizeBoundary { sidebar, media, timeline }
|
||||
|
||||
/// Shares feedback for boundaries that meet at a resize junction.
|
||||
class WorkspaceResizeHighlightScope extends StatefulWidget {
|
||||
const WorkspaceResizeHighlightScope({super.key, required this.child});
|
||||
|
||||
final Widget child;
|
||||
|
||||
@override
|
||||
State<WorkspaceResizeHighlightScope> createState() =>
|
||||
_WorkspaceResizeHighlightScopeState();
|
||||
}
|
||||
|
||||
class _WorkspaceResizeHighlightScopeState
|
||||
extends State<WorkspaceResizeHighlightScope> {
|
||||
final _controller = _ResizeHighlightController();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => _ResizeHighlightScope(
|
||||
controller:
|
||||
context
|
||||
.dependOnInheritedWidgetOfExactType<_ResizeHighlightScope>()
|
||||
?.notifier ??
|
||||
_controller,
|
||||
child: widget.child,
|
||||
);
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_controller.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
class _ResizeHighlightScope
|
||||
extends InheritedNotifier<_ResizeHighlightController> {
|
||||
const _ResizeHighlightScope({
|
||||
required super.child,
|
||||
required _ResizeHighlightController controller,
|
||||
}) : super(notifier: controller);
|
||||
}
|
||||
|
||||
class _ResizeHighlightController extends ChangeNotifier {
|
||||
final _sources = <Object, Set<WorkspaceResizeBoundary>>{};
|
||||
bool _notificationPending = false;
|
||||
bool _disposed = false;
|
||||
|
||||
bool highlights(Set<WorkspaceResizeBoundary> boundaries) =>
|
||||
_sources.values.any((active) => active.any(boundaries.contains));
|
||||
|
||||
void update(
|
||||
Object source,
|
||||
Set<WorkspaceResizeBoundary> boundaries,
|
||||
bool active,
|
||||
) {
|
||||
if (_disposed) return;
|
||||
final next = active && boundaries.isNotEmpty ? boundaries : null;
|
||||
if (setEquals(_sources[source], next)) return;
|
||||
if (next == null) {
|
||||
_sources.remove(source);
|
||||
} else {
|
||||
_sources[source] = next;
|
||||
}
|
||||
// Handles can disappear while the layout is rebuilding (collapse/unmount).
|
||||
// Notify surviving handles after that frame instead of during their build.
|
||||
if (SchedulerBinding.instance.schedulerPhase ==
|
||||
SchedulerPhase.persistentCallbacks) {
|
||||
if (_notificationPending) return;
|
||||
_notificationPending = true;
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
_notificationPending = false;
|
||||
if (!_disposed) notifyListeners();
|
||||
});
|
||||
} else {
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_disposed = true;
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
/// Keeps the resize cursor active across the window while a split is dragged.
|
||||
class WorkspaceResizeHandle extends StatefulWidget {
|
||||
@@ -11,7 +100,30 @@ class WorkspaceResizeHandle extends StatefulWidget {
|
||||
this.direction = 1,
|
||||
this.onStart,
|
||||
this.onEnd,
|
||||
});
|
||||
this.highlightTargets = const {},
|
||||
this.highlightOffset = Offset.zero,
|
||||
}) : _orthogonalInitialValue = null,
|
||||
_onOrthogonalResize = null,
|
||||
_orthogonalDirection = 1;
|
||||
|
||||
const WorkspaceResizeHandle.junction({
|
||||
super.key,
|
||||
required double initialWidth,
|
||||
required double initialHeight,
|
||||
required ValueChanged<double> onWidthChanged,
|
||||
required ValueChanged<double> onHeightChanged,
|
||||
double verticalDirection = 1,
|
||||
this.onStart,
|
||||
this.onEnd,
|
||||
this.highlightTargets = const {},
|
||||
this.highlightOffset = Offset.zero,
|
||||
}) : axis = Axis.horizontal,
|
||||
initialValue = initialWidth,
|
||||
onResize = onWidthChanged,
|
||||
direction = 1,
|
||||
_orthogonalInitialValue = initialHeight,
|
||||
_onOrthogonalResize = onHeightChanged,
|
||||
_orthogonalDirection = verticalDirection;
|
||||
|
||||
final Axis axis;
|
||||
final double initialValue;
|
||||
@@ -19,6 +131,13 @@ class WorkspaceResizeHandle extends StatefulWidget {
|
||||
final VoidCallback? onStart;
|
||||
final ValueChanged<double> onResize;
|
||||
final VoidCallback? onEnd;
|
||||
final Set<WorkspaceResizeBoundary> highlightTargets;
|
||||
|
||||
/// Aligns feedback with an edge while keeping the full resize hit target.
|
||||
final Offset highlightOffset;
|
||||
final double? _orthogonalInitialValue;
|
||||
final ValueChanged<double>? _onOrthogonalResize;
|
||||
final double _orthogonalDirection;
|
||||
|
||||
@override
|
||||
State<WorkspaceResizeHandle> createState() => _WorkspaceResizeHandleState();
|
||||
@@ -26,10 +145,56 @@ class WorkspaceResizeHandle extends StatefulWidget {
|
||||
|
||||
class _WorkspaceResizeHandleState extends State<WorkspaceResizeHandle> {
|
||||
OverlayEntry? _cursorOverlay;
|
||||
double? _startPosition;
|
||||
Offset? _startPosition;
|
||||
double _startValue = 0;
|
||||
double _orthogonalStartValue = 0;
|
||||
bool _hovered = false;
|
||||
final _highlightSource = Object();
|
||||
_ResizeHighlightController? _highlightController;
|
||||
|
||||
MouseCursor get _cursor => widget.axis == Axis.horizontal
|
||||
bool get _locallyHighlighted => _hovered || _startPosition != null;
|
||||
bool get _highlighted =>
|
||||
_locallyHighlighted ||
|
||||
!_isJunction &&
|
||||
(_highlightController?.highlights(widget.highlightTargets) ?? false);
|
||||
|
||||
void _publishHighlight() => _highlightController?.update(
|
||||
_highlightSource,
|
||||
widget.highlightTargets,
|
||||
_locallyHighlighted,
|
||||
);
|
||||
|
||||
void _hover(bool value) {
|
||||
if (_hovered == value) return;
|
||||
setState(() => _hovered = value);
|
||||
_publishHighlight();
|
||||
}
|
||||
|
||||
@override
|
||||
void didChangeDependencies() {
|
||||
super.didChangeDependencies();
|
||||
final controller = context
|
||||
.dependOnInheritedWidgetOfExactType<_ResizeHighlightScope>()
|
||||
?.notifier;
|
||||
if (_highlightController == controller) return;
|
||||
_highlightController?.update(_highlightSource, const {}, false);
|
||||
_highlightController = controller;
|
||||
_publishHighlight();
|
||||
}
|
||||
|
||||
@override
|
||||
void didUpdateWidget(covariant WorkspaceResizeHandle oldWidget) {
|
||||
super.didUpdateWidget(oldWidget);
|
||||
if (!setEquals(oldWidget.highlightTargets, widget.highlightTargets)) {
|
||||
_publishHighlight();
|
||||
}
|
||||
}
|
||||
|
||||
bool get _isJunction => widget._onOrthogonalResize != null;
|
||||
|
||||
MouseCursor get _cursor => _isJunction
|
||||
? SystemMouseCursors.grab
|
||||
: widget.axis == Axis.horizontal
|
||||
? SystemMouseCursors.resizeColumn
|
||||
: SystemMouseCursors.resizeRow;
|
||||
|
||||
@@ -37,11 +202,13 @@ class _WorkspaceResizeHandleState extends State<WorkspaceResizeHandle> {
|
||||
widget.axis == Axis.horizontal ? position.dx : position.dy;
|
||||
|
||||
void _start(DragStartDetails details) {
|
||||
_startPosition = _coordinate(details.globalPosition);
|
||||
setState(() => _startPosition = details.globalPosition);
|
||||
_publishHighlight();
|
||||
_startValue = widget.initialValue;
|
||||
_orthogonalStartValue = widget._orthogonalInitialValue ?? 0;
|
||||
widget.onStart?.call();
|
||||
_releaseCursor();
|
||||
final cursor = _cursor;
|
||||
final cursor = _isJunction ? SystemMouseCursors.grabbing : _cursor;
|
||||
_cursorOverlay = OverlayEntry(
|
||||
builder: (_) => Positioned.fill(
|
||||
child: MouseRegion(
|
||||
@@ -60,7 +227,12 @@ class _WorkspaceResizeHandleState extends State<WorkspaceResizeHandle> {
|
||||
if (start == null) return;
|
||||
widget.onResize(
|
||||
_startValue +
|
||||
widget.direction * (_coordinate(details.globalPosition) - start),
|
||||
widget.direction *
|
||||
(_coordinate(details.globalPosition) - _coordinate(start)),
|
||||
);
|
||||
widget._onOrthogonalResize?.call(
|
||||
_orthogonalStartValue +
|
||||
widget._orthogonalDirection * (details.globalPosition.dy - start.dy),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -71,13 +243,16 @@ class _WorkspaceResizeHandleState extends State<WorkspaceResizeHandle> {
|
||||
}
|
||||
|
||||
void _finish() {
|
||||
_startPosition = null;
|
||||
if (_startPosition == null) return;
|
||||
setState(() => _startPosition = null);
|
||||
_publishHighlight();
|
||||
_releaseCursor();
|
||||
widget.onEnd?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_highlightController?.update(_highlightSource, const {}, false);
|
||||
_releaseCursor();
|
||||
super.dispose();
|
||||
}
|
||||
@@ -85,20 +260,79 @@ class _WorkspaceResizeHandleState extends State<WorkspaceResizeHandle> {
|
||||
@override
|
||||
Widget build(BuildContext context) => MouseRegion(
|
||||
cursor: _cursor,
|
||||
onEnter: (_) => _hover(true),
|
||||
onExit: (_) => _hover(false),
|
||||
child: GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
dragStartBehavior: DragStartBehavior.down,
|
||||
onHorizontalDragStart: widget.axis == Axis.horizontal ? _start : null,
|
||||
onHorizontalDragUpdate: widget.axis == Axis.horizontal ? _update : null,
|
||||
onHorizontalDragEnd: widget.axis == Axis.horizontal
|
||||
onHorizontalDragStart: !_isJunction && widget.axis == Axis.horizontal
|
||||
? _start
|
||||
: null,
|
||||
onHorizontalDragUpdate: !_isJunction && widget.axis == Axis.horizontal
|
||||
? _update
|
||||
: null,
|
||||
onHorizontalDragEnd: !_isJunction && widget.axis == Axis.horizontal
|
||||
? (_) => _finish()
|
||||
: null,
|
||||
onVerticalDragStart: widget.axis == Axis.vertical ? _start : null,
|
||||
onVerticalDragUpdate: widget.axis == Axis.vertical ? _update : null,
|
||||
onVerticalDragEnd: widget.axis == Axis.vertical ? (_) => _finish() : null,
|
||||
onHorizontalDragCancel: widget.axis == Axis.horizontal ? _finish : null,
|
||||
onVerticalDragCancel: widget.axis == Axis.vertical ? _finish : null,
|
||||
child: const SizedBox.expand(),
|
||||
onVerticalDragStart: !_isJunction && widget.axis == Axis.vertical
|
||||
? _start
|
||||
: null,
|
||||
onVerticalDragUpdate: !_isJunction && widget.axis == Axis.vertical
|
||||
? _update
|
||||
: null,
|
||||
onVerticalDragEnd: !_isJunction && widget.axis == Axis.vertical
|
||||
? (_) => _finish()
|
||||
: null,
|
||||
onHorizontalDragCancel: !_isJunction && widget.axis == Axis.horizontal
|
||||
? _finish
|
||||
: null,
|
||||
onVerticalDragCancel: !_isJunction && widget.axis == Axis.vertical
|
||||
? _finish
|
||||
: null,
|
||||
onPanStart: _isJunction ? _start : null,
|
||||
onPanUpdate: _isJunction ? _update : null,
|
||||
onPanEnd: _isJunction ? (_) => _finish() : null,
|
||||
onPanCancel: _isJunction ? _finish : null,
|
||||
child: IgnorePointer(
|
||||
child: Transform.translate(
|
||||
offset: widget.highlightOffset,
|
||||
child: Center(
|
||||
child: TweenAnimationBuilder<double>(
|
||||
tween: Tween(begin: 0, end: _highlighted ? 1 : 0),
|
||||
duration: MediaQuery.disableAnimationsOf(context)
|
||||
? Duration.zero
|
||||
: Duration(milliseconds: _highlighted ? 180 : 140),
|
||||
curve: Curves.easeInOutCubic,
|
||||
builder: (context, progress, child) => Opacity(
|
||||
opacity: progress,
|
||||
child: Transform.scale(
|
||||
scaleX: _isJunction || widget.axis == Axis.horizontal
|
||||
? .5 + .5 * progress
|
||||
: .98 + .02 * progress,
|
||||
scaleY: _isJunction || widget.axis == Axis.vertical
|
||||
? .5 + .5 * progress
|
||||
: .98 + .02 * progress,
|
||||
child: child,
|
||||
),
|
||||
),
|
||||
child: Container(
|
||||
width: _isJunction || widget.axis == Axis.horizontal
|
||||
? WorkspaceLayoutMetrics.desktopResizeHighlightThickness
|
||||
: double.infinity,
|
||||
height: _isJunction || widget.axis == Axis.vertical
|
||||
? WorkspaceLayoutMetrics.desktopResizeHighlightThickness
|
||||
: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
borderRadius: BorderRadius.circular(
|
||||
WorkspaceLayoutMetrics.desktopResizeHighlightThickness / 2,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user