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

This commit was merged in pull request #14.
This commit is contained in:
lingjhf committed 2026-10-11 19:59:40 +00:00
1 parent abc1868550
commit 06f1c26681
452 files changed
+43806 -2329

No files matched your search

+298 -82
View File
@@ -5,10 +5,10 @@ import 'package:cutdex/l10n/l10n.dart';
import 'dart:math' as math;
import 'package:cutdex/features/properties/animation_labels.dart';
import 'package:cutdex_sdk/editor.dart';
import 'package:cutdex_sdk/preview.dart';
import 'package:cutdex_sdk/timeline/engine.dart';
import 'package:cutdex_sdk/timeline/model.dart';
import 'package:cutdex_core/editor.dart';
import 'package:cutdex_preview/cutdex_preview.dart';
import 'package:cutdex_core/timeline/engine.dart';
import 'package:cutdex_core/timeline/model.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
@@ -22,6 +22,10 @@ import '../../shared/state/operation_scope.dart';
import '../preview/preview_panel.dart';
import 'property_number_input.dart';
import 'picture_edits.dart';
import 'effect_properties.dart';
import 'stroke_properties.dart';
import 'distortion_properties.dart';
import 'effect_labels.dart';
class PictureProperties extends ConsumerStatefulWidget {
const PictureProperties({
@@ -57,6 +61,7 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
late final _operations = OperationScope<Object>(_operationContext);
late final _seeks = OperationScope<Object>(_operationContext);
bool _locked = true;
bool? _independentCorners;
bool _hasFocusedControl = false;
PictureEditsProvider get _editProvider =>
pictureEditsProvider(widget.session, widget.sequence, widget.clip.id);
@@ -87,6 +92,7 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
oldWidget.clip.id,
);
if (previousIdentity != _editIdentity) {
_independentCorners = null;
final edit = _clearScrub();
if (edit != null) scheduleMicrotask(edit.cancel);
}
@@ -204,7 +210,9 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
value.y == _scrubBase!.y &&
value.rotation == _scrubBase!.rotation &&
value.scale == _scrubBase!.scale &&
value.scaleY == _scrubBase!.scaleY)) {
value.scaleY == _scrubBase!.scaleY &&
value.sameCorners(_scrubBase!) &&
value.distortion.same(_scrubBase!.distortion))) {
_cancelScrub();
return;
}
@@ -267,6 +275,16 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
value.scale,
value.scaleY,
value.rotation,
value.distortion.topLeft,
value.distortion.topRight,
value.distortion.bottomRight,
value.distortion.bottomLeft,
value.cornerRadius,
value.topLeftRadius,
value.topRightRadius,
value.bottomRightRadius,
value.bottomLeftRadius,
_independentCorners,
_scrubValid,
_scrubBase != null,
_saving,
@@ -359,36 +377,46 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
final desktop = AppTheme.isDesktop(context);
final gap = AppTheme.propertyRowGap(context);
Widget axes(TransformChannel channel, Widget first, Widget second) =>
LayoutBuilder(
builder: (context, constraints) {
final pair = constraints.maxWidth < (desktop ? 180 : 240)
? Column(
children: [
first,
SizedBox(height: gap),
second,
],
)
: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(child: first),
SizedBox(width: gap),
Expanded(child: second),
],
);
return desktop
? pair
: Row(
children: [
Expanded(child: pair),
SizedBox(width: gap),
keyButton(channel),
],
);
},
Widget axes(
TransformChannel channel,
Widget first,
Widget second, {
Widget? trailing,
}) => LayoutBuilder(
builder: (context, constraints) {
if (desktop) {
return AppPropertyRow(
trailing: channel == TransformChannel.position
? keyButton(channel)
: trailing,
children: [first, second],
);
}
final pair = constraints.maxWidth < 240
? Column(
children: [
first,
SizedBox(height: gap),
second,
],
)
: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(child: first),
SizedBox(width: gap),
Expanded(child: second),
],
);
return Row(
children: [
Expanded(child: pair),
SizedBox(width: gap),
keyButton(channel),
],
);
},
);
Widget keyTools(TransformChannel channel) {
if (animation == null || !animation.animated(channel)) {
@@ -488,17 +516,23 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
bool inlineLabel = false,
String? prefix,
IconData? prefixIcon,
int prefixQuarterTurns = 0,
String? valueText,
}) => PropertyNumberInput(
key: ValueKey(id),
label: label,
inlineLabel: inlineLabel,
prefix: prefix,
prefixIcon: prefixIcon,
prefixQuarterTurns: prefixQuarterTurns,
valueText: valueText,
unit: unit,
value: value,
enabled: !_saving,
readOnly: _scrubBase != null || preview?.transforms.hasPending == true,
submit: (v) => _commit(preview, (current) => change(current, v)),
submit: (v) => v < min || v > max
? Future.value(false)
: _commit(preview, (current) => change(current, v)),
onScrubStart: () => _startScrub(
preview,
id,
@@ -520,8 +554,7 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
widget.session.view(widget.sequence).playheadTick,
),
);
Widget section(List<Widget> children) => Padding(
padding: AppTheme.propertySectionPadding(context),
Widget section(List<Widget> children) => AppPropertySection(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: children,
@@ -555,7 +588,10 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
prefixIcon: desktop ? AppIcons.angle : null,
);
final rotation = desktop
? rotationInput
? AppPropertyRow(
trailing: keyButton(TransformChannel.rotation),
children: [rotationInput, const SizedBox.shrink()],
)
: Row(
children: [
Expanded(child: rotationInput),
@@ -563,7 +599,7 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
keyButton(TransformChannel.rotation),
],
);
final scale = axes(
Widget scaleControls({Widget? trailing}) => axes(
TransformChannel.scale,
number(
'picture-scale-x',
@@ -595,6 +631,7 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
: 10000,
inlineLabel: true,
),
trailing: trailing,
);
final lock = IconButton(
key: const Key('picture-lock'),
@@ -610,11 +647,10 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
}
: null,
);
final scale = scaleControls();
final alignmentControls = LayoutBuilder(
builder: (context, constraints) => Wrap(
spacing: AppSpacing.small,
runSpacing: AppSpacing.small,
children: [
builder: (context, constraints) {
final groups = <Widget>[
for (final group in [
[
(
@@ -648,7 +684,9 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
],
])
SizedBox(
width: constraints.maxWidth < 200
width: desktop
? null
: constraints.maxWidth < 200
? constraints.maxWidth
: (constraints.maxWidth - AppSpacing.small) / 2,
child: AppButtonGroup(
@@ -675,9 +713,89 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
],
),
),
],
),
];
if (desktop) return AppPropertyRow(children: groups);
return Wrap(
spacing: AppSpacing.small,
runSpacing: AppSpacing.small,
children: groups,
);
},
);
final radiusInput = number(
'picture-corner-radius',
context.l10n.cornerRadius,
value.topLeftRadius,
(c, v) => c.copyWith(cornerRadius: v),
min: 0,
max: 1000000,
inlineLabel: desktop,
prefix: desktop ? '' : null,
prefixIcon: desktop ? AppIcons.cornerRadius : null,
valueText: value.hasMixedCorners ? '—' : null,
);
final independent = _independentCorners ?? value.hasMixedCorners;
final cornerToggle = IconButton(
key: const ValueKey('picture-independent-corners'),
tooltip: context.l10n.independentCorners,
icon: const Icon(AppIcons.independentCorners),
isSelected: independent,
onPressed:
enabled &&
_scrubBase == null &&
preview?.transforms.hasPending != true
? () => setState(() => _independentCorners = !independent)
: null,
);
final cornerInputs = [
number(
'picture-corner-top-left',
context.l10n.cornerTopLeft,
value.topLeftRadius,
(c, v) => c.copyWith(topLeftRadius: v),
min: 0,
max: 1000000,
inlineLabel: true,
prefix: '',
prefixIcon: Icons.rounded_corner,
prefixQuarterTurns: 3,
),
number(
'picture-corner-top-right',
context.l10n.cornerTopRight,
value.topRightRadius,
(c, v) => c.copyWith(topRightRadius: v),
min: 0,
max: 1000000,
inlineLabel: true,
prefix: '',
prefixIcon: Icons.rounded_corner,
),
number(
'picture-corner-bottom-left',
context.l10n.cornerBottomLeft,
value.bottomLeftRadius,
(c, v) => c.copyWith(bottomLeftRadius: v),
min: 0,
max: 1000000,
inlineLabel: true,
prefix: '',
prefixIcon: Icons.rounded_corner,
prefixQuarterTurns: 2,
),
number(
'picture-corner-bottom-right',
context.l10n.cornerBottomRight,
value.bottomRightRadius,
(c, v) => c.copyWith(bottomRightRadius: v),
min: 0,
max: 1000000,
inlineLabel: true,
prefix: '',
prefixIcon: Icons.rounded_corner,
prefixQuarterTurns: 1,
),
];
final content = Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
@@ -690,46 +808,43 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
),
]),
],
if (!widget.animationView)
if (!widget.animationView && !desktop)
section([
if (desktop)
AppPropertyGroup(
label: context.l10n.alignment,
child: alignmentControls,
)
else ...[
Text(
context.l10n.alignment,
style: AppTheme.propertySectionTitleStyle(context),
),
SizedBox(height: gap),
alignmentControls,
],
Text(
context.l10n.alignment,
style: AppTheme.propertySectionTitleStyle(context),
),
SizedBox(height: gap),
alignmentControls,
]),
if (desktop) ...[
section([
AppPropertyGroup(
label: context.l10n.position,
actions: [keyButton(TransformChannel.position)],
child: position,
padChild: false,
child: Column(
children: [
if (!widget.animationView) alignmentControls,
position,
keyTools(TransformChannel.position),
rotation,
keyTools(TransformChannel.rotation),
],
),
),
keyTools(TransformChannel.position),
]),
section([
AppPropertyGroup(
label: context.l10n.scale,
actions: [lock, keyButton(TransformChannel.scale)],
child: scale,
actions: [keyButton(TransformChannel.scale)],
padChild: false,
child: Column(
children: [
scaleControls(trailing: lock),
keyTools(TransformChannel.scale),
],
),
),
keyTools(TransformChannel.scale),
]),
section([
AppPropertyGroup(
label: context.l10n.rotation,
actions: [keyButton(TransformChannel.rotation)],
child: rotation,
),
keyTools(TransformChannel.rotation),
]),
] else ...[
section([
@@ -759,6 +874,82 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
keyTools(TransformChannel.scale),
]),
],
DistortionProperties(
projectId: widget.projectId,
timelineId: widget.timelineId,
session: widget.session,
sequence: widget.sequence,
clip: widget.clip.id,
),
section([
if (desktop)
AppPropertyGroup(
label: context.l10n.cornerRadius,
padChild: false,
child: Column(
children: [
AppPropertyRow(
trailing: keyButton(TransformChannel.cornerRadius),
children: [
radiusInput,
Align(
alignment: Alignment.centerRight,
child: cornerToggle,
),
],
),
if (independent) ...[
AppPropertyRow(children: cornerInputs.sublist(0, 2)),
AppPropertyRow(children: cornerInputs.sublist(2, 4)),
],
keyTools(TransformChannel.cornerRadius),
],
),
)
else ...[
Row(
children: [
Expanded(child: radiusInput),
SizedBox(width: gap),
cornerToggle,
keyButton(TransformChannel.cornerRadius),
],
),
if (independent) ...[
SizedBox(height: gap),
Row(
children: [
Expanded(child: cornerInputs[0]),
SizedBox(width: gap),
Expanded(child: cornerInputs[1]),
],
),
SizedBox(height: gap),
Row(
children: [
Expanded(child: cornerInputs[2]),
SizedBox(width: gap),
Expanded(child: cornerInputs[3]),
],
),
],
keyTools(TransformChannel.cornerRadius),
],
]),
StrokeProperties(
projectId: widget.projectId,
timelineId: widget.timelineId,
session: widget.session,
sequence: widget.sequence,
clip: widget.clip.id,
),
EffectProperties(
projectId: widget.projectId,
timelineId: widget.timelineId,
session: widget.session,
sequence: widget.sequence,
clip: widget.clip.id,
),
if (_error != null)
section([
Text(
@@ -824,7 +1015,34 @@ class _KeyframeTimeline extends StatelessWidget {
],
),
const SizedBox(height: AppSpacing.small),
for (final channel in TransformChannel.values)
for (final (id, label, times) in [
for (final channel in TransformChannel.values)
(channel.name, channel.label(context), animation.keyTimes(channel)),
for (final layer in ClipStrokeStack(
animation.record,
animation.localTick,
).layers)
(
'stroke-${layer.id}',
context.l10n.stroke,
ClipStrokeStack(animation.record, animation.localTick)
.keyOffsets(layer.parameterIds)
.map((t) => animation.start + t)
.toList(),
),
for (final layer in ClipEffectStack(
animation.record,
animation.localTick,
).layers)
(
layer.id,
layer.type.label(context),
ClipEffectStack(animation.record, animation.localTick)
.keyOffsets(layer.parameterIds)
.map((t) => animation.start + t)
.toList(),
),
])
SizedBox(
height: 32,
child: Row(
@@ -832,7 +1050,7 @@ class _KeyframeTimeline extends StatelessWidget {
SizedBox(
width: 36,
child: Text(
channel.label(context),
label,
style: Theme.of(context).textTheme.bodySmall,
),
),
@@ -851,7 +1069,7 @@ class _KeyframeTimeline extends StatelessWidget {
) *
extent;
return GestureDetector(
key: ValueKey('picture-key-track-${channel.name}'),
key: ValueKey('picture-key-track-$id'),
behavior: HitTestBehavior.opaque,
onTapDown: !enabled
? null
@@ -883,18 +1101,16 @@ class _KeyframeTimeline extends StatelessWidget {
width: 1,
child: ColoredBox(color: colors.primary),
),
for (final tick in animation.keyTimes(channel))
for (final tick in times)
Positioned(
left: x(tick) - AppControlSize.compact / 2,
top: 4,
width: AppControlSize.compact,
height: AppControlSize.compact,
child: IconButton(
key: ValueKey(
'picture-key-marker-${channel.name}-$tick',
),
key: ValueKey('picture-key-marker-$id-$tick'),
tooltip:
'${channel.label(context)} ${((tick - animation.start) / TimelineClock.ticksPerSecond).toStringAsFixed(2)} s',
'$label ${((tick - animation.start) / TimelineClock.ticksPerSecond).toStringAsFixed(2)} s',
padding: EdgeInsets.zero,
onPressed: enabled
? () => onSeek(tick)