diff --git a/lib/features/preview/preview_panel.dart b/lib/features/preview/preview_panel.dart index 0cbda5b..4b332f0 100644 --- a/lib/features/preview/preview_panel.dart +++ b/lib/features/preview/preview_panel.dart @@ -228,6 +228,8 @@ class _EditorPreviewContent extends ConsumerWidget { select: () => ( activeController.positionTick, activeController.selectedVisualIds.isNotEmpty, + activeController.distortionEditingElement, + activeController.distortionPerspective, activeController.maskEditingElement, activeController.obscureEditingElement, ), diff --git a/lib/features/properties/animation_labels.dart b/lib/features/properties/animation_labels.dart index ef3db38..77463c1 100644 --- a/lib/features/properties/animation_labels.dart +++ b/lib/features/properties/animation_labels.dart @@ -8,6 +8,10 @@ extension TransformChannelLabel on TransformChannel { TransformChannel.rotation => context.l10n.rotation, TransformChannel.scale => context.l10n.scale, TransformChannel.cornerRadius => context.l10n.cornerRadius, + TransformChannel.distortTopLeft => context.l10n.distortionTopLeft, + TransformChannel.distortTopRight => context.l10n.distortionTopRight, + TransformChannel.distortBottomRight => context.l10n.distortionBottomRight, + TransformChannel.distortBottomLeft => context.l10n.distortionBottomLeft, }; } diff --git a/lib/features/properties/distortion_parameter_editor.dart b/lib/features/properties/distortion_parameter_editor.dart new file mode 100644 index 0000000..289cede --- /dev/null +++ b/lib/features/properties/distortion_parameter_editor.dart @@ -0,0 +1,211 @@ +import 'package:cutdex/l10n/l10n.dart'; +import 'package:cutdex_sdk/editor.dart'; +import 'package:cutdex_sdk/timeline/model.dart'; +import 'package:cutdex_sdk/timeline/engine.dart'; +import 'package:cutdex_ui/icons.dart'; +import 'package:cutdex_ui/theme.dart'; +import 'package:cutdex_ui/widgets.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/widget_previews.dart'; + +import 'property_keyframe_controls.dart'; +import 'property_number_input.dart'; + +/// Presentation of four position channels; editing and native lifetime live in the host. +class DistortionParameterEditor extends StatelessWidget { + const DistortionParameterEditor({ + super.key, + required this.value, + required this.extent, + required this.enabled, + required this.editing, + required this.perspective, + required this.keyframes, + required this.editContext, + required this.onSubmit, + required this.onReset, + required this.onPerspective, + this.onToggle, + this.error, + }); + final ClipDistortion value; + final Size extent; + final bool enabled, editing, perspective; + final PropertyKeyframeControls keyframes; + final Object editContext; + final Future Function(int corner, int axis, double value) onSubmit; + final VoidCallback? onToggle; + final VoidCallback onReset; + final ValueChanged onPerspective; + final String? error; + @override + Widget build(BuildContext context) { + final keys = keyframes, l = context.l10n; + final labels = [ + l.distortionTopLeft, + l.distortionTopRight, + l.distortionBottomRight, + l.distortionBottomLeft, + ]; + return AppPropertySection( + child: AppPropertyGroup( + label: l.distortion, + padChild: false, + actions: [ + keys.button( + context, + ClipDistortion.ids, + l.distortion, + 'distortion-key', + ), + keys.menu(context, ClipDistortion.ids, l.distortion, 'distortion'), + ], + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + AppPropertyRow( + children: [ + TextButton( + key: const ValueKey('distortion-edit'), + onPressed: enabled ? onToggle : null, + child: Text(editing ? l.finishDistortion : l.editDistortion), + ), + IconButton( + key: const ValueKey('distortion-reset'), + tooltip: l.resetDistortion, + icon: const Icon(AppIcons.reset, size: 16), + onPressed: enabled ? onReset : null, + ), + ], + ), + AppPropertyRow( + children: [ + AppSelect( + value: perspective, + label: l.distortion, + emptyLabel: l.freeDistortion, + options: [ + AppSelectOption(false, l.freeDistortion), + AppSelectOption(true, l.perspectiveDistortion), + ], + onChanged: enabled ? onPerspective : null, + ), + ], + ), + for (var i = 0; i < 4; i++) ...[ + Padding( + padding: const EdgeInsets.symmetric(horizontal: 16), + child: Row( + children: [ + Expanded( + child: Text( + labels[i], + style: Theme.of(context).textTheme.labelSmall, + ), + ), + keys.menu( + context, + ClipDistortion.ids.sublist(i * 2, i * 2 + 2), + labels[i], + 'distortion-${ClipDistortion.names[i]}', + ), + ], + ), + ), + AppPropertyRow( + trailing: keys.button( + context, + ClipDistortion.ids.sublist(i * 2, i * 2 + 2), + labels[i], + 'distortion-${ClipDistortion.names[i]}-key', + ), + children: [ + for (var axis = 0; axis < 2; axis++) + PropertyNumberInput( + key: ValueKey( + 'distortion-${ClipDistortion.names[i]}-${axis == 0 ? 'x' : 'y'}', + ), + label: axis == 0 ? 'X' : 'Y', + inlineLabel: true, + prefix: axis == 0 ? 'X' : 'Y', + value: + value.values[i * 2 + axis] * + (axis == 0 ? extent.width : extent.height), + enabled: enabled, + readOnly: false, + editContext: editContext, + submit: (v) => onSubmit(i, axis, v), + onScrubUpdate: (_) {}, + onScrubEnd: () {}, + onScrubCancel: () {}, + scrubbing: false, + ), + ], + ), + ], + if (error != null) + Padding(padding: const EdgeInsets.all(16), child: Text(error!)), + ], + ), + ), + ); + } +} + +@Preview(name: 'Distortion / desktop', size: Size(240, 400)) +Widget distortionEditorPreview() { + var value = const ClipDistortion(topLeft: (.05, .1)); + var perspective = false, editing = false; + final stack = ClipParameterAnimation( + ElementRecord( + id: ElementId('preview'), + structure: ElementStructure.content, + duration: 1, + sourceStart: 0, + sourceDuration: 1, + enabled: true, + ), + 0, + ); + return MaterialApp( + localizationsDelegates: AppLocalizations.localizationsDelegates, + supportedLocales: AppLocalizations.supportedLocales, + theme: AppTheme.propertiesPanelTheme( + AppTheme.desktopWorkspaceTheme(AppTheme.penDark), + ), + home: Scaffold( + body: StatefulBuilder( + builder: (context, update) => SingleChildScrollView( + child: DistortionParameterEditor( + value: value, + extent: const Size(300, 200), + enabled: true, + editing: editing, + perspective: perspective, + editContext: 'preview', + keyframes: PropertyKeyframeControls( + stack: stack, + enabled: true, + onEdit: (ids, {action, interpolation}) async => true, + onSeek: (_) async => true, + ), + onSubmit: (corner, axis, input) async { + final p = value.corners[corner]; + final next = value.withCorner( + corner, + axis == 0 ? input / 300 : p.$1, + axis == 1 ? input / 200 : p.$2, + ); + if (!next.isValid) return false; + update(() => value = next); + return true; + }, + onReset: () => update(() => value = const ClipDistortion()), + onToggle: () => update(() => editing = !editing), + onPerspective: (v) => update(() => perspective = v), + ), + ), + ), + ), + ); +} diff --git a/lib/features/properties/distortion_properties.dart b/lib/features/properties/distortion_properties.dart new file mode 100644 index 0000000..edb34b5 --- /dev/null +++ b/lib/features/properties/distortion_properties.dart @@ -0,0 +1,196 @@ +import 'dart:async'; + +import 'package:cutdex/l10n/l10n.dart'; +import 'package:cutdex_sdk/editor.dart'; +import 'package:cutdex_sdk/preview.dart'; +import 'package:cutdex_sdk/timeline/model.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; + +import '../../workspace/timeline_session.dart'; +import '../preview/preview_panel.dart'; +import 'property_edit_controller.dart'; +import 'property_keyframe_controls.dart'; +import 'distortion_parameter_editor.dart'; + +class DistortionProperties extends ConsumerStatefulWidget { + const DistortionProperties({ + super.key, + required this.projectId, + required this.timelineId, + required this.session, + required this.sequence, + required this.clip, + }); + final String projectId, timelineId; + final EditorTimelineSession session; + final SequenceId sequence; + final ElementId clip; + @override + ConsumerState createState() => + _DistortionPropertiesState(); +} + +class _DistortionPropertiesState extends ConsumerState { + PropertyEditController _create() => PropertyEditController( + session: widget.session, + sequence: widget.sequence, + clip: widget.clip, + projectId: widget.projectId, + timelineId: widget.timelineId, + operation: 'setTransform', + ); + late PropertyEditController _controller = _create(); + PreviewController? _preview; + bool _perspective = false; + void _release() { + final previous = _preview; + _preview = null; + if (previous != null) { + scheduleMicrotask(() => previous.releaseDistortionEditing(this)); + } + } + + @override + void didUpdateWidget(covariant DistortionProperties oldWidget) { + super.didUpdateWidget(oldWidget); + if (_controller.identity != + ( + widget.session, + widget.sequence, + widget.clip, + widget.projectId, + widget.timelineId, + )) { + _release(); + _controller.dispose(); + _controller = _create(); + } + } + + @override + void dispose() { + _release(); + _controller.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + final preview = ref + .watch(editorPreviewProvider(widget.projectId, widget.timelineId)) + .asData + ?.value; + if (!identical(_preview, preview)) { + _release(); + _preview = preview; + } + final view = widget.session.view(widget.sequence); + return ListenableBuilder( + listenable: Listenable.merge([ + _controller, + view, + if (preview != null) preview.transforms, + if (preview != null) preview.positionChanges, + ]), + builder: (context, _) { + final stack = _controller.animation; + if (stack == null) return const SizedBox.shrink(); + final visual = preview?.visualForProperties(widget.clip); + final value = preview?.transforms.hasPending == true && visual != null + ? visual.transform + : ClipTransform.fromRecord( + stack.record, + sourceTick: stack.sourceTick, + ); + final extent = + visual?.geometry.distortionSize ?? + Size(widget.session.canvas.width, widget.session.canvas.height); + final enabled = + !_controller.saving && + stack.containsPlayhead && + preview?.transforms.hasPending != true; + Future edit(void Function(EditorCommandService, int) action) => + _controller.run(preview, action); + final keys = PropertyKeyframeControls( + stack: stack, + enabled: enabled, + onEdit: (ids, {action, interpolation}) => edit( + (c, t) => c.editKeyframeChannel( + sequence: widget.sequence, + clip: widget.clip, + tick: t, + parameterIds: ids, + action: action, + interpolation: interpolation, + ), + ), + onSeek: (offset) => _controller.run( + preview, + (_, t) => view.seekTo(t - stack.localTick + offset), + seek: true, + ), + ); + final editing = preview?.distortionEditingElement == widget.clip; + final l = context.l10n; + Future submit(int corner, int axis, double input) => edit( + (c, t) => c.setTransform( + sequence: widget.sequence, + clip: widget.clip, + tick: t, + change: (current) { + final p = current.distortion.corners[corner]; + return current.copyWith( + distortion: current.distortion.withCorner( + corner, + axis == 0 ? input / extent.width : p.$1, + axis == 1 ? input / extent.height : p.$2, + ), + ); + }, + ), + ); + return DistortionParameterEditor( + value: value.distortion, + extent: extent, + enabled: enabled, + editing: editing, + perspective: _perspective, + keyframes: keys, + editContext: _controller.identity, + error: _controller.failed ? l.updateOperationFailed : null, + onSubmit: submit, + onToggle: preview == null + ? null + : () => _controller.run( + preview, + (_, t) => preview.setDistortionEditing( + editing ? null : widget.clip, + owner: this, + perspective: _perspective, + ), + seek: true, + ), + onReset: () => edit( + (c, t) => c.setTransform( + sequence: widget.sequence, + clip: widget.clip, + tick: t, + change: (v) => v.copyWith(distortion: const ClipDistortion()), + ), + ), + onPerspective: (v) { + setState(() => _perspective = v); + if (editing) { + preview!.setDistortionEditing( + widget.clip, + owner: this, + perspective: v, + ); + } + }, + ); + }, + ); + } +} diff --git a/lib/features/properties/effect_labels.dart b/lib/features/properties/effect_labels.dart new file mode 100644 index 0000000..f1b3003 --- /dev/null +++ b/lib/features/properties/effect_labels.dart @@ -0,0 +1,15 @@ +import 'package:cutdex/l10n/l10n.dart'; +import 'package:cutdex_sdk/editor.dart'; +import 'package:flutter/widgets.dart'; + +extension EffectTypeLabel on ClipEffectType { + String label(BuildContext context) => switch (this) { + ClipEffectType.dropShadow => context.l10n.dropShadow, + ClipEffectType.innerShadow => context.l10n.innerShadow, + ClipEffectType.layerBlur => context.l10n.layerBlur, + ClipEffectType.backgroundBlur => context.l10n.backgroundBlur, + ClipEffectType.glass => context.l10n.glassEffect, + ClipEffectType.noise => context.l10n.noiseEffect, + ClipEffectType.texture => context.l10n.textureEffect, + }; +} diff --git a/lib/features/properties/effect_list.dart b/lib/features/properties/effect_list.dart new file mode 100644 index 0000000..01e91f0 --- /dev/null +++ b/lib/features/properties/effect_list.dart @@ -0,0 +1,132 @@ +import 'package:cutdex/l10n/l10n.dart'; +import 'package:cutdex_sdk/editor.dart'; +import 'package:cutdex_ui/icons.dart'; +import 'package:cutdex_ui/widgets.dart'; +import 'package:flutter/material.dart'; + +import 'property_keyframe_controls.dart'; +import 'effect_labels.dart'; +import 'property_layer_row.dart'; + +class EffectList extends StatelessWidget { + const EffectList({ + super.key, + required this.stack, + required this.enabled, + required this.keyframes, + required this.onAdd, + required this.onReorder, + required this.onToggle, + required this.onRemove, + required this.editorBuilder, + this.error, + }); + final ClipEffectStack stack; + final bool enabled; + final PropertyKeyframeControls keyframes; + final void Function(ClipEffectType) onAdd; + final void Function(List) onReorder; + final void Function(ClipEffectLayer) onToggle, onRemove; + final Widget Function(ClipEffectLayer) editorBuilder; + final String? error; + + @override + Widget build(BuildContext context) { + final layers = stack.layers; + return AppPropertySection( + bottomSpacing: layers.isEmpty ? 0 : null, + child: AppPropertyGroup( + label: context.l10n.effects, + padChild: false, + actions: [ + keyframes.button( + context, + stack.parameterIds, + context.l10n.effects, + 'effects-key', + ), + AppDropdownMenu( + enabled: enabled, + builder: (context, toggle, focus) => IconButton( + key: const ValueKey('effect-add'), + focusNode: focus, + tooltip: context.l10n.addEffect, + onPressed: enabled ? toggle : null, + icon: const Icon(AppIcons.add, size: 16), + ), + items: [ + for (final type in ClipEffectType.values) + AppMenuItem( + label: type.label(context), + onPressed: enabled && stack.canAdd(type) + ? () => onAdd(type) + : null, + ), + ], + ), + ], + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + ReorderableListView( + shrinkWrap: true, + primary: false, + padding: EdgeInsets.zero, + physics: const NeverScrollableScrollPhysics(), + buildDefaultDragHandles: false, + onReorderItem: (from, to) { + if (!enabled) return; + final order = layers.map((l) => l.id).toList(); + order.insert(to, order.removeAt(from)); + onReorder(order); + }, + children: [ + for (var i = 0; i < layers.length; i++) + PropertyLayerRow( + key: ValueKey('effect-layer-${layers[i].id}'), + id: layers[i].id, + prefix: 'effect', + index: i, + enabled: enabled, + visible: layers[i].enabled, + label: layers[i].type.label(context), + tooltip: context.l10n.effects, + onVisibility: () => onToggle(layers[i]), + onRemove: () => onRemove(layers[i]), + menuItems: [ + for (final (delta, label) in [ + (-1, context.l10n.effectMoveUp), + (1, context.l10n.effectMoveDown), + ]) + AppMenuItem( + label: label, + closeAncestors: false, + onPressed: + !enabled || + i + delta < 0 || + i + delta >= layers.length + ? null + : () { + final order = layers + .map((l) => l.id) + .toList(); + order.insert(i + delta, order.removeAt(i)); + onReorder(order); + }, + ), + ], + editor: editorBuilder(layers[i]), + ), + ], + ), + if (error != null) + Text( + error!, + style: TextStyle(color: Theme.of(context).colorScheme.error), + ), + ], + ), + ), + ); + } +} diff --git a/lib/features/properties/effect_parameter_editor.dart b/lib/features/properties/effect_parameter_editor.dart new file mode 100644 index 0000000..432c4e6 --- /dev/null +++ b/lib/features/properties/effect_parameter_editor.dart @@ -0,0 +1,245 @@ +import 'package:cutdex/l10n/l10n.dart'; +import 'package:cutdex_sdk/editor.dart'; +import 'package:cutdex_ui/theme.dart'; +import 'package:cutdex_ui/widgets.dart'; +import 'package:flutter/material.dart'; + +import 'property_keyframe_controls.dart'; +import 'effect_labels.dart'; +import 'property_color_input.dart'; +import 'property_number_input.dart'; + +class EffectParameterEditor extends StatelessWidget { + const EffectParameterEditor({ + super.key, + required this.layer, + required this.stack, + required this.enabled, + required this.editContext, + required this.keyframes, + required this.onChange, + required this.onTypeChange, + }); + final ClipEffectLayer layer; + final ClipEffectStack stack; + final bool enabled; + final Object editContext; + final PropertyKeyframeControls keyframes; + final Future Function(Map) onChange; + final void Function(ClipEffectType) onTypeChange; + + String _fieldLabel(BuildContext context, String field) => switch (field) { + 'x' => 'X', + 'y' => 'Y', + 'blur' => context.l10n.shadowBlur, + 'spread' => context.l10n.shadowSpread, + 'opacity' => context.l10n.shadowOpacity, + 'blurEnd' => context.l10n.effectBlurEnd, + 'start.x' => context.l10n.effectStartX, + 'start.y' => context.l10n.effectStartY, + 'end.x' => context.l10n.effectEndX, + 'end.y' => context.l10n.effectEndY, + 'lightAngle' => context.l10n.effectLightAngle, + 'lightIntensity' => context.l10n.effectLightIntensity, + 'refraction' => context.l10n.effectRefraction, + 'depth' => context.l10n.effectDepth, + 'dispersion' => context.l10n.effectDispersion, + 'frost' => context.l10n.effectFrost, + 'splay' => context.l10n.effectSplay, + 'size' => context.l10n.effectNoiseSize, + 'density' => context.l10n.effectDensity, + 'radius' => context.l10n.effectTextureRadius, + 'seed' => context.l10n.effectSeed, + _ => field, + }; + Widget _number(BuildContext context, String field) { + final label = _fieldLabel(context, field); + final structural = EffectParameterTarget.structural.contains(field); + final percentage = { + 'opacity', + 'density', + 'lightIntensity', + 'splay', + }.contains(field); + final factor = percentage ? 100.0 : 1.0; + final definition = EffectParameterTarget.definition(field); + return Padding( + padding: const EdgeInsets.only(bottom: 4), + child: Row( + children: [ + Expanded( + child: PropertyNumberInput( + key: ValueKey('effect-${layer.id}-$field'), + label: label, + value: layer.values[field]! * factor, + unit: percentage ? '%' : null, + enabled: enabled && layer.enabled, + readOnly: false, + scrubbing: false, + editContext: (editContext, layer.id, layer.type), + onScrubUpdate: (_) {}, + onScrubEnd: () {}, + onScrubCancel: () {}, + submit: (v) => !definition.accepts(v / factor) + ? Future.value(false) + : onChange({field: v / factor}), + ), + ), + if (!structural) ...[ + keyframes.button( + context, + [layer.target(field)], + label, + 'effect-${layer.id}-$field-key', + ), + keyframes.menu( + context, + [layer.target(field)], + label, + 'effect-${layer.id}-$field', + ), + ] else + const SizedBox(width: 48), + ], + ), + ); + } + + Widget _color(BuildContext context, String prefix, String label) { + final fields = ['${prefix}r', '${prefix}g', '${prefix}b']; + final values = fields.map((f) => layer.values[f]!).toList(); + final hex = values + .map((v) => (v * 255).round().toRadixString(16).padLeft(2, '0')) + .join() + .toUpperCase(); + final ids = fields.map(layer.target).toList(); + return Padding( + padding: const EdgeInsets.only(bottom: 4), + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Text(label, style: AppTheme.propertyLabelStyle(context)), + Row( + children: [ + Expanded( + child: PropertyColorInput( + key: ValueKey('effect-${layer.id}-$prefix'), + value: hex, + color: Color.from( + alpha: 1, + red: values[0], + green: values[1], + blue: values[2], + ), + enabled: enabled && layer.enabled, + editContext: (editContext, layer.id, layer.type), + submit: (rgb) => onChange({ + fields[0]: ((rgb >> 16) & 255) / 255, + fields[1]: ((rgb >> 8) & 255) / 255, + fields[2]: (rgb & 255) / 255, + }), + ), + ), + keyframes.button( + context, + ids, + label, + 'effect-${layer.id}-$prefix-key', + ), + keyframes.menu(context, ids, label, 'effect-${layer.id}-$prefix'), + ], + ), + ], + ), + ); + } + + Widget _mode(BuildContext context, String field, List labels) => + Padding( + padding: const EdgeInsets.only(bottom: 8), + child: SizedBox( + height: 24, + child: AppSelect( + closeAncestors: false, + key: ValueKey('effect-${layer.id}-$field'), + value: layer.values[field]!.round(), + label: field == 'noiseMode' + ? context.l10n.effectNoiseMode + : context.l10n.shadowBlur, + emptyLabel: context.l10n.effects, + options: [ + for (var i = 0; i < labels.length; i++) + AppSelectOption(i, labels[i]), + ], + onChanged: enabled && layer.enabled + ? (v) => onChange({field: v.toDouble()}) + : null, + ), + ), + ); + @override + Widget build(BuildContext context) => Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + SizedBox( + height: 24, + child: AppSelect( + closeAncestors: false, + key: ValueKey('effect-${layer.id}-type'), + value: layer.type, + label: context.l10n.effects, + emptyLabel: context.l10n.effects, + options: [ + for (final type in ClipEffectType.values) + if (stack.canAdd(type, excludingId: layer.id)) + AppSelectOption(type, type.label(context)), + ], + onChanged: enabled ? onTypeChange : null, + ), + ), + const SizedBox(height: 8), + if (layer.values.containsKey('progressive')) + _mode(context, 'progressive', [ + context.l10n.effectUniform, + context.l10n.effectProgressive, + ]), + if (layer.values.containsKey('noiseMode')) + _mode(context, 'noiseMode', [ + context.l10n.effectMono, + context.l10n.effectDuo, + context.l10n.effectMulti, + ]), + for (final field in layer.values.keys) + if (!field.startsWith('color') && + !{'progressive', 'noiseMode', 'clipToShape'}.contains(field) && + !(layer.values['progressive'] == 0 && + { + 'blurEnd', + 'start.x', + 'start.y', + 'end.x', + 'end.y', + }.contains(field))) + _number(context, field), + if (layer.values.containsKey('color.r') && layer.values['noiseMode'] != 2) + _color(context, 'color.', context.l10n.color), + if (layer.values['noiseMode'] == 1) + _color(context, 'color2.', context.l10n.effectSecondColor), + if (layer.values.containsKey('clipToShape')) + CheckboxListTile( + key: ValueKey('effect-${layer.id}-clipToShape'), + dense: true, + contentPadding: EdgeInsets.zero, + title: Text( + context.l10n.effectClipToShape, + style: Theme.of(context).textTheme.bodyMedium, + ), + value: layer.values['clipToShape'] == 1, + onChanged: enabled && layer.enabled + ? (v) => onChange({'clipToShape': v == true ? 1 : 0}) + : null, + ), + ], + ); +} diff --git a/lib/features/properties/effect_properties.dart b/lib/features/properties/effect_properties.dart new file mode 100644 index 0000000..01d3302 --- /dev/null +++ b/lib/features/properties/effect_properties.dart @@ -0,0 +1,172 @@ +import 'package:cutdex/l10n/l10n.dart'; +import 'package:cutdex_sdk/editor.dart'; +import 'package:cutdex_sdk/timeline/model.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; + +import '../../workspace/timeline_session.dart'; +import '../preview/preview_panel.dart'; +import 'property_edit_controller.dart'; +import 'property_keyframe_controls.dart'; +import 'effect_list.dart'; +import 'effect_parameter_editor.dart'; + +class EffectProperties extends ConsumerStatefulWidget { + const EffectProperties({ + super.key, + required this.projectId, + required this.timelineId, + required this.session, + required this.sequence, + required this.clip, + }); + final String projectId, timelineId; + final EditorTimelineSession session; + final SequenceId sequence; + final ElementId clip; + + @override + ConsumerState createState() => _EffectPropertiesState(); +} + +class _EffectPropertiesState extends ConsumerState { + Object get _identity => ( + widget.session, + widget.sequence, + widget.clip, + widget.projectId, + widget.timelineId, + ); + PropertyEditController _createController() => PropertyEditController( + session: widget.session, + sequence: widget.sequence, + clip: widget.clip, + projectId: widget.projectId, + timelineId: widget.timelineId, + operation: 'editEffect', + ); + late PropertyEditController _controller = _createController(); + + @override + void didUpdateWidget(covariant EffectProperties oldWidget) { + super.didUpdateWidget(oldWidget); + if (_controller.identity != _identity) { + _controller.dispose(); + _controller = _createController(); + } + } + + @override + void dispose() { + _controller.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + final preview = ref + .watch(editorPreviewProvider(widget.projectId, widget.timelineId)) + .asData + ?.value; + final controller = _controller; + final view = widget.session.view(widget.sequence); + return ListenableBuilder( + listenable: Listenable.merge([controller, view]), + builder: (context, _) { + final animation = controller.animation; + if (animation == null) return const SizedBox.shrink(); + final stack = ClipEffectStack(animation.record, animation.localTick); + final enabled = + !controller.saving && + stack.containsPlayhead && + preview?.transforms.hasPending != true; + Future edit(void Function(EditorCommandService, int) action) => + controller.run(preview, action); + final keyframes = PropertyKeyframeControls( + stack: stack, + enabled: enabled, + onEdit: (ids, {action, interpolation}) => edit( + (c, t) => c.editKeyframeChannel( + sequence: widget.sequence, + clip: widget.clip, + tick: t, + parameterIds: ids, + action: action, + interpolation: interpolation, + ), + ), + onSeek: (offset) => controller.run( + preview, + (_, tick) => view.seekTo(tick - stack.localTick + offset), + seek: true, + ), + ); + return EffectList( + stack: stack, + enabled: enabled, + keyframes: keyframes, + error: controller.failed ? context.l10n.updateEffectFailed : null, + onAdd: (type) => edit( + (c, t) => c.addEffect( + sequence: widget.sequence, + clip: widget.clip, + tick: t, + effectId: c.newEffectId(), + type: type, + ), + ), + onReorder: (order) => edit( + (c, t) => c.configureEffects( + sequence: widget.sequence, + clip: widget.clip, + tick: t, + order: order, + ), + ), + onToggle: (layer) => edit( + (c, t) => c.configureEffects( + sequence: widget.sequence, + clip: widget.clip, + tick: t, + effectId: layer.id, + enabled: !layer.enabled, + ), + ), + onRemove: (layer) => edit( + (c, t) => c.removeEffect( + sequence: widget.sequence, + clip: widget.clip, + tick: t, + effectId: layer.id, + ), + ), + editorBuilder: (layer) => EffectParameterEditor( + layer: layer, + stack: stack, + enabled: enabled, + editContext: controller.identity, + keyframes: keyframes, + onChange: (values) => edit( + (c, t) => c.setEffect( + sequence: widget.sequence, + clip: widget.clip, + tick: t, + effectId: layer.id, + values: values, + ), + ), + onTypeChange: (type) => edit( + (c, t) => c.changeEffectType( + sequence: widget.sequence, + clip: widget.clip, + tick: t, + effectId: layer.id, + type: type, + ), + ), + ), + ); + }, + ); + } +} diff --git a/lib/features/properties/picture_edits.dart b/lib/features/properties/picture_edits.dart index 9b0e5e2..3e9c028 100644 --- a/lib/features/properties/picture_edits.dart +++ b/lib/features/properties/picture_edits.dart @@ -1,25 +1,19 @@ +import 'dart:async'; + 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:freezed_annotation/freezed_annotation.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart'; import '../../workspace/timeline_session.dart'; +import 'property_edit_boundary.dart'; part 'picture_edits.g.dart'; part 'picture_edits.freezed.dart'; enum PictureEditFailure { keyframes, alignment, invalidTransform, transform } -@freezed -abstract class PictureEditTarget with _$PictureEditTarget { - const factory PictureEditTarget({ - required TimelineVersion version, - required int tick, - }) = _PictureEditTarget; -} - @freezed abstract class PictureEditException with _$PictureEditException @@ -31,35 +25,16 @@ abstract class PictureEditException @riverpod class PictureEdits extends _$PictureEdits { Future? _pending; + late PropertyEditBoundary _boundary; @override AsyncValue build( EditorTimelineSession session, SequenceId sequence, ElementId clip, - ) => const AsyncData(null); - - PictureEditTarget _capture() { - final view = session.view(sequence); - return PictureEditTarget( - version: view.version.kernelVersion, - tick: view.playheadTick, - ); - } - - bool _valid( - PictureEditTarget target, - bool Function() isCurrent, - PreviewController? preview, ) { - if (!ref.mounted || - !isCurrent() || - session.activeSequenceId != sequence || - preview?.transforms.hasPending == true) { - return false; - } - final view = session.view(sequence); - return target.tick == view.playheadTick && - identical(target.version, view.version.kernelVersion); + _boundary = PropertyEditBoundary(session, sequence, clip); + ref.onDispose(_boundary.dispose); + return const AsyncData(null); } ClipAnimation? animation() { @@ -86,10 +61,9 @@ class PictureEdits extends _$PictureEdits { if (state.isLoading || preview?.transforms.hasPending == true) { return Future.value(false); } - final target = _capture(); - final work = _run(PictureEditFailure.transform, () async { - await preview?.pauseForCanvasInteraction(); - if (!_valid(target, isCurrent, preview)) return false; + final work = _run(PictureEditFailure.transform, preview, isCurrent, ( + target, + ) { final current = animation()?.value; if (current == null) return false; final value = change(current); @@ -101,7 +75,8 @@ class PictureEdits extends _$PictureEdits { value.scale == current.scale && value.scaleY == current.scaleY && value.rotation == current.rotation && - value.sameCorners(current)) { + value.sameCorners(current) && + value.distortion.same(current.distortion)) { return true; } session.commands.setTransform( @@ -133,10 +108,7 @@ class PictureEdits extends _$PictureEdits { preview?.transforms.hasPending == true) { return; } - final target = _capture(); - await _run(PictureEditFailure.keyframes, () async { - await preview?.pauseForCanvasInteraction(); - if (!_valid(target, isCurrent, preview)) return false; + await _run(PictureEditFailure.keyframes, preview, isCurrent, (target) { session.commands.editKeyframeChannel( sequence: sequence, clip: clip, @@ -155,7 +127,6 @@ class PictureEdits extends _$PictureEdits { required bool Function() isCurrent, }) async { if (state.isLoading || preview.transforms.hasPending) return; - final target = _capture(); final current = animation(); if (current == null) return; final command = AlignClip( @@ -167,12 +138,13 @@ class PictureEdits extends _$PictureEdits { alignment: alignment, expectedVersion: session.version, ); - await _run(PictureEditFailure.alignment, () async { - await preview.pauseForCanvasInteraction(); + await _run(PictureEditFailure.alignment, preview, isCurrent, ( + target, + ) async { await session.alignClip( sequence, command, - isCancelled: () => !_valid(target, isCurrent, preview), + isCancelled: () => !target.isCurrent, ); return true; }); @@ -180,24 +152,22 @@ class PictureEdits extends _$PictureEdits { Future _run( PictureEditFailure failure, - Future Function() action, + PreviewController? preview, + bool Function() isCurrent, + FutureOr Function(PropertyEditContext) action, ) async { final lease = ref.keepAlive(); - state = const AsyncLoading(); try { - final applied = await session.runEditAsync( - switch (failure) { + final applied = await _boundary.run( + preview, + action, + isCurrent: () => ref.mounted && isCurrent(), + started: () => state = const AsyncLoading(), + operation: switch (failure) { PictureEditFailure.keyframes => 'editKeyframes', PictureEditFailure.alignment => 'alignClip', _ => 'setTransform', }, - sequence, - action, - context: { - 'clipIds': [clip.value], - 'entryPoint': 'property', - 'playheadTick': session.view(sequence).playheadTick, - }, ); if (ref.mounted) state = const AsyncData(null); return applied; diff --git a/lib/features/properties/picture_edits.freezed.dart b/lib/features/properties/picture_edits.freezed.dart index ed0b9de..17d2da6 100644 --- a/lib/features/properties/picture_edits.freezed.dart +++ b/lib/features/properties/picture_edits.freezed.dart @@ -12,318 +12,6 @@ part of 'picture_edits.dart'; // GENERATED CODE - DO NOT MODIFY BY HAND T _$identity(T value) => value; -/// @nodoc -mixin _$PictureEditTarget { - TimelineVersion get version; - int get tick; - - /// Create a copy of PictureEditTarget - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $PictureEditTargetCopyWith get copyWith => - _$PictureEditTargetCopyWithImpl( - this as PictureEditTarget, - _$identity, - ); - - @override - bool operator ==(Object other) { - final _this = this as PictureEditTarget; - return identical(this, other) || - (other.runtimeType == runtimeType && - other is PictureEditTarget && - (identical(other.version, _this.version) || - other.version == _this.version) && - (identical(other.tick, _this.tick) || other.tick == _this.tick)); - } - - @override - int get hashCode { - final _this = this as PictureEditTarget; - return Object.hash(runtimeType, _this.version, _this.tick); - } - - @override - String toString() { - final _this = this as PictureEditTarget; - return 'PictureEditTarget(version: ${_this.version}, tick: ${_this.tick})'; - } -} - -/// @nodoc -abstract mixin class $PictureEditTargetCopyWith<$Res> { - factory $PictureEditTargetCopyWith( - PictureEditTarget value, - $Res Function(PictureEditTarget) _then, - ) = _$PictureEditTargetCopyWithImpl; - @useResult - $Res call({TimelineVersion version, int tick}); -} - -/// @nodoc -class _$PictureEditTargetCopyWithImpl<$Res> - implements $PictureEditTargetCopyWith<$Res> { - _$PictureEditTargetCopyWithImpl(this._self, this._then); - - final PictureEditTarget _self; - final $Res Function(PictureEditTarget) _then; - - /// Create a copy of PictureEditTarget - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({Object? version = null, Object? tick = null}) { - return _then( - PictureEditTarget( - version: null == version - ? _self.version - : version // ignore: cast_nullable_to_non_nullable - as TimelineVersion, - tick: null == tick - ? _self.tick - : tick // ignore: cast_nullable_to_non_nullable - as int, - ), - ); - } -} - -/// Adds pattern-matching-related methods to [PictureEditTarget]. -extension PictureEditTargetPatterns on PictureEditTarget { - /// A variant of `map` that fallback to returning `orElse`. - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case final Subclass value: - /// return ...; - /// case _: - /// return orElse(); - /// } - /// ``` - - @optionalTypeArgs - TResult maybeMap( - TResult Function(_PictureEditTarget value)? $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _PictureEditTarget() when $default != null: - return $default(_that); - case _: - return orElse(); - } - } - - /// A `switch`-like method, using callbacks. - /// - /// Callbacks receives the raw object, upcasted. - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case final Subclass value: - /// return ...; - /// case final Subclass2 value: - /// return ...; - /// } - /// ``` - - @optionalTypeArgs - TResult map( - TResult Function(_PictureEditTarget value) $default, - ) { - final _that = this; - switch (_that) { - case _PictureEditTarget(): - return $default(_that); - case _: - throw StateError('Unexpected subclass'); - } - } - - /// A variant of `map` that fallback to returning `null`. - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case final Subclass value: - /// return ...; - /// case _: - /// return null; - /// } - /// ``` - - @optionalTypeArgs - TResult? mapOrNull( - TResult? Function(_PictureEditTarget value)? $default, - ) { - final _that = this; - switch (_that) { - case _PictureEditTarget() when $default != null: - return $default(_that); - case _: - return null; - } - } - - /// A variant of `when` that fallback to an `orElse` callback. - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case Subclass(:final field): - /// return ...; - /// case _: - /// return orElse(); - /// } - /// ``` - - @optionalTypeArgs - TResult maybeWhen( - TResult Function(TimelineVersion version, int tick)? $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _PictureEditTarget() when $default != null: - return $default(_that.version, _that.tick); - case _: - return orElse(); - } - } - - /// A `switch`-like method, using callbacks. - /// - /// As opposed to `map`, this offers destructuring. - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case Subclass(:final field): - /// return ...; - /// case Subclass2(:final field2): - /// return ...; - /// } - /// ``` - - @optionalTypeArgs - TResult when( - TResult Function(TimelineVersion version, int tick) $default, - ) { - final _that = this; - switch (_that) { - case _PictureEditTarget(): - return $default(_that.version, _that.tick); - case _: - throw StateError('Unexpected subclass'); - } - } - - /// A variant of `when` that fallback to returning `null` - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case Subclass(:final field): - /// return ...; - /// case _: - /// return null; - /// } - /// ``` - - @optionalTypeArgs - TResult? whenOrNull( - TResult? Function(TimelineVersion version, int tick)? $default, - ) { - final _that = this; - switch (_that) { - case _PictureEditTarget() when $default != null: - return $default(_that.version, _that.tick); - case _: - return null; - } - } -} - -/// @nodoc - -class _PictureEditTarget implements PictureEditTarget { - const _PictureEditTarget({required this.version, required this.tick}); - - @override - final TimelineVersion version; - @override - final int tick; - - /// Create a copy of PictureEditTarget - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$PictureEditTargetCopyWith<_PictureEditTarget> get copyWith => - __$PictureEditTargetCopyWithImpl<_PictureEditTarget>(this, _$identity); - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _PictureEditTarget && - (identical(other.version, version) || other.version == version) && - (identical(other.tick, tick) || other.tick == tick)); - } - - @override - int get hashCode { - return Object.hash(runtimeType, version, tick); - } - - @override - String toString() { - return 'PictureEditTarget(version: $version, tick: $tick)'; - } -} - -/// @nodoc -abstract mixin class _$PictureEditTargetCopyWith<$Res> - implements $PictureEditTargetCopyWith<$Res> { - factory _$PictureEditTargetCopyWith( - _PictureEditTarget value, - $Res Function(_PictureEditTarget) _then, - ) = __$PictureEditTargetCopyWithImpl; - @override - @useResult - $Res call({TimelineVersion version, int tick}); -} - -/// @nodoc -class __$PictureEditTargetCopyWithImpl<$Res> - implements _$PictureEditTargetCopyWith<$Res> { - __$PictureEditTargetCopyWithImpl(this._self, this._then); - - final _PictureEditTarget _self; - final $Res Function(_PictureEditTarget) _then; - - /// Create a copy of PictureEditTarget - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({Object? version = null, Object? tick = null}) { - return _then( - _PictureEditTarget( - version: null == version - ? _self.version - : version // ignore: cast_nullable_to_non_nullable - as TimelineVersion, - tick: null == tick - ? _self.tick - : tick // ignore: cast_nullable_to_non_nullable - as int, - ), - ); - } -} - /// @nodoc mixin _$PictureEditException { PictureEditFailure get failure; diff --git a/lib/features/properties/picture_edits.g.dart b/lib/features/properties/picture_edits.g.dart index 3bdb68d..723f3f7 100644 --- a/lib/features/properties/picture_edits.g.dart +++ b/lib/features/properties/picture_edits.g.dart @@ -58,7 +58,7 @@ final class PictureEditsProvider } } -String _$pictureEditsHash() => r'5a8ab10fcac9638fb0d98e214744f190fa499434'; +String _$pictureEditsHash() => r'b3166b6e97f6a711e6e92b67dfc44341a3fec4e2'; final class PictureEditsFamily extends $Family with diff --git a/lib/features/properties/picture_properties.dart b/lib/features/properties/picture_properties.dart index 17c8aa4..f669b3a 100644 --- a/lib/features/properties/picture_properties.dart +++ b/lib/features/properties/picture_properties.dart @@ -22,7 +22,10 @@ import '../../shared/state/operation_scope.dart'; import '../preview/preview_panel.dart'; import 'property_number_input.dart'; import 'picture_edits.dart'; -import 'shadow_properties.dart'; +import 'effect_properties.dart'; +import 'stroke_properties.dart'; +import 'distortion_properties.dart'; +import 'effect_labels.dart'; class PictureProperties extends ConsumerStatefulWidget { const PictureProperties({ @@ -208,7 +211,8 @@ class _PicturePropertiesState extends ConsumerState { value.rotation == _scrubBase!.rotation && value.scale == _scrubBase!.scale && value.scaleY == _scrubBase!.scaleY && - value.sameCorners(_scrubBase!))) { + value.sameCorners(_scrubBase!) && + value.distortion.same(_scrubBase!.distortion))) { _cancelScrub(); return; } @@ -271,6 +275,10 @@ class _PicturePropertiesState extends ConsumerState { value.scale, value.scaleY, value.rotation, + value.distortion.topLeft, + value.distortion.topRight, + value.distortion.bottomRight, + value.distortion.bottomLeft, value.cornerRadius, value.topLeftRadius, value.topRightRadius, @@ -866,6 +874,13 @@ class _PicturePropertiesState extends ConsumerState { keyTools(TransformChannel.scale), ]), ], + DistortionProperties( + projectId: widget.projectId, + timelineId: widget.timelineId, + session: widget.session, + sequence: widget.sequence, + clip: widget.clip.id, + ), section([ if (desktop) AppPropertyGroup( @@ -921,7 +936,14 @@ class _PicturePropertiesState extends ConsumerState { keyTools(TransformChannel.cornerRadius), ], ]), - ShadowProperties( + 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, @@ -996,17 +1018,29 @@ class _KeyframeTimeline extends StatelessWidget { for (final (id, label, times) in [ for (final channel in TransformChannel.values) (channel.name, channel.label(context), animation.keyTimes(channel)), - if (ClipShadowStack( + for (final layer in ClipStrokeStack( animation.record, animation.localTick, - ).layers.isNotEmpty) + ).layers) ( - 'shadow', - context.l10n.shadow, - ClipShadowStack( - animation.record, - animation.localTick, - ).keyOffsets.map((t) => animation.start + t).toList(), + '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( diff --git a/lib/features/properties/property_color_input.dart b/lib/features/properties/property_color_input.dart new file mode 100644 index 0000000..929ca4e --- /dev/null +++ b/lib/features/properties/property_color_input.dart @@ -0,0 +1,152 @@ +import 'package:cutdex/l10n/l10n.dart'; +import 'package:cutdex_ui/widgets.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/widget_previews.dart'; +import 'package:cutdex_ui/theme.dart'; + +import '../../shared/state/operation_scope.dart'; +import 'property_color_picker.dart'; + +class PropertyColorInput extends StatefulWidget { + const PropertyColorInput({ + super.key, + required this.value, + required this.color, + required this.enabled, + required this.editContext, + required this.submit, + }); + final String value; + final Color color; + final bool enabled; + final Object editContext; + final Future Function(int) submit; + @override + State createState() => _PropertyColorInputState(); +} + +class _PropertyColorInputState extends State { + late final _text = TextEditingController(text: widget.value); + final _focus = FocusNode(); + bool _dirty = false; + String? _error; + late final _operations = OperationScope(widget.editContext); + @override + void initState() { + super.initState(); + _focus.addListener(_blur); + } + + void _blur() { + if (!_focus.hasFocus) _submit(); + } + + Future _submit() async { + if (!_dirty || !widget.enabled) return; + final value = _text.text.replaceFirst('#', ''); + if (!RegExp(r'^[A-Fa-f0-9]{6}$').hasMatch(value)) { + setState(() => _error = context.l10n.invalidNumber); + return; + } + _dirty = false; + final guard = _operations.begin(); + final ok = await widget.submit(int.parse(value, radix: 16)); + if (!mounted || !guard()) return; + setState(() { + _error = ok ? null : context.l10n.notApplied; + _text.text = widget.value; + }); + } + + @override + void didUpdateWidget(covariant PropertyColorInput oldWidget) { + super.didUpdateWidget(oldWidget); + _operations.bind(widget.editContext); + if (oldWidget.editContext != widget.editContext || !widget.enabled) { + _dirty = false; + _error = null; + } + if (!_dirty && _text.text != widget.value) _text.text = widget.value; + } + + @override + void dispose() { + _operations.dispose(); + _focus.removeListener(_blur); + _focus.dispose(); + _text.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) => AppTextField( + controller: _text, + focusNode: _focus, + enabled: widget.enabled, + errorText: _error, + leading: AppPopover( + width: 240, + borderRadius: 8, + padding: const EdgeInsets.all(16), + backgroundColor: Theme.of(context).colorScheme.surfaceContainerLow, + builder: (context, toggle) => IconButton( + key: const ValueKey('effect-color-swatch'), + tooltip: context.l10n.color, + onPressed: widget.enabled ? toggle : null, + padding: EdgeInsets.zero, + icon: Container( + width: 14, + height: 14, + decoration: BoxDecoration( + color: widget.color, + borderRadius: BorderRadius.circular(2), + border: Border.all( + color: Theme.of(context).colorScheme.outlineVariant, + ), + ), + ), + ), + child: PropertyColorPicker( + color: widget.color, + enabled: widget.enabled, + submit: (color) => widget.submit(color.toARGB32() & 0xFFFFFF), + ), + ), + onChanged: (_) { + _operations.invalidate(); + _dirty = true; + if (_error != null) setState(() => _error = null); + }, + onEditingComplete: () {}, + onSubmitted: (_) => _submit(), + ); +} + +@Preview(name: 'Property color input', size: Size(240, 80)) +Widget propertyColorInputPreview() { + var rgb = 0x3366FF; + return MaterialApp( + localizationsDelegates: AppLocalizations.localizationsDelegates, + supportedLocales: AppLocalizations.supportedLocales, + theme: AppTheme.propertiesPanelTheme( + AppTheme.desktopWorkspaceTheme(AppTheme.penDark), + ), + home: Scaffold( + body: Padding( + padding: const EdgeInsets.all(16), + child: StatefulBuilder( + builder: (context, update) => PropertyColorInput( + value: rgb.toRadixString(16).padLeft(6, '0').toUpperCase(), + color: Color(0xFF000000 | rgb), + enabled: true, + editContext: 'preview', + submit: (value) async { + update(() => rgb = value); + return true; + }, + ), + ), + ), + ), + ); +} diff --git a/lib/features/properties/property_color_picker.dart b/lib/features/properties/property_color_picker.dart new file mode 100644 index 0000000..b4d111b --- /dev/null +++ b/lib/features/properties/property_color_picker.dart @@ -0,0 +1,214 @@ +import 'package:flutter/material.dart'; +import 'package:cutdex/l10n/l10n.dart'; +import 'package:cutdex_ui/theme.dart'; +import 'package:flutter/widget_previews.dart'; + +class PropertyColorPicker extends StatefulWidget { + const PropertyColorPicker({ + super.key, + required this.color, + required this.enabled, + required this.submit, + }); + final Color color; + final bool enabled; + final Future Function(Color) submit; + + @override + State createState() => _PropertyColorPickerState(); +} + +class _PropertyColorPickerState extends State { + late HSVColor _color = HSVColor.fromColor(widget.color); + + @override + void didUpdateWidget(covariant PropertyColorPicker oldWidget) { + super.didUpdateWidget(oldWidget); + if (widget.color != oldWidget.color) { + _color = HSVColor.fromColor(widget.color); + } + } + + Future _commit() async { + if (!widget.enabled) return; + await widget.submit(_color.toColor()); + if (mounted) setState(() => _color = HSVColor.fromColor(widget.color)); + } + + @override + Widget build(BuildContext context) => Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Text( + context.l10n.color, + style: AppTheme.propertySectionTitleStyle(context), + ), + const SizedBox(height: 12), + SizedBox( + height: 140, + child: LayoutBuilder( + builder: (context, constraints) { + final width = constraints.maxWidth; + const height = 140.0; + void update(Offset position) { + if (!widget.enabled) return; + setState( + () => _color = _color + .withSaturation((position.dx / width).clamp(0, 1)) + .withValue((1 - position.dy / height).clamp(0, 1)), + ); + } + + return Semantics( + label: context.l10n.color, + child: GestureDetector( + key: const ValueKey('effect-color-plane'), + onTapDown: (details) => update(details.localPosition), + onTapUp: (_) => _commit(), + onPanStart: (details) => update(details.localPosition), + onPanUpdate: (details) => update(details.localPosition), + onPanEnd: (_) => _commit(), + child: ClipRRect( + borderRadius: BorderRadius.circular(5), + child: SizedBox( + height: height, + child: Stack( + children: [ + Positioned.fill( + child: ColoredBox( + color: HSVColor.fromAHSV( + 1, + _color.hue, + 1, + 1, + ).toColor(), + ), + ), + const Positioned.fill( + child: DecoratedBox( + decoration: BoxDecoration( + gradient: LinearGradient( + colors: [Colors.white, Color(0x00FFFFFF)], + ), + ), + ), + ), + const Positioned.fill( + child: DecoratedBox( + decoration: BoxDecoration( + gradient: LinearGradient( + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + colors: [Colors.transparent, Colors.black], + ), + ), + ), + ), + Positioned( + left: (_color.saturation * width - 6).clamp( + 0, + width - 12, + ), + top: ((1 - _color.value) * height - 6).clamp( + 0, + height - 12, + ), + child: Container( + width: 12, + height: 12, + decoration: BoxDecoration( + shape: BoxShape.circle, + border: Border.all(color: Colors.white, width: 2), + boxShadow: const [ + BoxShadow(color: Colors.black54, blurRadius: 2), + ], + ), + ), + ), + ], + ), + ), + ), + ), + ); + }, + ), + ), + const SizedBox(height: 8), + SizedBox( + height: 24, + child: Stack( + alignment: Alignment.center, + children: [ + Container( + height: 12, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(6), + gradient: const LinearGradient( + colors: [ + Color(0xFFFF0000), + Color(0xFFFFFF00), + Color(0xFF00FF00), + Color(0xFF00FFFF), + Color(0xFF0000FF), + Color(0xFFFF00FF), + Color(0xFFFF0000), + ], + ), + ), + ), + SliderTheme( + data: SliderTheme.of(context).copyWith( + padding: EdgeInsets.zero, + trackHeight: 12, + activeTrackColor: Colors.transparent, + inactiveTrackColor: Colors.transparent, + thumbColor: Colors.white, + thumbShape: const RoundSliderThumbShape(enabledThumbRadius: 6), + overlayShape: SliderComponentShape.noOverlay, + ), + child: Slider( + key: const ValueKey('effect-color-hue'), + min: 0, + max: 360, + value: _color.hue, + onChanged: widget.enabled + ? (hue) => setState(() => _color = _color.withHue(hue)) + : null, + onChangeEnd: (_) => _commit(), + ), + ), + ], + ), + ), + ], + ); +} + +@Preview(name: 'Property color picker', size: Size(240, 240)) +Widget propertyColorPickerPreview() { + var color = const Color(0xFF3366FF); + return MaterialApp( + localizationsDelegates: AppLocalizations.localizationsDelegates, + supportedLocales: AppLocalizations.supportedLocales, + theme: AppTheme.propertiesPanelTheme( + AppTheme.desktopWorkspaceTheme(AppTheme.penDark), + ), + home: Scaffold( + body: Padding( + padding: const EdgeInsets.all(16), + child: StatefulBuilder( + builder: (context, update) => PropertyColorPicker( + color: color, + enabled: true, + submit: (value) async { + update(() => color = value); + return true; + }, + ), + ), + ), + ), + ); +} diff --git a/lib/features/properties/property_edit_boundary.dart b/lib/features/properties/property_edit_boundary.dart new file mode 100644 index 0000000..bb780b6 --- /dev/null +++ b/lib/features/properties/property_edit_boundary.dart @@ -0,0 +1,89 @@ +import 'dart:async'; + +import 'package:cutdex_sdk/editor.dart'; +import 'package:cutdex_sdk/preview.dart'; +import 'package:cutdex_sdk/timeline_ui.dart'; +import 'package:cutdex_sdk/timeline/engine.dart'; +import 'package:cutdex_sdk/timeline/model.dart'; + +import '../../workspace/timeline_session.dart'; + +/// Shared pause, stale-context checks and diagnostics for inspector edits. +class PropertyEditBoundary { + PropertyEditBoundary(this.session, this.sequence, this.clip); + + final EditorTimelineSession session; + final SequenceId sequence; + final ElementId clip; + bool _disposed = false; + bool _busy = false; + + void dispose() => _disposed = true; + + bool canRun(PreviewController? preview) => + !_disposed && + !_busy && + session.activeSequenceId == sequence && + preview?.transforms.hasPending != true; + + Future run( + PreviewController? preview, + FutureOr Function(PropertyEditContext) action, { + required String operation, + bool Function()? isCurrent, + bool seek = false, + void Function()? started, + }) async { + if (!canRun(preview) || isCurrent?.call() == false) return false; + final view = session.view(sequence); + final target = PropertyEditContext._( + tick: view.playheadTick, + version: view.version.kernelVersion, + current: () => + !_disposed && + isCurrent?.call() != false && + session.activeSequenceId == sequence && + preview?.transforms.hasPending != true, + view: view, + ); + _busy = true; + try { + started?.call(); + await preview?.pauseForCanvasInteraction(); + if (!target.isCurrent) return false; + if (seek) return await action(target); + return await session.runEditAsync( + operation, + sequence, + () async => action(target), + context: { + 'clipIds': [clip.value], + 'entryPoint': 'property', + 'playheadTick': target.tick, + }, + ); + } finally { + _busy = false; + } + } +} + +class PropertyEditContext { + PropertyEditContext._({ + required this.tick, + required this._version, + required this._current, + required this._view, + }); + + final int tick; + final TimelineVersion _version; + final bool Function() _current; + final TimelineViewController _view; + + /// Async operations check this again immediately before publication. + bool get isCurrent => + _current() && + _view.playheadTick == tick && + identical(_view.version.kernelVersion, _version); +} diff --git a/lib/features/properties/property_edit_controller.dart b/lib/features/properties/property_edit_controller.dart new file mode 100644 index 0000000..2699ee0 --- /dev/null +++ b/lib/features/properties/property_edit_controller.dart @@ -0,0 +1,84 @@ +import 'package:cutdex_sdk/editor.dart'; +import 'package:cutdex_sdk/preview.dart'; +import 'package:cutdex_sdk/timeline/model.dart'; +import 'package:flutter/foundation.dart'; + +import 'property_edit_boundary.dart'; +import '../../workspace/timeline_session.dart'; + +/// Owns the asynchronous edit boundary for one selected clip. +class PropertyEditController extends ChangeNotifier { + PropertyEditController({ + required this.session, + required this.sequence, + required this.clip, + required this.projectId, + required this.timelineId, + required this.operation, + }); + final EditorTimelineSession session; + final SequenceId sequence; + final ElementId clip; + final String projectId, timelineId, operation; + Object get identity => (session, sequence, clip, projectId, timelineId); + late final _boundary = PropertyEditBoundary(session, sequence, clip); + bool _disposed = false; + bool _saving = false; + bool _failed = false; + bool get saving => _saving; + bool get failed => _failed; + + @override + void dispose() { + _disposed = true; + _boundary.dispose(); + super.dispose(); + } + + ClipParameterAnimation? get animation { + final view = session.view(sequence); + final query = view.version.kernelVersion.query(); + final handle = query.elementById(clip); + return handle == null + ? null + : ClipParameterAnimation( + query.element(handle), + view.playheadTick - query.absoluteStart(handle), + ); + } + + Future run( + PreviewController? preview, + void Function(EditorCommandService, int) action, { + bool seek = false, + }) async { + if (_disposed || saving || !_boundary.canRun(preview)) return false; + try { + return await _boundary.run( + preview, + (target) { + action(session.commands, target.tick); + return true; + }, + operation: operation, + seek: seek, + started: () { + _saving = true; + _failed = false; + notifyListeners(); + }, + ); + } catch (_) { + if (!_disposed) { + _failed = true; + notifyListeners(); + } + return false; + } finally { + if (!_disposed) { + _saving = false; + notifyListeners(); + } + } + } +} diff --git a/lib/features/properties/property_keyframe_controls.dart b/lib/features/properties/property_keyframe_controls.dart new file mode 100644 index 0000000..d5d4c99 --- /dev/null +++ b/lib/features/properties/property_keyframe_controls.dart @@ -0,0 +1,105 @@ +import 'dart:math' as math; + +import 'package:cutdex/l10n/l10n.dart'; +import 'package:cutdex_sdk/editor.dart'; +import 'package:cutdex_sdk/timeline/model.dart'; +import 'package:cutdex_ui/icons.dart'; +import 'package:cutdex_ui/widgets.dart'; +import 'package:flutter/material.dart'; + +typedef PropertyKeyframeEdit = Future Function( + List ids, { + KeyframeAction? action, + ParameterInterpolation? interpolation, +}); + +/// Keyframe controls share channel state and intent callbacks across property fields. +class PropertyKeyframeControls { + const PropertyKeyframeControls({ + required this.stack, + required this.enabled, + required this.onEdit, + required this.onSeek, + }); + final ClipParameterAnimation stack; + final bool enabled; + final PropertyKeyframeEdit onEdit; + final Future Function(int localTick) onSeek; + + Widget button( + BuildContext context, + List ids, + String label, + String id, + ) => IconButton( + key: ValueKey(id), + tooltip: context.l10n.toggleKeyframe( + stack.keyed(ids) ? context.l10n.delete : context.l10n.addKeyframeAction, + label, + ), + isSelected: stack.keyed(ids), + color: stack.animated(ids) ? Theme.of(context).colorScheme.primary : null, + icon: Transform.rotate( + angle: math.pi / 4, + child: Icon( + stack.keyed(ids) ? AppIcons.squareFilled : AppIcons.square, + size: 12, + ), + ), + onPressed: enabled && ids.isNotEmpty ? () => onEdit(ids) : null, + ); + + Widget menu(BuildContext context, List ids, String label, String id) { + final offsets = stack.keyOffsets(ids); + final currentTick = stack.localTick; + final previous = offsets.where((t) => t < currentTick).lastOrNull; + final next = offsets.where((t) => t > currentTick).firstOrNull; + return AppDropdownMenu( + enabled: enabled, + builder: (context, toggle, focus) => IconButton( + key: ValueKey('$id-menu'), + focusNode: focus, + tooltip: context.l10n.keyframeSettings(label), + onPressed: enabled ? toggle : null, + icon: const Icon(AppIcons.more, size: 16), + ), + items: [ + AppMenuItem( + closeAncestors: false, + label: context.l10n.previousKeyframe(label), + onPressed: previous == null ? null : () => onSeek(previous), + ), + AppMenuItem( + closeAncestors: false, + label: context.l10n.nextKeyframe(label), + onPressed: next == null ? null : () => onSeek(next), + ), + for (final (mode, text) in [ + (ParameterInterpolation.linear, context.l10n.linear), + (ParameterInterpolation.hold, context.l10n.hold), + (ParameterInterpolation.easeIn, context.l10n.easeIn), + (ParameterInterpolation.easeOut, context.l10n.easeOut), + (ParameterInterpolation.easeInOut, context.l10n.easeInOut), + ]) + AppMenuItem( + closeAncestors: false, + label: text, + onPressed: stack.keyed(ids) + ? () => onEdit( + ids, + action: KeyframeAction.set, + interpolation: mode, + ) + : null, + ), + AppMenuItem( + closeAncestors: false, + label: context.l10n.removeAllKeyframes, + onPressed: stack.animated(ids) + ? () => onEdit(ids, action: KeyframeAction.clear) + : null, + ), + ], + ); + } +} diff --git a/lib/features/properties/property_layer_row.dart b/lib/features/properties/property_layer_row.dart new file mode 100644 index 0000000..065f674 --- /dev/null +++ b/lib/features/properties/property_layer_row.dart @@ -0,0 +1,288 @@ +import 'package:cutdex/l10n/l10n.dart'; +import 'package:cutdex_ui/icons.dart'; +import 'package:cutdex_ui/theme.dart'; +import 'package:cutdex_ui/widgets.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter/widget_previews.dart'; + +class PropertyLayerRow extends StatefulWidget { + const PropertyLayerRow({ + super.key, + required this.id, + required this.prefix, + required this.index, + required this.enabled, + required this.visible, + required this.label, + required this.tooltip, + required this.onVisibility, + required this.onRemove, + required this.menuItems, + required this.editor, + this.leading, + this.editorLabel, + }); + final String id, prefix, label, tooltip; + final int index; + final bool enabled, visible; + final VoidCallback onVisibility, onRemove; + final List menuItems; + final Widget editor; + final Widget? leading; + final String? editorLabel; + + @override + State createState() => _PropertyLayerRowState(); +} + +class _PropertyLayerRowState extends State { + final _menu = MenuController(); + final _focus = FocusNode(); + bool _hovered = false; + + @override + void dispose() { + _focus.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + final theme = Theme.of(context); + final colors = theme.colorScheme; + return MenuAnchor( + controller: _menu, + childFocusNode: _focus, + clipBehavior: Clip.none, + // Place the editor beside the inspector, as in Figma's effects panel. + alignmentOffset: Offset( + -240 - 8 - AppTheme.propertySectionPadding(context).left, + 0, + ), + style: const MenuStyle( + alignment: AlignmentDirectional.topStart, + padding: WidgetStatePropertyAll(EdgeInsets.zero), + backgroundColor: WidgetStatePropertyAll(Colors.transparent), + surfaceTintColor: WidgetStatePropertyAll(Colors.transparent), + elevation: WidgetStatePropertyAll(0), + side: WidgetStatePropertyAll(BorderSide.none), + shape: WidgetStatePropertyAll( + RoundedRectangleBorder( + borderRadius: BorderRadius.all(Radius.circular(8)), + ), + ), + ), + onOpen: () => setState(() {}), + onClose: () => setState(() {}), + menuChildren: [ + SizedBox( + key: ValueKey('${widget.prefix}-editor-${widget.id}'), + width: 240, + child: Material( + color: colors.surfaceContainerLow, + surfaceTintColor: Colors.transparent, + elevation: 8, + shadowColor: colors.shadow.withValues(alpha: .25), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(8), + side: BorderSide(color: colors.outlineVariant), + ), + clipBehavior: Clip.antiAlias, + child: Focus( + autofocus: true, + onKeyEvent: (_, event) { + if (event is KeyDownEvent && + event.logicalKey == LogicalKeyboardKey.escape) { + _menu.close(); + return KeyEventResult.handled; + } + return KeyEventResult.ignored; + }, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + SizedBox( + height: 40, + child: Padding( + padding: const EdgeInsets.only(left: 16, right: 8), + child: Row( + children: [ + Expanded( + child: Text( + widget.editorLabel ?? widget.label, + style: AppTheme.propertySectionTitleStyle( + context, + ), + ), + ), + AppDropdownMenu( + builder: (context, toggle, focus) => IconButton( + focusNode: focus, + tooltip: widget.tooltip, + icon: const Icon(AppIcons.more, size: 16), + onPressed: toggle, + ), + items: widget.menuItems, + ), + IconButton( + key: ValueKey( + '${widget.prefix}-editor-close-${widget.id}', + ), + tooltip: context.l10n.close, + icon: const Icon(AppIcons.close, size: 16), + onPressed: _menu.close, + ), + ], + ), + ), + ), + Divider(height: 1, color: theme.dividerColor), + Padding( + padding: const EdgeInsets.fromLTRB(16, 12, 16, 12), + child: ConstrainedBox( + constraints: BoxConstraints( + maxHeight: (MediaQuery.sizeOf(context).height - 120) + .clamp(80, 600), + ), + child: SingleChildScrollView( + primary: false, + child: widget.editor, + ), + ), + ), + ], + ), + ), + ), + ), + ], + builder: (context, controller, child) => MouseRegion( + onEnter: (_) => setState(() => _hovered = true), + onExit: (_) => setState(() => _hovered = false), + child: SizedBox( + height: AppInspectorMetrics.row, + child: Row( + children: [ + ReorderableDragStartListener( + key: ValueKey('${widget.prefix}-drag-${widget.id}'), + index: widget.index, + enabled: widget.enabled, + child: MouseRegion( + cursor: widget.enabled + ? SystemMouseCursors.grab + : SystemMouseCursors.basic, + child: SizedBox( + width: 16, + child: Icon( + AppIcons.dragHandle, + size: 12, + color: _hovered + ? colors.onSurfaceVariant + : Colors.transparent, + ), + ), + ), + ), + Expanded( + child: TextButton( + key: ValueKey('${widget.prefix}-settings-${widget.id}'), + focusNode: _focus, + style: TextButton.styleFrom( + padding: const EdgeInsets.symmetric(horizontal: 4), + minimumSize: const Size(0, 24), + maximumSize: const Size(double.infinity, 24), + backgroundColor: controller.isOpen + ? theme.inputDecorationTheme.fillColor + : null, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(5), + ), + foregroundColor: widget.visible + ? colors.onSurface + : colors.onSurfaceVariant, + textStyle: AppTheme.inputTextStyle(context), + ), + onPressed: () => controller.isOpen + ? controller.close() + : controller.open(), + child: Row( + children: [ + widget.leading ?? + const Icon(PhosphorIconsRegular.sun, size: 16), + const SizedBox(width: 8), + Expanded( + child: Text( + widget.label, + maxLines: 1, + overflow: TextOverflow.ellipsis, + ), + ), + ], + ), + ), + ), + IconButton( + key: ValueKey('${widget.prefix}-enabled-${widget.id}'), + tooltip: widget.visible + ? context.l10n.disable + : context.l10n.enable, + icon: Icon( + widget.visible + ? Icons.visibility_outlined + : Icons.visibility_off_outlined, + size: 16, + ), + onPressed: widget.enabled ? widget.onVisibility : null, + ), + IconButton( + key: ValueKey('${widget.prefix}-remove-${widget.id}'), + tooltip: context.l10n.delete, + icon: const Icon(AppIcons.remove, size: 16), + onPressed: widget.enabled ? widget.onRemove : null, + ), + ], + ), + ), + ), + ); + } +} + +@Preview(name: 'Effect row / desktop', size: Size(560, 480)) +Widget effectRowPreview() => MaterialApp( + localizationsDelegates: AppLocalizations.localizationsDelegates, + supportedLocales: AppLocalizations.supportedLocales, + theme: AppTheme.propertiesPanelTheme( + AppTheme.desktopWorkspaceTheme(AppTheme.penDark), + ), + home: Scaffold( + body: Align( + alignment: Alignment.topRight, + child: SizedBox( + width: 240, + child: ReorderableListView( + shrinkWrap: true, + onReorderItem: (_, _) {}, + buildDefaultDragHandles: false, + children: [ + PropertyLayerRow( + key: const ValueKey('preview-effect'), + id: 'preview', + prefix: 'effect', + index: 0, + enabled: true, + visible: true, + label: 'Drop shadow', + tooltip: 'Effects', + onVisibility: () {}, + onRemove: () {}, + menuItems: const [], + editor: const Text('X 0 Y 4 Blur 8'), + ), + ], + ), + ), + ), + ), +); diff --git a/lib/features/properties/shadow_properties.dart b/lib/features/properties/shadow_properties.dart deleted file mode 100644 index eae4ae7..0000000 --- a/lib/features/properties/shadow_properties.dart +++ /dev/null @@ -1,1070 +0,0 @@ -import 'dart:math' as math; - -import 'package:cutdex/l10n/l10n.dart'; -import 'package:cutdex_sdk/editor.dart'; -import 'package:cutdex_sdk/preview.dart'; -import 'package:cutdex_sdk/timeline/model.dart'; -import 'package:cutdex_ui/icons.dart'; -import 'package:cutdex_ui/theme.dart'; -import 'package:cutdex_ui/widgets.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:flutter_riverpod/flutter_riverpod.dart'; - -import '../../workspace/timeline_session.dart'; -import '../../shared/state/operation_scope.dart'; -import '../preview/preview_panel.dart'; -import 'property_number_input.dart'; - -class ShadowProperties extends ConsumerStatefulWidget { - const ShadowProperties({ - super.key, - required this.projectId, - required this.timelineId, - required this.session, - required this.sequence, - required this.clip, - }); - final String projectId, timelineId; - final EditorTimelineSession session; - final SequenceId sequence; - final ElementId clip; - @override - ConsumerState createState() => _ShadowPropertiesState(); -} - -class _ShadowPropertiesState extends ConsumerState { - Object get _identity => ( - widget.session, - widget.sequence, - widget.clip, - widget.projectId, - widget.timelineId, - ); - late final _operations = OperationScope(_identity); - bool _saving = false; - String? _error; - @override - void didUpdateWidget(covariant ShadowProperties oldWidget) { - super.didUpdateWidget(oldWidget); - _operations.bind(_identity); - if (oldWidget.session != widget.session || - oldWidget.sequence != widget.sequence || - oldWidget.clip != widget.clip) { - _saving = false; - _error = null; - } - } - - @override - void dispose() { - _operations.dispose(); - super.dispose(); - } - - ({ClipShadowStack stack, int start})? _current() { - final view = widget.session.view(widget.sequence); - final query = view.version.kernelVersion.query(); - final handle = query.elementById(widget.clip); - if (handle == null) return null; - final start = query.absoluteStart(handle); - return ( - stack: ClipShadowStack(query.element(handle), view.playheadTick - start), - start: start, - ); - } - - Future _edit( - PreviewController? preview, - void Function(EditorCommandService commands, int tick) action, { - bool seek = false, - }) async { - if (_saving || - preview?.transforms.hasPending == true || - widget.session.activeSequenceId != widget.sequence) { - return false; - } - final guard = _operations.begin(); - final session = widget.session; - final sequence = widget.sequence; - final view = session.view(sequence); - final version = view.version.kernelVersion; - final tick = view.playheadTick; - setState(() { - _saving = true; - _error = null; - }); - try { - await preview?.pauseForCanvasInteraction(); - if (!mounted || - !guard() || - view.playheadTick != tick || - !identical(view.version.kernelVersion, version) || - session.activeSequenceId != sequence) { - return false; - } - if (seek) { - action(session.commands, tick); - } else { - session.runEdit( - 'editShadow', - sequence, - () => action(session.commands, tick), - context: { - 'clipIds': [widget.clip.value], - 'entryPoint': 'property', - 'playheadTick': tick, - }, - ); - } - return true; - } catch (_) { - if (mounted && guard()) { - setState(() => _error = context.l10n.updateShadowFailed); - } - return false; - } finally { - if (mounted && guard()) setState(() => _saving = false); - } - } - - @override - Widget build(BuildContext context) { - final preview = ref - .watch(editorPreviewProvider(widget.projectId, widget.timelineId)) - .asData - ?.value; - return ListenableBuilder( - listenable: widget.session.view(widget.sequence), - builder: (context, _) { - final current = _current(); - if (current == null) return const SizedBox.shrink(); - final stack = current.stack; - final layers = stack.layers; - final enabled = - !_saving && - stack.containsPlayhead && - preview?.transforms.hasPending != true; - Future edit(void Function(EditorCommandService, int) action) => - _edit(preview, action); - Future keys({ - KeyframeAction? action, - ParameterInterpolation? interpolation, - }) => edit( - (c, t) => c.editKeyframeChannel( - sequence: widget.sequence, - clip: widget.clip, - tick: t, - parameterIds: stack.parameterIds, - action: action, - interpolation: interpolation, - ), - ); - Widget key = IconButton( - key: const ValueKey('shadow-key'), - tooltip: context.l10n.toggleKeyframe( - stack.keyed ? context.l10n.delete : context.l10n.addKeyframeAction, - context.l10n.shadow, - ), - isSelected: stack.keyed, - color: stack.animated ? Theme.of(context).colorScheme.primary : null, - icon: Transform.rotate( - angle: math.pi / 4, - child: Icon( - stack.keyed ? AppIcons.squareFilled : AppIcons.square, - size: 12, - ), - ), - onPressed: enabled && layers.isNotEmpty ? keys : null, - ); - Widget number( - ClipShadowLayer layer, - String field, - String? label, - double value, - ClipShadow Function(ClipShadow, double) change, { - double factor = 1, - String? unit, - bool inlineLabel = true, - }) { - final (minimum, maximum) = ClipShadow.range(field); - return PropertyNumberInput( - key: ValueKey('shadow-${layer.id}-$field'), - label: label, - inlineLabel: inlineLabel, - unit: unit, - value: value * factor, - enabled: enabled && layer.enabled, - readOnly: false, - scrubbing: false, - editContext: (_identity, layer.id), - onScrubUpdate: (_) {}, - onScrubEnd: () {}, - onScrubCancel: () {}, - submit: (v) => - !v.isFinite || v / factor < minimum || v / factor > maximum - ? Future.value(false) - : edit((c, t) { - final live = _current()!.stack.layers.firstWhere( - (l) => l.id == layer.id, - ); - c.setShadow( - sequence: widget.sequence, - clip: widget.clip, - tick: t, - shadowId: layer.id, - value: change(live.shadow, v / factor), - ); - }), - ); - } - - final times = stack.keyOffsets.map((t) => t + current.start).toList(); - final tick = widget.session.view(widget.sequence).playheadTick; - final previous = times.where((t) => t < tick).lastOrNull; - final next = times.where((t) => t > tick).firstOrNull; - Widget seekButton(int? target, bool forward) => IconButton( - key: ValueKey('shadow-key-${forward ? 'next' : 'previous'}'), - tooltip: forward - ? context.l10n.nextKeyframe(context.l10n.shadow) - : context.l10n.previousKeyframe(context.l10n.shadow), - icon: Icon( - forward ? AppIcons.chevronRight : AppIcons.chevronLeft, - size: 16, - ), - onPressed: enabled && target != null - ? () => _edit( - preview, - (_, _) => widget.session.view(widget.sequence).seekTo(target), - seek: true, - ) - : null, - ); - return AppPropertySection( - bottomSpacing: layers.isEmpty ? 0 : null, - child: AppPropertyGroup( - label: context.l10n.shadow, - labelWidget: layers.isEmpty - ? Text( - context.l10n.shadow, - style: AppTheme.propertyLabelStyle(context), - ) - : null, - padChild: false, - actions: [ - key, - IconButton( - key: const ValueKey('shadow-add'), - tooltip: context.l10n.addShadow, - icon: const Icon(AppIcons.add, size: 16), - onPressed: enabled && layers.length < ClipShadowStack.maxLayers - ? () => edit( - (c, t) => c.addShadow( - sequence: widget.sequence, - clip: widget.clip, - tick: t, - shadowId: c.newShadowId(), - ), - ) - : null, - ), - ], - child: Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - if (stack.animated) - Row( - children: [ - Text( - context.l10n.keyframeCount(times.length), - style: Theme.of(context).textTheme.bodySmall, - ), - const Spacer(), - seekButton(previous, false), - seekButton(next, true), - AppDropdownMenu( - enabled: enabled, - builder: (context, toggle, focus) => IconButton( - focusNode: focus, - tooltip: context.l10n.keyframeSettings( - context.l10n.shadow, - ), - onPressed: toggle, - icon: const Icon(AppIcons.more, size: 16), - ), - items: [ - for (final (mode, label) in [ - ( - ParameterInterpolation.linear, - context.l10n.linear, - ), - (ParameterInterpolation.hold, context.l10n.hold), - ( - ParameterInterpolation.easeIn, - context.l10n.easeIn, - ), - ( - ParameterInterpolation.easeOut, - context.l10n.easeOut, - ), - ( - ParameterInterpolation.easeInOut, - context.l10n.easeInOut, - ), - ]) - AppMenuItem( - label: label, - onPressed: stack.keyed - ? () => keys( - action: KeyframeAction.set, - interpolation: mode, - ) - : null, - ), - AppMenuItem( - label: context.l10n.removeAllKeyframes, - onPressed: () => keys(action: KeyframeAction.clear), - ), - ], - ), - ], - ), - ReorderableListView( - shrinkWrap: true, - primary: false, - padding: EdgeInsets.zero, - physics: const NeverScrollableScrollPhysics(), - buildDefaultDragHandles: false, - onReorderItem: (oldIndex, newIndex) { - if (!enabled) return; - final ids = layers.map((l) => l.id).toList(); - ids.insert(newIndex, ids.removeAt(oldIndex)); - edit( - (c, t) => c.configureShadows( - sequence: widget.sequence, - clip: widget.clip, - tick: t, - order: ids, - ), - ); - }, - proxyDecorator: (child, index, animation) => Material( - color: Theme.of(context).colorScheme.surfaceContainerLow, - child: child, - ), - children: [ - for (var i = 0; i < layers.length; i++) - Builder( - key: ValueKey((_identity, layers[i].id)), - builder: (context) { - final layer = layers[i]; - final s = layer.shadow; - final color = Color.from( - alpha: 1, - red: s.red, - green: s.green, - blue: s.blue, - ); - final hex = [s.red, s.green, s.blue] - .map( - (v) => (v * 255) - .round() - .toRadixString(16) - .padLeft(2, '0'), - ) - .join() - .toUpperCase(); - void reorder(int direction) { - final ids = layers.map((l) => l.id).toList(); - final other = i + direction; - final temp = ids[i]; - ids[i] = ids[other]; - ids[other] = temp; - edit( - (c, t) => c.configureShadows( - sequence: widget.sequence, - clip: widget.clip, - tick: t, - order: ids, - ), - ); - } - - return _ShadowLayerRow( - key: ValueKey('shadow-layer-${layer.id}'), - id: layer.id, - index: i, - enabled: enabled, - visible: layer.enabled, - label: context.l10n.shadow, - tooltip: context.l10n.shadowLayer(i + 1), - onVisibility: () => edit( - (c, t) => c.configureShadows( - sequence: widget.sequence, - clip: widget.clip, - tick: t, - shadowId: layer.id, - enabled: !layer.enabled, - ), - ), - onRemove: () => edit( - (c, t) => c.removeShadow( - sequence: widget.sequence, - clip: widget.clip, - tick: t, - shadowId: layer.id, - ), - ), - menuItems: [ - AppMenuItem( - label: context.l10n.moveShadowUp, - onPressed: enabled && i > 0 - ? () => reorder(-1) - : null, - ), - AppMenuItem( - label: context.l10n.moveShadowDown, - onPressed: enabled && i < layers.length - 1 - ? () => reorder(1) - : null, - ), - ], - editor: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - Text( - context.l10n.position, - style: AppTheme.propertyLabelStyle(context), - ), - AppPropertyRow( - reserveTrailing: false, - children: [ - number( - layer, - 'x', - 'X', - s.x, - (s, v) => s.copyWith(x: v), - ), - number( - layer, - 'y', - 'Y', - s.y, - (s, v) => s.copyWith(y: v), - ), - ], - ), - const SizedBox(height: 4), - AppPropertyRow( - reserveTrailing: false, - children: [ - number( - layer, - 'blur', - context.l10n.shadowBlur, - s.blur, - (s, v) => s.copyWith(blur: v), - inlineLabel: false, - ), - number( - layer, - 'spread', - context.l10n.shadowSpread, - s.spread, - (s, v) => s.copyWith(spread: v), - inlineLabel: false, - ), - ], - ), - const SizedBox( - height: AppInspectorMetrics.rowGap, - ), - Text( - context.l10n.color, - style: AppTheme.propertyLabelStyle(context), - ), - AppPropertyRow( - reserveTrailing: false, - flexes: const [2, 1], - children: [ - _ShadowColorInput( - key: ValueKey('shadow-${layer.id}-color'), - value: hex, - color: color, - enabled: enabled && layer.enabled, - editContext: (_identity, layer.id), - submit: (v) => edit((c, t) { - final live = _current()!.stack.layers - .firstWhere((l) => l.id == layer.id) - .shadow; - c.setShadow( - sequence: widget.sequence, - clip: widget.clip, - tick: t, - shadowId: layer.id, - value: live.copyWith( - red: ((v >> 16) & 255) / 255, - green: ((v >> 8) & 255) / 255, - blue: (v & 255) / 255, - ), - ); - }), - ), - number( - layer, - 'opacity', - null, - s.opacity, - (s, v) => s.copyWith(opacity: v), - factor: 100, - unit: '%', - ), - ], - ), - ], - ), - ); - }, - ), - ], - ), - if (_error != null) - Text( - _error!, - style: TextStyle( - color: Theme.of(context).colorScheme.error, - ), - ), - ], - ), - ), - ); - }, - ); - } -} - -class _ShadowLayerRow extends StatefulWidget { - const _ShadowLayerRow({ - super.key, - required this.id, - required this.index, - required this.enabled, - required this.visible, - required this.label, - required this.tooltip, - required this.onVisibility, - required this.onRemove, - required this.menuItems, - required this.editor, - }); - final String id, label, tooltip; - final int index; - final bool enabled, visible; - final VoidCallback onVisibility, onRemove; - final List menuItems; - final Widget editor; - - @override - State<_ShadowLayerRow> createState() => _ShadowLayerRowState(); -} - -class _ShadowLayerRowState extends State<_ShadowLayerRow> { - final _menu = MenuController(); - final _focus = FocusNode(); - bool _hovered = false; - - @override - void dispose() { - _focus.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - final theme = Theme.of(context); - final colors = theme.colorScheme; - return MenuAnchor( - controller: _menu, - childFocusNode: _focus, - clipBehavior: Clip.none, - // Place the editor beside the inspector, as in Figma's effects panel. - alignmentOffset: Offset( - -240 - 8 - AppTheme.propertySectionPadding(context).left, - 0, - ), - style: const MenuStyle( - alignment: AlignmentDirectional.topStart, - padding: WidgetStatePropertyAll(EdgeInsets.zero), - backgroundColor: WidgetStatePropertyAll(Colors.transparent), - surfaceTintColor: WidgetStatePropertyAll(Colors.transparent), - elevation: WidgetStatePropertyAll(0), - side: WidgetStatePropertyAll(BorderSide.none), - shape: WidgetStatePropertyAll( - RoundedRectangleBorder( - borderRadius: BorderRadius.all(Radius.circular(8)), - ), - ), - ), - onOpen: () => setState(() {}), - onClose: () => setState(() {}), - menuChildren: [ - SizedBox( - key: ValueKey('shadow-editor-${widget.id}'), - width: 240, - child: Material( - color: colors.surfaceContainerLow, - surfaceTintColor: Colors.transparent, - elevation: 8, - shadowColor: colors.shadow.withValues(alpha: .25), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(8), - side: BorderSide(color: colors.outlineVariant), - ), - clipBehavior: Clip.antiAlias, - child: Focus( - autofocus: true, - onKeyEvent: (_, event) { - if (event is KeyDownEvent && - event.logicalKey == LogicalKeyboardKey.escape) { - _menu.close(); - return KeyEventResult.handled; - } - return KeyEventResult.ignored; - }, - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - SizedBox( - height: 40, - child: Padding( - padding: const EdgeInsets.only(left: 16, right: 8), - child: Row( - children: [ - Expanded( - child: Text( - widget.label, - style: AppTheme.propertySectionTitleStyle( - context, - ), - ), - ), - AppDropdownMenu( - builder: (context, toggle, focus) => IconButton( - focusNode: focus, - tooltip: widget.tooltip, - icon: const Icon(AppIcons.more, size: 16), - onPressed: toggle, - ), - items: widget.menuItems, - ), - IconButton( - key: ValueKey('shadow-editor-close-${widget.id}'), - tooltip: context.l10n.close, - icon: const Icon(AppIcons.close, size: 16), - onPressed: _menu.close, - ), - ], - ), - ), - ), - Divider(height: 1, color: theme.dividerColor), - Padding( - padding: const EdgeInsets.fromLTRB(16, 12, 16, 12), - child: widget.editor, - ), - ], - ), - ), - ), - ), - ], - builder: (context, controller, child) => MouseRegion( - onEnter: (_) => setState(() => _hovered = true), - onExit: (_) => setState(() => _hovered = false), - child: SizedBox( - height: AppInspectorMetrics.row, - child: Row( - children: [ - ReorderableDragStartListener( - key: ValueKey('shadow-drag-${widget.id}'), - index: widget.index, - enabled: widget.enabled, - child: MouseRegion( - cursor: widget.enabled - ? SystemMouseCursors.grab - : SystemMouseCursors.basic, - child: SizedBox( - width: 16, - child: Icon( - AppIcons.dragHandle, - size: 12, - color: _hovered - ? colors.onSurfaceVariant - : Colors.transparent, - ), - ), - ), - ), - Expanded( - child: TextButton( - key: ValueKey('shadow-settings-${widget.id}'), - focusNode: _focus, - style: TextButton.styleFrom( - padding: const EdgeInsets.symmetric(horizontal: 4), - minimumSize: const Size(0, 24), - maximumSize: const Size(double.infinity, 24), - backgroundColor: controller.isOpen - ? theme.inputDecorationTheme.fillColor - : null, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(5), - ), - foregroundColor: widget.visible - ? colors.onSurface - : colors.onSurfaceVariant, - textStyle: AppTheme.inputTextStyle(context), - ), - onPressed: () => controller.isOpen - ? controller.close() - : controller.open(), - child: Row( - children: [ - const Icon(PhosphorIconsRegular.sun, size: 16), - const SizedBox(width: 8), - Expanded( - child: Text( - widget.label, - maxLines: 1, - overflow: TextOverflow.ellipsis, - ), - ), - ], - ), - ), - ), - IconButton( - key: ValueKey('shadow-enabled-${widget.id}'), - tooltip: widget.visible - ? context.l10n.disable - : context.l10n.enable, - icon: Icon( - widget.visible - ? Icons.visibility_outlined - : Icons.visibility_off_outlined, - size: 16, - ), - onPressed: widget.enabled ? widget.onVisibility : null, - ), - IconButton( - key: ValueKey('shadow-remove-${widget.id}'), - tooltip: context.l10n.delete, - icon: const Icon(AppIcons.remove, size: 16), - onPressed: widget.enabled ? widget.onRemove : null, - ), - ], - ), - ), - ), - ); - } -} - -class _ShadowColorInput extends StatefulWidget { - const _ShadowColorInput({ - super.key, - required this.value, - required this.color, - required this.enabled, - required this.editContext, - required this.submit, - }); - final String value; - final Color color; - final bool enabled; - final Object editContext; - final Future Function(int) submit; - @override - State<_ShadowColorInput> createState() => _ShadowColorInputState(); -} - -class _ShadowColorInputState extends State<_ShadowColorInput> { - late final _text = TextEditingController(text: widget.value); - final _focus = FocusNode(); - bool _dirty = false; - String? _error; - late final _operations = OperationScope(widget.editContext); - @override - void initState() { - super.initState(); - _focus.addListener(_blur); - } - - void _blur() { - if (!_focus.hasFocus) _submit(); - } - - Future _submit() async { - if (!_dirty || !widget.enabled) return; - final value = _text.text.replaceFirst('#', ''); - if (!RegExp(r'^[A-Fa-f0-9]{6}$').hasMatch(value)) { - setState(() => _error = context.l10n.invalidNumber); - return; - } - _dirty = false; - final guard = _operations.begin(); - final ok = await widget.submit(int.parse(value, radix: 16)); - if (!mounted || !guard()) return; - setState(() { - _error = ok ? null : context.l10n.notApplied; - _text.text = widget.value; - }); - } - - @override - void didUpdateWidget(covariant _ShadowColorInput oldWidget) { - super.didUpdateWidget(oldWidget); - _operations.bind(widget.editContext); - if (oldWidget.editContext != widget.editContext || !widget.enabled) { - _dirty = false; - _error = null; - } - if (!_dirty && _text.text != widget.value) _text.text = widget.value; - } - - @override - void dispose() { - _operations.dispose(); - _focus.removeListener(_blur); - _focus.dispose(); - _text.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) => AppTextField( - controller: _text, - focusNode: _focus, - enabled: widget.enabled, - errorText: _error, - leading: AppPopover( - width: 240, - borderRadius: 8, - padding: const EdgeInsets.all(16), - backgroundColor: Theme.of(context).colorScheme.surfaceContainerLow, - builder: (context, toggle) => IconButton( - key: const ValueKey('shadow-color-swatch'), - tooltip: context.l10n.color, - onPressed: widget.enabled ? toggle : null, - padding: EdgeInsets.zero, - icon: Container( - width: 14, - height: 14, - decoration: BoxDecoration( - color: widget.color, - borderRadius: BorderRadius.circular(2), - border: Border.all( - color: Theme.of(context).colorScheme.outlineVariant, - ), - ), - ), - ), - child: _ShadowColorPicker( - color: widget.color, - enabled: widget.enabled, - submit: (color) => widget.submit(color.toARGB32() & 0xFFFFFF), - ), - ), - onChanged: (_) { - _operations.invalidate(); - _dirty = true; - if (_error != null) setState(() => _error = null); - }, - onEditingComplete: () {}, - onSubmitted: (_) => _submit(), - ); -} - -class _ShadowColorPicker extends StatefulWidget { - const _ShadowColorPicker({ - required this.color, - required this.enabled, - required this.submit, - }); - final Color color; - final bool enabled; - final Future Function(Color) submit; - - @override - State<_ShadowColorPicker> createState() => _ShadowColorPickerState(); -} - -class _ShadowColorPickerState extends State<_ShadowColorPicker> { - late HSVColor _color = HSVColor.fromColor(widget.color); - - @override - void didUpdateWidget(covariant _ShadowColorPicker oldWidget) { - super.didUpdateWidget(oldWidget); - if (widget.color != oldWidget.color) { - _color = HSVColor.fromColor(widget.color); - } - } - - Future _commit() async { - if (!widget.enabled) return; - await widget.submit(_color.toColor()); - if (mounted) setState(() => _color = HSVColor.fromColor(widget.color)); - } - - @override - Widget build(BuildContext context) => Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - Text( - context.l10n.color, - style: AppTheme.propertySectionTitleStyle(context), - ), - const SizedBox(height: 12), - SizedBox( - height: 140, - child: LayoutBuilder( - builder: (context, constraints) { - final width = constraints.maxWidth; - const height = 140.0; - void update(Offset position) { - if (!widget.enabled) return; - setState( - () => _color = _color - .withSaturation((position.dx / width).clamp(0, 1)) - .withValue((1 - position.dy / height).clamp(0, 1)), - ); - } - - return Semantics( - label: context.l10n.color, - child: GestureDetector( - key: const ValueKey('shadow-color-plane'), - onTapDown: (details) => update(details.localPosition), - onTapUp: (_) => _commit(), - onPanStart: (details) => update(details.localPosition), - onPanUpdate: (details) => update(details.localPosition), - onPanEnd: (_) => _commit(), - child: ClipRRect( - borderRadius: BorderRadius.circular(5), - child: SizedBox( - height: height, - child: Stack( - children: [ - Positioned.fill( - child: ColoredBox( - color: HSVColor.fromAHSV( - 1, - _color.hue, - 1, - 1, - ).toColor(), - ), - ), - const Positioned.fill( - child: DecoratedBox( - decoration: BoxDecoration( - gradient: LinearGradient( - colors: [Colors.white, Color(0x00FFFFFF)], - ), - ), - ), - ), - const Positioned.fill( - child: DecoratedBox( - decoration: BoxDecoration( - gradient: LinearGradient( - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - colors: [Colors.transparent, Colors.black], - ), - ), - ), - ), - Positioned( - left: (_color.saturation * width - 6).clamp( - 0, - width - 12, - ), - top: ((1 - _color.value) * height - 6).clamp( - 0, - height - 12, - ), - child: Container( - width: 12, - height: 12, - decoration: BoxDecoration( - shape: BoxShape.circle, - border: Border.all(color: Colors.white, width: 2), - boxShadow: const [ - BoxShadow(color: Colors.black54, blurRadius: 2), - ], - ), - ), - ), - ], - ), - ), - ), - ), - ); - }, - ), - ), - const SizedBox(height: 8), - SizedBox( - height: 24, - child: Stack( - alignment: Alignment.center, - children: [ - Container( - height: 12, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(6), - gradient: const LinearGradient( - colors: [ - Color(0xFFFF0000), - Color(0xFFFFFF00), - Color(0xFF00FF00), - Color(0xFF00FFFF), - Color(0xFF0000FF), - Color(0xFFFF00FF), - Color(0xFFFF0000), - ], - ), - ), - ), - SliderTheme( - data: SliderTheme.of(context).copyWith( - padding: EdgeInsets.zero, - trackHeight: 12, - activeTrackColor: Colors.transparent, - inactiveTrackColor: Colors.transparent, - thumbColor: Colors.white, - thumbShape: const RoundSliderThumbShape(enabledThumbRadius: 6), - overlayShape: SliderComponentShape.noOverlay, - ), - child: Slider( - key: const ValueKey('shadow-color-hue'), - min: 0, - max: 360, - value: _color.hue, - onChanged: widget.enabled - ? (hue) => setState(() => _color = _color.withHue(hue)) - : null, - onChangeEnd: (_) => _commit(), - ), - ), - ], - ), - ), - ], - ); -} diff --git a/lib/features/properties/stroke_list.dart b/lib/features/properties/stroke_list.dart new file mode 100644 index 0000000..4cf248a --- /dev/null +++ b/lib/features/properties/stroke_list.dart @@ -0,0 +1,136 @@ +import 'package:cutdex/l10n/l10n.dart'; +import 'package:cutdex_sdk/editor.dart'; +import 'package:cutdex_ui/icons.dart'; +import 'package:cutdex_ui/widgets.dart'; +import 'package:flutter/material.dart'; + +import 'property_keyframe_controls.dart'; +import 'property_layer_row.dart'; + +class StrokeList extends StatelessWidget { + const StrokeList({ + super.key, + required this.stack, + required this.enabled, + required this.keyframes, + required this.onAdd, + required this.onReorder, + required this.onToggle, + required this.onRemove, + required this.editorBuilder, + this.error, + }); + final ClipStrokeStack stack; + final bool enabled; + final PropertyKeyframeControls keyframes; + final VoidCallback onAdd; + final void Function(List) onReorder; + final void Function(ClipStrokeLayer) onToggle, onRemove; + final Widget Function(ClipStrokeLayer) editorBuilder; + final String? error; + + @override + Widget build(BuildContext context) { + final layers = stack.layers; + return AppPropertySection( + bottomSpacing: layers.isEmpty ? 0 : null, + child: AppPropertyGroup( + label: context.l10n.strokes, + padChild: false, + actions: [ + keyframes.button( + context, + stack.parameterIds, + context.l10n.strokes, + 'strokes-key', + ), + IconButton( + key: const ValueKey('stroke-add'), + tooltip: context.l10n.addStroke, + onPressed: enabled && stack.canAdd ? onAdd : null, + icon: const Icon(AppIcons.add, size: 16), + ), + ], + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + ReorderableListView( + shrinkWrap: true, + primary: false, + padding: EdgeInsets.zero, + physics: const NeverScrollableScrollPhysics(), + buildDefaultDragHandles: false, + onReorderItem: (from, to) { + if (!enabled) return; + final order = layers.map((l) => l.id).toList(); + order.insert(to, order.removeAt(from)); + onReorder(order); + }, + children: [ + for (var i = 0; i < layers.length; i++) + PropertyLayerRow( + key: ValueKey('stroke-layer-${layers[i].id}'), + id: layers[i].id, + prefix: 'stroke', + index: i, + enabled: enabled, + visible: layers[i].enabled, + label: + '${layers[i].values['width']!.toStringAsFixed(layers[i].values['width']! % 1 == 0 ? 0 : 1)} · ${(layers[i].values['opacity']! * 100).round()}%', + editorLabel: context.l10n.stroke, + leading: Container( + width: 16, + height: 16, + decoration: BoxDecoration( + color: Color.from( + alpha: layers[i].values['opacity']!, + red: layers[i].values['color.r']!, + green: layers[i].values['color.g']!, + blue: layers[i].values['color.b']!, + ), + borderRadius: BorderRadius.circular(3), + border: Border.all( + color: Theme.of(context).colorScheme.outlineVariant, + ), + ), + ), + tooltip: context.l10n.strokes, + onVisibility: () => onToggle(layers[i]), + onRemove: () => onRemove(layers[i]), + menuItems: [ + for (final (delta, label) in [ + (-1, context.l10n.effectMoveUp), + (1, context.l10n.effectMoveDown), + ]) + AppMenuItem( + label: label, + closeAncestors: false, + onPressed: + !enabled || + i + delta < 0 || + i + delta >= layers.length + ? null + : () { + final order = layers + .map((l) => l.id) + .toList(); + order.insert(i + delta, order.removeAt(i)); + onReorder(order); + }, + ), + ], + editor: editorBuilder(layers[i]), + ), + ], + ), + if (error != null) + Text( + error!, + style: TextStyle(color: Theme.of(context).colorScheme.error), + ), + ], + ), + ), + ); + } +} diff --git a/lib/features/properties/stroke_parameter_editor.dart b/lib/features/properties/stroke_parameter_editor.dart new file mode 100644 index 0000000..3a080ca --- /dev/null +++ b/lib/features/properties/stroke_parameter_editor.dart @@ -0,0 +1,226 @@ +import 'package:cutdex/l10n/l10n.dart'; +import 'package:cutdex_sdk/editor.dart'; +import 'package:cutdex_ui/theme.dart'; +import 'package:cutdex_ui/widgets.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/widget_previews.dart'; +import 'package:cutdex_sdk/timeline/model.dart'; +import 'package:cutdex_sdk/timeline/engine.dart'; + +import 'property_keyframe_controls.dart'; +import 'property_color_input.dart'; +import 'property_number_input.dart'; + +class StrokeParameterEditor extends StatelessWidget { + const StrokeParameterEditor({ + super.key, + required this.layer, + required this.stack, + required this.enabled, + required this.editContext, + required this.keyframes, + required this.onChange, + }); + final ClipStrokeLayer layer; + final ClipStrokeStack stack; + final bool enabled; + final Object editContext; + final PropertyKeyframeControls keyframes; + final Future Function(Map) onChange; + + String _fieldLabel(BuildContext context, String field) => switch (field) { + 'width' => context.l10n.strokeWidth, + 'opacity' => context.l10n.shadowOpacity, + 'dashLength' => context.l10n.strokeDashLength, + 'dashGap' => context.l10n.strokeDashGap, + _ => field, + }; + Widget _number(BuildContext context, String field) { + final label = _fieldLabel(context, field); + final structural = StrokeParameterTarget.structural.contains(field); + final percentage = { + 'opacity', + 'density', + 'lightIntensity', + 'splay', + }.contains(field); + final factor = percentage ? 100.0 : 1.0; + final definition = StrokeParameterTarget.definition(field); + return Padding( + padding: const EdgeInsets.only(bottom: 4), + child: Row( + children: [ + Expanded( + child: PropertyNumberInput( + key: ValueKey('stroke-${layer.id}-$field'), + label: label, + value: layer.values[field]! * factor, + unit: percentage ? '%' : null, + enabled: enabled && layer.enabled, + readOnly: false, + scrubbing: false, + editContext: (editContext, layer.id), + onScrubUpdate: (_) {}, + onScrubEnd: () {}, + onScrubCancel: () {}, + submit: (v) => !definition.accepts(v / factor) + ? Future.value(false) + : onChange({field: v / factor}), + ), + ), + if (!structural) ...[ + keyframes.button( + context, + [layer.target(field)], + label, + 'stroke-${layer.id}-$field-key', + ), + keyframes.menu( + context, + [layer.target(field)], + label, + 'stroke-${layer.id}-$field', + ), + ] else + const SizedBox(width: 48), + ], + ), + ); + } + + Widget _color(BuildContext context, String prefix, String label) { + final fields = ['${prefix}r', '${prefix}g', '${prefix}b']; + final values = fields.map((f) => layer.values[f]!).toList(); + final hex = values + .map((v) => (v * 255).round().toRadixString(16).padLeft(2, '0')) + .join() + .toUpperCase(); + final ids = fields.map(layer.target).toList(); + return Padding( + padding: const EdgeInsets.only(bottom: 4), + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Text(label, style: AppTheme.propertyLabelStyle(context)), + Row( + children: [ + Expanded( + child: PropertyColorInput( + key: ValueKey('stroke-${layer.id}-$prefix'), + value: hex, + color: Color.from( + alpha: 1, + red: values[0], + green: values[1], + blue: values[2], + ), + enabled: enabled && layer.enabled, + editContext: (editContext, layer.id), + submit: (rgb) => onChange({ + fields[0]: ((rgb >> 16) & 255) / 255, + fields[1]: ((rgb >> 8) & 255) / 255, + fields[2]: (rgb & 255) / 255, + }), + ), + ), + keyframes.button( + context, + ids, + label, + 'stroke-${layer.id}-$prefix-key', + ), + keyframes.menu(context, ids, label, 'stroke-${layer.id}-$prefix'), + ], + ), + ], + ), + ); + } + + Widget _mode(BuildContext context, String field, List labels) => + Padding( + padding: const EdgeInsets.only(bottom: 8), + child: SizedBox( + height: 24, + child: AppSelect( + closeAncestors: false, + key: ValueKey('stroke-${layer.id}-$field'), + value: layer.values[field]!.round(), + label: field == 'alignment' + ? context.l10n.alignment + : context.l10n.strokeStyle, + emptyLabel: context.l10n.strokes, + options: [ + for (var i = 0; i < labels.length; i++) + AppSelectOption(i, labels[i]), + ], + onChanged: enabled && layer.enabled + ? (v) => onChange({field: v.toDouble()}) + : null, + ), + ), + ); + @override + Widget build(BuildContext context) => Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + _color(context, 'color.', context.l10n.color), + _number(context, 'opacity'), + _number(context, 'width'), + _mode(context, 'alignment', [ + context.l10n.strokeInside, + context.l10n.strokeCenter, + context.l10n.strokeOutside, + ]), + _mode(context, 'style', [ + context.l10n.strokeSolid, + context.l10n.strokeDashed, + ]), + if (layer.style == ClipStrokeStyle.dashed) ...[ + _number(context, 'dashLength'), + _number(context, 'dashGap'), + ], + ], + ); +} + +@Preview(name: 'Stroke editor / desktop', size: Size(240, 360)) +Widget strokeEditorPreview() { + final stack = ClipStrokeStack( + ElementRecord( + id: ElementId('preview'), + structure: ElementStructure.content, + duration: 1, + sourceStart: 0, + sourceDuration: 1, + enabled: true, + ), + 0, + ); + return MaterialApp( + localizationsDelegates: AppLocalizations.localizationsDelegates, + supportedLocales: AppLocalizations.supportedLocales, + theme: AppTheme.propertiesPanelTheme( + AppTheme.desktopWorkspaceTheme(AppTheme.penDark), + ), + home: Scaffold( + body: Padding( + padding: const EdgeInsets.all(16), + child: StrokeParameterEditor( + layer: const ClipStrokeLayer(id: 'preview', values: strokeDefaults), + stack: stack, + enabled: true, + editContext: 'preview', + keyframes: PropertyKeyframeControls( + stack: stack, + enabled: true, + onEdit: (ids, {action, interpolation}) async => true, + onSeek: (_) async => true, + ), + onChange: (_) async => true, + ), + ), + ), + ); +} diff --git a/lib/features/properties/stroke_properties.dart b/lib/features/properties/stroke_properties.dart new file mode 100644 index 0000000..23fccbf --- /dev/null +++ b/lib/features/properties/stroke_properties.dart @@ -0,0 +1,162 @@ +import 'package:cutdex/l10n/l10n.dart'; +import 'package:cutdex_sdk/editor.dart'; +import 'package:cutdex_sdk/timeline/model.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; + +import '../../workspace/timeline_session.dart'; +import '../preview/preview_panel.dart'; +import 'property_edit_controller.dart'; +import 'property_keyframe_controls.dart'; +import 'stroke_list.dart'; +import 'stroke_parameter_editor.dart'; + +class StrokeProperties extends ConsumerStatefulWidget { + const StrokeProperties({ + super.key, + required this.projectId, + required this.timelineId, + required this.session, + required this.sequence, + required this.clip, + }); + final String projectId, timelineId; + final EditorTimelineSession session; + final SequenceId sequence; + final ElementId clip; + + @override + ConsumerState createState() => _StrokePropertiesState(); +} + +class _StrokePropertiesState extends ConsumerState { + Object get _identity => ( + widget.session, + widget.sequence, + widget.clip, + widget.projectId, + widget.timelineId, + ); + PropertyEditController _createController() => PropertyEditController( + session: widget.session, + sequence: widget.sequence, + clip: widget.clip, + projectId: widget.projectId, + timelineId: widget.timelineId, + operation: 'editStroke', + ); + late PropertyEditController _controller = _createController(); + + @override + void didUpdateWidget(covariant StrokeProperties oldWidget) { + super.didUpdateWidget(oldWidget); + if (_controller.identity != _identity) { + _controller.dispose(); + _controller = _createController(); + } + } + + @override + void dispose() { + _controller.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + final preview = ref + .watch(editorPreviewProvider(widget.projectId, widget.timelineId)) + .asData + ?.value; + final controller = _controller; + final view = widget.session.view(widget.sequence); + return ListenableBuilder( + listenable: Listenable.merge([controller, view]), + builder: (context, _) { + final animation = controller.animation; + if (animation == null) return const SizedBox.shrink(); + final stack = ClipStrokeStack(animation.record, animation.localTick); + final enabled = + !controller.saving && + stack.containsPlayhead && + preview?.transforms.hasPending != true; + Future edit(void Function(EditorCommandService, int) action) => + controller.run(preview, action); + final keyframes = PropertyKeyframeControls( + stack: stack, + enabled: enabled, + onEdit: (ids, {action, interpolation}) => edit( + (c, t) => c.editKeyframeChannel( + sequence: widget.sequence, + clip: widget.clip, + tick: t, + parameterIds: ids, + action: action, + interpolation: interpolation, + ), + ), + onSeek: (offset) => controller.run( + preview, + (_, tick) => view.seekTo(tick - stack.localTick + offset), + seek: true, + ), + ); + return StrokeList( + stack: stack, + enabled: enabled, + keyframes: keyframes, + error: controller.failed ? context.l10n.updateStrokeFailed : null, + onAdd: () => edit( + (c, t) => c.addStroke( + sequence: widget.sequence, + clip: widget.clip, + tick: t, + strokeId: c.newStrokeId(), + ), + ), + onReorder: (order) => edit( + (c, t) => c.configureStrokes( + sequence: widget.sequence, + clip: widget.clip, + tick: t, + order: order, + ), + ), + onToggle: (layer) => edit( + (c, t) => c.configureStrokes( + sequence: widget.sequence, + clip: widget.clip, + tick: t, + strokeId: layer.id, + enabled: !layer.enabled, + ), + ), + onRemove: (layer) => edit( + (c, t) => c.removeStroke( + sequence: widget.sequence, + clip: widget.clip, + tick: t, + strokeId: layer.id, + ), + ), + editorBuilder: (layer) => StrokeParameterEditor( + layer: layer, + stack: stack, + enabled: enabled, + editContext: controller.identity, + keyframes: keyframes, + onChange: (values) => edit( + (c, t) => c.setStroke( + sequence: widget.sequence, + clip: widget.clip, + tick: t, + strokeId: layer.id, + values: values, + ), + ), + ), + ); + }, + ); + } +} diff --git a/lib/l10n/app_de.arb b/lib/l10n/app_de.arb index 9f872b8..5a69f8d 100644 --- a/lib/l10n/app_de.arb +++ b/lib/l10n/app_de.arb @@ -12,9 +12,8 @@ "showFewerConversations": "Weniger anzeigen", "agentNewConversation": "Neue Unterhaltung", "agentUntitledConversation": "Neuer Chat", - "agentConversationActions": "Chat-Aktionen", - "agentElapsedTime": "Dauer {duration}", "agentConversationActions": "Unterhaltungsaktionen", + "agentElapsedTime": "Dauer {duration}", "agentMoveToTrash": "In den Papierkorb verschieben", "agentTrash": "Papierkorb", "agentRestore": "Wiederherstellen", @@ -955,5 +954,64 @@ "cornerTopLeft": "Radius oben links", "cornerTopRight": "Radius oben rechts", "cornerBottomRight": "Radius unten rechts", - "cornerBottomLeft": "Radius unten links" + "cornerBottomLeft": "Radius unten links", + "effects": "Effects", + "addEffect": "Add effect", + "dropShadow": "Drop shadow", + "innerShadow": "Inner shadow", + "layerBlur": "Layer blur", + "backgroundBlur": "Background blur", + "glassEffect": "Glass", + "noiseEffect": "Noise", + "textureEffect": "Texture", + "updateEffectFailed": "Could not update effect", + "effectBlurEnd": "End blur", + "effectProgressive": "Progressive", + "effectUniform": "Uniform", + "effectLightAngle": "Light angle", + "effectLightIntensity": "Light intensity", + "effectRefraction": "Refraction", + "effectDepth": "Depth", + "effectDispersion": "Dispersion", + "effectFrost": "Frost", + "effectSplay": "Splay", + "effectNoiseMode": "Noise colors", + "effectMono": "Mono", + "effectDuo": "Duo", + "effectMulti": "Multi", + "effectNoiseSize": "Size", + "effectDensity": "Density", + "effectSecondColor": "Second color", + "effectTextureRadius": "Radius", + "effectClipToShape": "Clip to shape", + "effectSeed": "Seed", + "effectStartX": "Start X", + "effectStartY": "Start Y", + "effectEndX": "End X", + "effectEndY": "End Y", + "effectMoveUp": "Move effect up", + "effectMoveDown": "Move effect down", + "strokes": "Konturen", + "stroke": "Kontur", + "addStroke": "Kontur hinzufügen", + "updateStrokeFailed": "Kontur konnte nicht aktualisiert werden", + "strokeWidth": "Stärke", + "strokeInside": "Innen", + "strokeCenter": "Zentriert", + "strokeOutside": "Außen", + "strokeStyle": "Stil", + "strokeSolid": "Durchgezogen", + "strokeDashed": "Gestrichelt", + "strokeDashLength": "Strichlänge", + "strokeDashGap": "Abstand", + "distortion": "Verzerrung", + "editDistortion": "Verzerrung bearbeiten", + "finishDistortion": "Verzerrung abschließen", + "resetDistortion": "Verzerrung zurücksetzen", + "freeDistortion": "Frei", + "perspectiveDistortion": "Perspektive", + "distortionTopLeft": "Oben links", + "distortionTopRight": "Oben rechts", + "distortionBottomRight": "Unten rechts", + "distortionBottomLeft": "Unten links" } diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index 5e6b913..a2206bf 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -36,8 +36,13 @@ "agentUntitledConversation": "New chat", "agentConversationActions": "Conversation actions", "agentElapsedTime": "Took {duration}", - "@agentElapsedTime": {"placeholders": {"duration": {"type": "String"}}}, - "agentConversationActions": "Conversation actions", + "@agentElapsedTime": { + "placeholders": { + "duration": { + "type": "String" + } + } + }, "agentMoveToTrash": "Move to Trash", "agentTrash": "Trash", "agentRestore": "Restore", @@ -783,7 +788,11 @@ "resumeDownload": "Resume", "downloadPaused": "Paused", "@subtitleResourcesDownloadSize": { - "placeholders": {"size": {"type": "String"}} + "placeholders": { + "size": { + "type": "String" + } + } }, "cancelResourceDownloadTitle": "Cancel download?", "cancelResourceDownloadMessage": "The download will stop. Progress on the current resource may be lost.", @@ -1415,5 +1424,64 @@ "cornerTopLeft": "Top left radius", "cornerTopRight": "Top right radius", "cornerBottomRight": "Bottom right radius", - "cornerBottomLeft": "Bottom left radius" + "cornerBottomLeft": "Bottom left radius", + "effects": "Effects", + "addEffect": "Add effect", + "dropShadow": "Drop shadow", + "innerShadow": "Inner shadow", + "layerBlur": "Layer blur", + "backgroundBlur": "Background blur", + "glassEffect": "Glass", + "noiseEffect": "Noise", + "textureEffect": "Texture", + "updateEffectFailed": "Could not update effect", + "effectBlurEnd": "End blur", + "effectProgressive": "Progressive", + "effectUniform": "Uniform", + "effectLightAngle": "Light angle", + "effectLightIntensity": "Light intensity", + "effectRefraction": "Refraction", + "effectDepth": "Depth", + "effectDispersion": "Dispersion", + "effectFrost": "Frost", + "effectSplay": "Splay", + "effectNoiseMode": "Noise colors", + "effectMono": "Mono", + "effectDuo": "Duo", + "effectMulti": "Multi", + "effectNoiseSize": "Size", + "effectDensity": "Density", + "effectSecondColor": "Second color", + "effectTextureRadius": "Radius", + "effectClipToShape": "Clip to shape", + "effectSeed": "Seed", + "effectStartX": "Start X", + "effectStartY": "Start Y", + "effectEndX": "End X", + "effectEndY": "End Y", + "effectMoveUp": "Move effect up", + "effectMoveDown": "Move effect down", + "strokes": "Strokes", + "stroke": "Stroke", + "addStroke": "Add stroke", + "updateStrokeFailed": "Could not update stroke", + "strokeWidth": "Weight", + "strokeInside": "Inside", + "strokeCenter": "Center", + "strokeOutside": "Outside", + "strokeStyle": "Style", + "strokeSolid": "Solid", + "strokeDashed": "Dashed", + "strokeDashLength": "Dash", + "strokeDashGap": "Gap", + "distortion": "Distortion", + "editDistortion": "Edit distortion", + "finishDistortion": "Finish distortion", + "resetDistortion": "Reset distortion", + "freeDistortion": "Free", + "perspectiveDistortion": "Perspective", + "distortionTopLeft": "Top left", + "distortionTopRight": "Top right", + "distortionBottomRight": "Bottom right", + "distortionBottomLeft": "Bottom left" } diff --git a/lib/l10n/app_es.arb b/lib/l10n/app_es.arb index d46550b..fd8e5a1 100644 --- a/lib/l10n/app_es.arb +++ b/lib/l10n/app_es.arb @@ -14,7 +14,6 @@ "agentUntitledConversation": "Nuevo chat", "agentConversationActions": "Acciones de conversación", "agentElapsedTime": "Duración {duration}", - "agentConversationActions": "Acciones de conversación", "agentMoveToTrash": "Mover a la papelera", "agentTrash": "Papelera", "agentRestore": "Restaurar", @@ -955,5 +954,64 @@ "cornerTopLeft": "Radio superior izquierdo", "cornerTopRight": "Radio superior derecho", "cornerBottomRight": "Radio inferior derecho", - "cornerBottomLeft": "Radio inferior izquierdo" + "cornerBottomLeft": "Radio inferior izquierdo", + "effects": "Effects", + "addEffect": "Add effect", + "dropShadow": "Drop shadow", + "innerShadow": "Inner shadow", + "layerBlur": "Layer blur", + "backgroundBlur": "Background blur", + "glassEffect": "Glass", + "noiseEffect": "Noise", + "textureEffect": "Texture", + "updateEffectFailed": "Could not update effect", + "effectBlurEnd": "End blur", + "effectProgressive": "Progressive", + "effectUniform": "Uniform", + "effectLightAngle": "Light angle", + "effectLightIntensity": "Light intensity", + "effectRefraction": "Refraction", + "effectDepth": "Depth", + "effectDispersion": "Dispersion", + "effectFrost": "Frost", + "effectSplay": "Splay", + "effectNoiseMode": "Noise colors", + "effectMono": "Mono", + "effectDuo": "Duo", + "effectMulti": "Multi", + "effectNoiseSize": "Size", + "effectDensity": "Density", + "effectSecondColor": "Second color", + "effectTextureRadius": "Radius", + "effectClipToShape": "Clip to shape", + "effectSeed": "Seed", + "effectStartX": "Start X", + "effectStartY": "Start Y", + "effectEndX": "End X", + "effectEndY": "End Y", + "effectMoveUp": "Move effect up", + "effectMoveDown": "Move effect down", + "strokes": "Trazos", + "stroke": "Trazo", + "addStroke": "Añadir trazo", + "updateStrokeFailed": "No se pudo actualizar el trazo", + "strokeWidth": "Grosor", + "strokeInside": "Interior", + "strokeCenter": "Centro", + "strokeOutside": "Exterior", + "strokeStyle": "Estilo", + "strokeSolid": "Continuo", + "strokeDashed": "Discontinuo", + "strokeDashLength": "Longitud", + "strokeDashGap": "Espacio", + "distortion": "Distorsión", + "editDistortion": "Editar distorsión", + "finishDistortion": "Terminar distorsión", + "resetDistortion": "Restablecer distorsión", + "freeDistortion": "Libre", + "perspectiveDistortion": "Perspectiva", + "distortionTopLeft": "Superior izquierda", + "distortionTopRight": "Superior derecha", + "distortionBottomRight": "Inferior derecha", + "distortionBottomLeft": "Inferior izquierda" } diff --git a/lib/l10n/app_fr.arb b/lib/l10n/app_fr.arb index 14cb96d..a422b4e 100644 --- a/lib/l10n/app_fr.arb +++ b/lib/l10n/app_fr.arb @@ -12,9 +12,8 @@ "showFewerConversations": "Afficher moins", "agentNewConversation": "Nouvelle conversation", "agentUntitledConversation": "Nouvelle conversation", - "agentConversationActions": "Actions de conversation", - "agentElapsedTime": "Durée {duration}", "agentConversationActions": "Actions de la conversation", + "agentElapsedTime": "Durée {duration}", "agentMoveToTrash": "Déplacer vers la corbeille", "agentTrash": "Corbeille", "agentRestore": "Restaurer", @@ -955,5 +954,64 @@ "cornerTopLeft": "Rayon supérieur gauche", "cornerTopRight": "Rayon supérieur droit", "cornerBottomRight": "Rayon inférieur droit", - "cornerBottomLeft": "Rayon inférieur gauche" + "cornerBottomLeft": "Rayon inférieur gauche", + "effects": "Effects", + "addEffect": "Add effect", + "dropShadow": "Drop shadow", + "innerShadow": "Inner shadow", + "layerBlur": "Layer blur", + "backgroundBlur": "Background blur", + "glassEffect": "Glass", + "noiseEffect": "Noise", + "textureEffect": "Texture", + "updateEffectFailed": "Could not update effect", + "effectBlurEnd": "End blur", + "effectProgressive": "Progressive", + "effectUniform": "Uniform", + "effectLightAngle": "Light angle", + "effectLightIntensity": "Light intensity", + "effectRefraction": "Refraction", + "effectDepth": "Depth", + "effectDispersion": "Dispersion", + "effectFrost": "Frost", + "effectSplay": "Splay", + "effectNoiseMode": "Noise colors", + "effectMono": "Mono", + "effectDuo": "Duo", + "effectMulti": "Multi", + "effectNoiseSize": "Size", + "effectDensity": "Density", + "effectSecondColor": "Second color", + "effectTextureRadius": "Radius", + "effectClipToShape": "Clip to shape", + "effectSeed": "Seed", + "effectStartX": "Start X", + "effectStartY": "Start Y", + "effectEndX": "End X", + "effectEndY": "End Y", + "effectMoveUp": "Move effect up", + "effectMoveDown": "Move effect down", + "strokes": "Contours", + "stroke": "Contour", + "addStroke": "Ajouter un contour", + "updateStrokeFailed": "Impossible de modifier le contour", + "strokeWidth": "Épaisseur", + "strokeInside": "Intérieur", + "strokeCenter": "Centre", + "strokeOutside": "Extérieur", + "strokeStyle": "Style", + "strokeSolid": "Continu", + "strokeDashed": "Pointillé", + "strokeDashLength": "Longueur", + "strokeDashGap": "Espacement", + "distortion": "Déformation", + "editDistortion": "Modifier la déformation", + "finishDistortion": "Terminer la déformation", + "resetDistortion": "Réinitialiser la déformation", + "freeDistortion": "Libre", + "perspectiveDistortion": "Perspective", + "distortionTopLeft": "Haut gauche", + "distortionTopRight": "Haut droit", + "distortionBottomRight": "Bas droit", + "distortionBottomLeft": "Bas gauche" } diff --git a/lib/l10n/app_it.arb b/lib/l10n/app_it.arb index 2f13853..9ca15a0 100644 --- a/lib/l10n/app_it.arb +++ b/lib/l10n/app_it.arb @@ -14,7 +14,6 @@ "agentUntitledConversation": "Nuova chat", "agentConversationActions": "Azioni della conversazione", "agentElapsedTime": "Durata {duration}", - "agentConversationActions": "Azioni della conversazione", "agentMoveToTrash": "Sposta nel cestino", "agentTrash": "Cestino", "agentRestore": "Ripristina", @@ -955,5 +954,64 @@ "cornerTopLeft": "Raggio in alto a sinistra", "cornerTopRight": "Raggio in alto a destra", "cornerBottomRight": "Raggio in basso a destra", - "cornerBottomLeft": "Raggio in basso a sinistra" + "cornerBottomLeft": "Raggio in basso a sinistra", + "effects": "Effects", + "addEffect": "Add effect", + "dropShadow": "Drop shadow", + "innerShadow": "Inner shadow", + "layerBlur": "Layer blur", + "backgroundBlur": "Background blur", + "glassEffect": "Glass", + "noiseEffect": "Noise", + "textureEffect": "Texture", + "updateEffectFailed": "Could not update effect", + "effectBlurEnd": "End blur", + "effectProgressive": "Progressive", + "effectUniform": "Uniform", + "effectLightAngle": "Light angle", + "effectLightIntensity": "Light intensity", + "effectRefraction": "Refraction", + "effectDepth": "Depth", + "effectDispersion": "Dispersion", + "effectFrost": "Frost", + "effectSplay": "Splay", + "effectNoiseMode": "Noise colors", + "effectMono": "Mono", + "effectDuo": "Duo", + "effectMulti": "Multi", + "effectNoiseSize": "Size", + "effectDensity": "Density", + "effectSecondColor": "Second color", + "effectTextureRadius": "Radius", + "effectClipToShape": "Clip to shape", + "effectSeed": "Seed", + "effectStartX": "Start X", + "effectStartY": "Start Y", + "effectEndX": "End X", + "effectEndY": "End Y", + "effectMoveUp": "Move effect up", + "effectMoveDown": "Move effect down", + "strokes": "Tratti", + "stroke": "Tratto", + "addStroke": "Aggiungi tratto", + "updateStrokeFailed": "Impossibile aggiornare il tratto", + "strokeWidth": "Spessore", + "strokeInside": "Interno", + "strokeCenter": "Centro", + "strokeOutside": "Esterno", + "strokeStyle": "Stile", + "strokeSolid": "Continuo", + "strokeDashed": "Tratteggiato", + "strokeDashLength": "Lunghezza", + "strokeDashGap": "Spazio", + "distortion": "Distorsione", + "editDistortion": "Modifica distorsione", + "finishDistortion": "Termina distorsione", + "resetDistortion": "Reimposta distorsione", + "freeDistortion": "Libera", + "perspectiveDistortion": "Prospettiva", + "distortionTopLeft": "In alto a sinistra", + "distortionTopRight": "In alto a destra", + "distortionBottomRight": "In basso a destra", + "distortionBottomLeft": "In basso a sinistra" } diff --git a/lib/l10n/app_ja.arb b/lib/l10n/app_ja.arb index 032a6be..c4033e6 100644 --- a/lib/l10n/app_ja.arb +++ b/lib/l10n/app_ja.arb @@ -12,9 +12,8 @@ "showFewerConversations": "表示を減らす", "agentNewConversation": "新しい会話", "agentUntitledConversation": "新しいチャット", - "agentConversationActions": "チャットの操作", - "agentElapsedTime": "所要時間 {duration}", "agentConversationActions": "会話の操作", + "agentElapsedTime": "所要時間 {duration}", "agentMoveToTrash": "ゴミ箱に移動", "agentTrash": "ゴミ箱", "agentRestore": "復元", @@ -955,5 +954,64 @@ "cornerTopLeft": "左上の半径", "cornerTopRight": "右上の半径", "cornerBottomRight": "右下の半径", - "cornerBottomLeft": "左下の半径" + "cornerBottomLeft": "左下の半径", + "effects": "Effects", + "addEffect": "Add effect", + "dropShadow": "Drop shadow", + "innerShadow": "Inner shadow", + "layerBlur": "Layer blur", + "backgroundBlur": "Background blur", + "glassEffect": "Glass", + "noiseEffect": "Noise", + "textureEffect": "Texture", + "updateEffectFailed": "Could not update effect", + "effectBlurEnd": "End blur", + "effectProgressive": "Progressive", + "effectUniform": "Uniform", + "effectLightAngle": "Light angle", + "effectLightIntensity": "Light intensity", + "effectRefraction": "Refraction", + "effectDepth": "Depth", + "effectDispersion": "Dispersion", + "effectFrost": "Frost", + "effectSplay": "Splay", + "effectNoiseMode": "Noise colors", + "effectMono": "Mono", + "effectDuo": "Duo", + "effectMulti": "Multi", + "effectNoiseSize": "Size", + "effectDensity": "Density", + "effectSecondColor": "Second color", + "effectTextureRadius": "Radius", + "effectClipToShape": "Clip to shape", + "effectSeed": "Seed", + "effectStartX": "Start X", + "effectStartY": "Start Y", + "effectEndX": "End X", + "effectEndY": "End Y", + "effectMoveUp": "Move effect up", + "effectMoveDown": "Move effect down", + "strokes": "線", + "stroke": "線", + "addStroke": "線を追加", + "updateStrokeFailed": "線を更新できませんでした", + "strokeWidth": "太さ", + "strokeInside": "内側", + "strokeCenter": "中央", + "strokeOutside": "外側", + "strokeStyle": "スタイル", + "strokeSolid": "実線", + "strokeDashed": "破線", + "strokeDashLength": "破線の長さ", + "strokeDashGap": "間隔", + "distortion": "変形", + "editDistortion": "変形を編集", + "finishDistortion": "変形を完了", + "resetDistortion": "変形をリセット", + "freeDistortion": "自由", + "perspectiveDistortion": "遠近連動", + "distortionTopLeft": "左上", + "distortionTopRight": "右上", + "distortionBottomRight": "右下", + "distortionBottomLeft": "左下" } diff --git a/lib/l10n/app_ko.arb b/lib/l10n/app_ko.arb index 204c050..3aca2d0 100644 --- a/lib/l10n/app_ko.arb +++ b/lib/l10n/app_ko.arb @@ -12,9 +12,8 @@ "showFewerConversations": "접기", "agentNewConversation": "새 대화", "agentUntitledConversation": "새 채팅", - "agentConversationActions": "채팅 작업", - "agentElapsedTime": "소요 시간 {duration}", "agentConversationActions": "대화 작업", + "agentElapsedTime": "소요 시간 {duration}", "agentMoveToTrash": "휴지통으로 이동", "agentTrash": "휴지통", "agentRestore": "복원", @@ -955,5 +954,64 @@ "cornerTopLeft": "왼쪽 위 반경", "cornerTopRight": "오른쪽 위 반경", "cornerBottomRight": "오른쪽 아래 반경", - "cornerBottomLeft": "왼쪽 아래 반경" + "cornerBottomLeft": "왼쪽 아래 반경", + "effects": "Effects", + "addEffect": "Add effect", + "dropShadow": "Drop shadow", + "innerShadow": "Inner shadow", + "layerBlur": "Layer blur", + "backgroundBlur": "Background blur", + "glassEffect": "Glass", + "noiseEffect": "Noise", + "textureEffect": "Texture", + "updateEffectFailed": "Could not update effect", + "effectBlurEnd": "End blur", + "effectProgressive": "Progressive", + "effectUniform": "Uniform", + "effectLightAngle": "Light angle", + "effectLightIntensity": "Light intensity", + "effectRefraction": "Refraction", + "effectDepth": "Depth", + "effectDispersion": "Dispersion", + "effectFrost": "Frost", + "effectSplay": "Splay", + "effectNoiseMode": "Noise colors", + "effectMono": "Mono", + "effectDuo": "Duo", + "effectMulti": "Multi", + "effectNoiseSize": "Size", + "effectDensity": "Density", + "effectSecondColor": "Second color", + "effectTextureRadius": "Radius", + "effectClipToShape": "Clip to shape", + "effectSeed": "Seed", + "effectStartX": "Start X", + "effectStartY": "Start Y", + "effectEndX": "End X", + "effectEndY": "End Y", + "effectMoveUp": "Move effect up", + "effectMoveDown": "Move effect down", + "strokes": "선", + "stroke": "선", + "addStroke": "선 추가", + "updateStrokeFailed": "선을 업데이트할 수 없습니다", + "strokeWidth": "두께", + "strokeInside": "안쪽", + "strokeCenter": "가운데", + "strokeOutside": "바깥쪽", + "strokeStyle": "스타일", + "strokeSolid": "실선", + "strokeDashed": "파선", + "strokeDashLength": "선 길이", + "strokeDashGap": "간격", + "distortion": "왜곡", + "editDistortion": "왜곡 편집", + "finishDistortion": "왜곡 완료", + "resetDistortion": "왜곡 초기화", + "freeDistortion": "자유", + "perspectiveDistortion": "원근 연동", + "distortionTopLeft": "왼쪽 위", + "distortionTopRight": "오른쪽 위", + "distortionBottomRight": "오른쪽 아래", + "distortionBottomLeft": "왼쪽 아래" } diff --git a/lib/l10n/app_localizations.dart b/lib/l10n/app_localizations.dart index a177016..0098d20 100644 --- a/lib/l10n/app_localizations.dart +++ b/lib/l10n/app_localizations.dart @@ -4423,6 +4423,360 @@ abstract class AppLocalizations { /// In en, this message translates to: /// **'Bottom left radius'** String get cornerBottomLeft; + + /// No description provided for @effects. + /// + /// In en, this message translates to: + /// **'Effects'** + String get effects; + + /// No description provided for @addEffect. + /// + /// In en, this message translates to: + /// **'Add effect'** + String get addEffect; + + /// No description provided for @dropShadow. + /// + /// In en, this message translates to: + /// **'Drop shadow'** + String get dropShadow; + + /// No description provided for @innerShadow. + /// + /// In en, this message translates to: + /// **'Inner shadow'** + String get innerShadow; + + /// No description provided for @layerBlur. + /// + /// In en, this message translates to: + /// **'Layer blur'** + String get layerBlur; + + /// No description provided for @backgroundBlur. + /// + /// In en, this message translates to: + /// **'Background blur'** + String get backgroundBlur; + + /// No description provided for @glassEffect. + /// + /// In en, this message translates to: + /// **'Glass'** + String get glassEffect; + + /// No description provided for @noiseEffect. + /// + /// In en, this message translates to: + /// **'Noise'** + String get noiseEffect; + + /// No description provided for @textureEffect. + /// + /// In en, this message translates to: + /// **'Texture'** + String get textureEffect; + + /// No description provided for @updateEffectFailed. + /// + /// In en, this message translates to: + /// **'Could not update effect'** + String get updateEffectFailed; + + /// No description provided for @effectBlurEnd. + /// + /// In en, this message translates to: + /// **'End blur'** + String get effectBlurEnd; + + /// No description provided for @effectProgressive. + /// + /// In en, this message translates to: + /// **'Progressive'** + String get effectProgressive; + + /// No description provided for @effectUniform. + /// + /// In en, this message translates to: + /// **'Uniform'** + String get effectUniform; + + /// No description provided for @effectLightAngle. + /// + /// In en, this message translates to: + /// **'Light angle'** + String get effectLightAngle; + + /// No description provided for @effectLightIntensity. + /// + /// In en, this message translates to: + /// **'Light intensity'** + String get effectLightIntensity; + + /// No description provided for @effectRefraction. + /// + /// In en, this message translates to: + /// **'Refraction'** + String get effectRefraction; + + /// No description provided for @effectDepth. + /// + /// In en, this message translates to: + /// **'Depth'** + String get effectDepth; + + /// No description provided for @effectDispersion. + /// + /// In en, this message translates to: + /// **'Dispersion'** + String get effectDispersion; + + /// No description provided for @effectFrost. + /// + /// In en, this message translates to: + /// **'Frost'** + String get effectFrost; + + /// No description provided for @effectSplay. + /// + /// In en, this message translates to: + /// **'Splay'** + String get effectSplay; + + /// No description provided for @effectNoiseMode. + /// + /// In en, this message translates to: + /// **'Noise colors'** + String get effectNoiseMode; + + /// No description provided for @effectMono. + /// + /// In en, this message translates to: + /// **'Mono'** + String get effectMono; + + /// No description provided for @effectDuo. + /// + /// In en, this message translates to: + /// **'Duo'** + String get effectDuo; + + /// No description provided for @effectMulti. + /// + /// In en, this message translates to: + /// **'Multi'** + String get effectMulti; + + /// No description provided for @effectNoiseSize. + /// + /// In en, this message translates to: + /// **'Size'** + String get effectNoiseSize; + + /// No description provided for @effectDensity. + /// + /// In en, this message translates to: + /// **'Density'** + String get effectDensity; + + /// No description provided for @effectSecondColor. + /// + /// In en, this message translates to: + /// **'Second color'** + String get effectSecondColor; + + /// No description provided for @effectTextureRadius. + /// + /// In en, this message translates to: + /// **'Radius'** + String get effectTextureRadius; + + /// No description provided for @effectClipToShape. + /// + /// In en, this message translates to: + /// **'Clip to shape'** + String get effectClipToShape; + + /// No description provided for @effectSeed. + /// + /// In en, this message translates to: + /// **'Seed'** + String get effectSeed; + + /// No description provided for @effectStartX. + /// + /// In en, this message translates to: + /// **'Start X'** + String get effectStartX; + + /// No description provided for @effectStartY. + /// + /// In en, this message translates to: + /// **'Start Y'** + String get effectStartY; + + /// No description provided for @effectEndX. + /// + /// In en, this message translates to: + /// **'End X'** + String get effectEndX; + + /// No description provided for @effectEndY. + /// + /// In en, this message translates to: + /// **'End Y'** + String get effectEndY; + + /// No description provided for @effectMoveUp. + /// + /// In en, this message translates to: + /// **'Move effect up'** + String get effectMoveUp; + + /// No description provided for @effectMoveDown. + /// + /// In en, this message translates to: + /// **'Move effect down'** + String get effectMoveDown; + + /// No description provided for @strokes. + /// + /// In en, this message translates to: + /// **'Strokes'** + String get strokes; + + /// No description provided for @stroke. + /// + /// In en, this message translates to: + /// **'Stroke'** + String get stroke; + + /// No description provided for @addStroke. + /// + /// In en, this message translates to: + /// **'Add stroke'** + String get addStroke; + + /// No description provided for @updateStrokeFailed. + /// + /// In en, this message translates to: + /// **'Could not update stroke'** + String get updateStrokeFailed; + + /// No description provided for @strokeWidth. + /// + /// In en, this message translates to: + /// **'Weight'** + String get strokeWidth; + + /// No description provided for @strokeInside. + /// + /// In en, this message translates to: + /// **'Inside'** + String get strokeInside; + + /// No description provided for @strokeCenter. + /// + /// In en, this message translates to: + /// **'Center'** + String get strokeCenter; + + /// No description provided for @strokeOutside. + /// + /// In en, this message translates to: + /// **'Outside'** + String get strokeOutside; + + /// No description provided for @strokeStyle. + /// + /// In en, this message translates to: + /// **'Style'** + String get strokeStyle; + + /// No description provided for @strokeSolid. + /// + /// In en, this message translates to: + /// **'Solid'** + String get strokeSolid; + + /// No description provided for @strokeDashed. + /// + /// In en, this message translates to: + /// **'Dashed'** + String get strokeDashed; + + /// No description provided for @strokeDashLength. + /// + /// In en, this message translates to: + /// **'Dash'** + String get strokeDashLength; + + /// No description provided for @strokeDashGap. + /// + /// In en, this message translates to: + /// **'Gap'** + String get strokeDashGap; + + /// No description provided for @distortion. + /// + /// In en, this message translates to: + /// **'Distortion'** + String get distortion; + + /// No description provided for @editDistortion. + /// + /// In en, this message translates to: + /// **'Edit distortion'** + String get editDistortion; + + /// No description provided for @finishDistortion. + /// + /// In en, this message translates to: + /// **'Finish distortion'** + String get finishDistortion; + + /// No description provided for @resetDistortion. + /// + /// In en, this message translates to: + /// **'Reset distortion'** + String get resetDistortion; + + /// No description provided for @freeDistortion. + /// + /// In en, this message translates to: + /// **'Free'** + String get freeDistortion; + + /// No description provided for @perspectiveDistortion. + /// + /// In en, this message translates to: + /// **'Perspective'** + String get perspectiveDistortion; + + /// No description provided for @distortionTopLeft. + /// + /// In en, this message translates to: + /// **'Top left'** + String get distortionTopLeft; + + /// No description provided for @distortionTopRight. + /// + /// In en, this message translates to: + /// **'Top right'** + String get distortionTopRight; + + /// No description provided for @distortionBottomRight. + /// + /// In en, this message translates to: + /// **'Bottom right'** + String get distortionBottomRight; + + /// No description provided for @distortionBottomLeft. + /// + /// In en, this message translates to: + /// **'Bottom left'** + String get distortionBottomLeft; } class _AppLocalizationsDelegate diff --git a/lib/l10n/app_localizations_de.dart b/lib/l10n/app_localizations_de.dart index 9d52ba0..6b4c594 100644 --- a/lib/l10n/app_localizations_de.dart +++ b/lib/l10n/app_localizations_de.dart @@ -2404,4 +2404,181 @@ class AppLocalizationsDe extends AppLocalizations { @override String get cornerBottomLeft => 'Radius unten links'; + + @override + String get effects => 'Effects'; + + @override + String get addEffect => 'Add effect'; + + @override + String get dropShadow => 'Drop shadow'; + + @override + String get innerShadow => 'Inner shadow'; + + @override + String get layerBlur => 'Layer blur'; + + @override + String get backgroundBlur => 'Background blur'; + + @override + String get glassEffect => 'Glass'; + + @override + String get noiseEffect => 'Noise'; + + @override + String get textureEffect => 'Texture'; + + @override + String get updateEffectFailed => 'Could not update effect'; + + @override + String get effectBlurEnd => 'End blur'; + + @override + String get effectProgressive => 'Progressive'; + + @override + String get effectUniform => 'Uniform'; + + @override + String get effectLightAngle => 'Light angle'; + + @override + String get effectLightIntensity => 'Light intensity'; + + @override + String get effectRefraction => 'Refraction'; + + @override + String get effectDepth => 'Depth'; + + @override + String get effectDispersion => 'Dispersion'; + + @override + String get effectFrost => 'Frost'; + + @override + String get effectSplay => 'Splay'; + + @override + String get effectNoiseMode => 'Noise colors'; + + @override + String get effectMono => 'Mono'; + + @override + String get effectDuo => 'Duo'; + + @override + String get effectMulti => 'Multi'; + + @override + String get effectNoiseSize => 'Size'; + + @override + String get effectDensity => 'Density'; + + @override + String get effectSecondColor => 'Second color'; + + @override + String get effectTextureRadius => 'Radius'; + + @override + String get effectClipToShape => 'Clip to shape'; + + @override + String get effectSeed => 'Seed'; + + @override + String get effectStartX => 'Start X'; + + @override + String get effectStartY => 'Start Y'; + + @override + String get effectEndX => 'End X'; + + @override + String get effectEndY => 'End Y'; + + @override + String get effectMoveUp => 'Move effect up'; + + @override + String get effectMoveDown => 'Move effect down'; + + @override + String get strokes => 'Konturen'; + + @override + String get stroke => 'Kontur'; + + @override + String get addStroke => 'Kontur hinzufügen'; + + @override + String get updateStrokeFailed => 'Kontur konnte nicht aktualisiert werden'; + + @override + String get strokeWidth => 'Stärke'; + + @override + String get strokeInside => 'Innen'; + + @override + String get strokeCenter => 'Zentriert'; + + @override + String get strokeOutside => 'Außen'; + + @override + String get strokeStyle => 'Stil'; + + @override + String get strokeSolid => 'Durchgezogen'; + + @override + String get strokeDashed => 'Gestrichelt'; + + @override + String get strokeDashLength => 'Strichlänge'; + + @override + String get strokeDashGap => 'Abstand'; + + @override + String get distortion => 'Verzerrung'; + + @override + String get editDistortion => 'Verzerrung bearbeiten'; + + @override + String get finishDistortion => 'Verzerrung abschließen'; + + @override + String get resetDistortion => 'Verzerrung zurücksetzen'; + + @override + String get freeDistortion => 'Frei'; + + @override + String get perspectiveDistortion => 'Perspektive'; + + @override + String get distortionTopLeft => 'Oben links'; + + @override + String get distortionTopRight => 'Oben rechts'; + + @override + String get distortionBottomRight => 'Unten rechts'; + + @override + String get distortionBottomLeft => 'Unten links'; } diff --git a/lib/l10n/app_localizations_en.dart b/lib/l10n/app_localizations_en.dart index a6a7a9e..9c11d7c 100644 --- a/lib/l10n/app_localizations_en.dart +++ b/lib/l10n/app_localizations_en.dart @@ -2368,4 +2368,181 @@ class AppLocalizationsEn extends AppLocalizations { @override String get cornerBottomLeft => 'Bottom left radius'; + + @override + String get effects => 'Effects'; + + @override + String get addEffect => 'Add effect'; + + @override + String get dropShadow => 'Drop shadow'; + + @override + String get innerShadow => 'Inner shadow'; + + @override + String get layerBlur => 'Layer blur'; + + @override + String get backgroundBlur => 'Background blur'; + + @override + String get glassEffect => 'Glass'; + + @override + String get noiseEffect => 'Noise'; + + @override + String get textureEffect => 'Texture'; + + @override + String get updateEffectFailed => 'Could not update effect'; + + @override + String get effectBlurEnd => 'End blur'; + + @override + String get effectProgressive => 'Progressive'; + + @override + String get effectUniform => 'Uniform'; + + @override + String get effectLightAngle => 'Light angle'; + + @override + String get effectLightIntensity => 'Light intensity'; + + @override + String get effectRefraction => 'Refraction'; + + @override + String get effectDepth => 'Depth'; + + @override + String get effectDispersion => 'Dispersion'; + + @override + String get effectFrost => 'Frost'; + + @override + String get effectSplay => 'Splay'; + + @override + String get effectNoiseMode => 'Noise colors'; + + @override + String get effectMono => 'Mono'; + + @override + String get effectDuo => 'Duo'; + + @override + String get effectMulti => 'Multi'; + + @override + String get effectNoiseSize => 'Size'; + + @override + String get effectDensity => 'Density'; + + @override + String get effectSecondColor => 'Second color'; + + @override + String get effectTextureRadius => 'Radius'; + + @override + String get effectClipToShape => 'Clip to shape'; + + @override + String get effectSeed => 'Seed'; + + @override + String get effectStartX => 'Start X'; + + @override + String get effectStartY => 'Start Y'; + + @override + String get effectEndX => 'End X'; + + @override + String get effectEndY => 'End Y'; + + @override + String get effectMoveUp => 'Move effect up'; + + @override + String get effectMoveDown => 'Move effect down'; + + @override + String get strokes => 'Strokes'; + + @override + String get stroke => 'Stroke'; + + @override + String get addStroke => 'Add stroke'; + + @override + String get updateStrokeFailed => 'Could not update stroke'; + + @override + String get strokeWidth => 'Weight'; + + @override + String get strokeInside => 'Inside'; + + @override + String get strokeCenter => 'Center'; + + @override + String get strokeOutside => 'Outside'; + + @override + String get strokeStyle => 'Style'; + + @override + String get strokeSolid => 'Solid'; + + @override + String get strokeDashed => 'Dashed'; + + @override + String get strokeDashLength => 'Dash'; + + @override + String get strokeDashGap => 'Gap'; + + @override + String get distortion => 'Distortion'; + + @override + String get editDistortion => 'Edit distortion'; + + @override + String get finishDistortion => 'Finish distortion'; + + @override + String get resetDistortion => 'Reset distortion'; + + @override + String get freeDistortion => 'Free'; + + @override + String get perspectiveDistortion => 'Perspective'; + + @override + String get distortionTopLeft => 'Top left'; + + @override + String get distortionTopRight => 'Top right'; + + @override + String get distortionBottomRight => 'Bottom right'; + + @override + String get distortionBottomLeft => 'Bottom left'; } diff --git a/lib/l10n/app_localizations_es.dart b/lib/l10n/app_localizations_es.dart index d93a332..a6c7374 100644 --- a/lib/l10n/app_localizations_es.dart +++ b/lib/l10n/app_localizations_es.dart @@ -2403,4 +2403,181 @@ class AppLocalizationsEs extends AppLocalizations { @override String get cornerBottomLeft => 'Radio inferior izquierdo'; + + @override + String get effects => 'Effects'; + + @override + String get addEffect => 'Add effect'; + + @override + String get dropShadow => 'Drop shadow'; + + @override + String get innerShadow => 'Inner shadow'; + + @override + String get layerBlur => 'Layer blur'; + + @override + String get backgroundBlur => 'Background blur'; + + @override + String get glassEffect => 'Glass'; + + @override + String get noiseEffect => 'Noise'; + + @override + String get textureEffect => 'Texture'; + + @override + String get updateEffectFailed => 'Could not update effect'; + + @override + String get effectBlurEnd => 'End blur'; + + @override + String get effectProgressive => 'Progressive'; + + @override + String get effectUniform => 'Uniform'; + + @override + String get effectLightAngle => 'Light angle'; + + @override + String get effectLightIntensity => 'Light intensity'; + + @override + String get effectRefraction => 'Refraction'; + + @override + String get effectDepth => 'Depth'; + + @override + String get effectDispersion => 'Dispersion'; + + @override + String get effectFrost => 'Frost'; + + @override + String get effectSplay => 'Splay'; + + @override + String get effectNoiseMode => 'Noise colors'; + + @override + String get effectMono => 'Mono'; + + @override + String get effectDuo => 'Duo'; + + @override + String get effectMulti => 'Multi'; + + @override + String get effectNoiseSize => 'Size'; + + @override + String get effectDensity => 'Density'; + + @override + String get effectSecondColor => 'Second color'; + + @override + String get effectTextureRadius => 'Radius'; + + @override + String get effectClipToShape => 'Clip to shape'; + + @override + String get effectSeed => 'Seed'; + + @override + String get effectStartX => 'Start X'; + + @override + String get effectStartY => 'Start Y'; + + @override + String get effectEndX => 'End X'; + + @override + String get effectEndY => 'End Y'; + + @override + String get effectMoveUp => 'Move effect up'; + + @override + String get effectMoveDown => 'Move effect down'; + + @override + String get strokes => 'Trazos'; + + @override + String get stroke => 'Trazo'; + + @override + String get addStroke => 'Añadir trazo'; + + @override + String get updateStrokeFailed => 'No se pudo actualizar el trazo'; + + @override + String get strokeWidth => 'Grosor'; + + @override + String get strokeInside => 'Interior'; + + @override + String get strokeCenter => 'Centro'; + + @override + String get strokeOutside => 'Exterior'; + + @override + String get strokeStyle => 'Estilo'; + + @override + String get strokeSolid => 'Continuo'; + + @override + String get strokeDashed => 'Discontinuo'; + + @override + String get strokeDashLength => 'Longitud'; + + @override + String get strokeDashGap => 'Espacio'; + + @override + String get distortion => 'Distorsión'; + + @override + String get editDistortion => 'Editar distorsión'; + + @override + String get finishDistortion => 'Terminar distorsión'; + + @override + String get resetDistortion => 'Restablecer distorsión'; + + @override + String get freeDistortion => 'Libre'; + + @override + String get perspectiveDistortion => 'Perspectiva'; + + @override + String get distortionTopLeft => 'Superior izquierda'; + + @override + String get distortionTopRight => 'Superior derecha'; + + @override + String get distortionBottomRight => 'Inferior derecha'; + + @override + String get distortionBottomLeft => 'Inferior izquierda'; } diff --git a/lib/l10n/app_localizations_fr.dart b/lib/l10n/app_localizations_fr.dart index 6ec6480..46ac799 100644 --- a/lib/l10n/app_localizations_fr.dart +++ b/lib/l10n/app_localizations_fr.dart @@ -2406,4 +2406,181 @@ class AppLocalizationsFr extends AppLocalizations { @override String get cornerBottomLeft => 'Rayon inférieur gauche'; + + @override + String get effects => 'Effects'; + + @override + String get addEffect => 'Add effect'; + + @override + String get dropShadow => 'Drop shadow'; + + @override + String get innerShadow => 'Inner shadow'; + + @override + String get layerBlur => 'Layer blur'; + + @override + String get backgroundBlur => 'Background blur'; + + @override + String get glassEffect => 'Glass'; + + @override + String get noiseEffect => 'Noise'; + + @override + String get textureEffect => 'Texture'; + + @override + String get updateEffectFailed => 'Could not update effect'; + + @override + String get effectBlurEnd => 'End blur'; + + @override + String get effectProgressive => 'Progressive'; + + @override + String get effectUniform => 'Uniform'; + + @override + String get effectLightAngle => 'Light angle'; + + @override + String get effectLightIntensity => 'Light intensity'; + + @override + String get effectRefraction => 'Refraction'; + + @override + String get effectDepth => 'Depth'; + + @override + String get effectDispersion => 'Dispersion'; + + @override + String get effectFrost => 'Frost'; + + @override + String get effectSplay => 'Splay'; + + @override + String get effectNoiseMode => 'Noise colors'; + + @override + String get effectMono => 'Mono'; + + @override + String get effectDuo => 'Duo'; + + @override + String get effectMulti => 'Multi'; + + @override + String get effectNoiseSize => 'Size'; + + @override + String get effectDensity => 'Density'; + + @override + String get effectSecondColor => 'Second color'; + + @override + String get effectTextureRadius => 'Radius'; + + @override + String get effectClipToShape => 'Clip to shape'; + + @override + String get effectSeed => 'Seed'; + + @override + String get effectStartX => 'Start X'; + + @override + String get effectStartY => 'Start Y'; + + @override + String get effectEndX => 'End X'; + + @override + String get effectEndY => 'End Y'; + + @override + String get effectMoveUp => 'Move effect up'; + + @override + String get effectMoveDown => 'Move effect down'; + + @override + String get strokes => 'Contours'; + + @override + String get stroke => 'Contour'; + + @override + String get addStroke => 'Ajouter un contour'; + + @override + String get updateStrokeFailed => 'Impossible de modifier le contour'; + + @override + String get strokeWidth => 'Épaisseur'; + + @override + String get strokeInside => 'Intérieur'; + + @override + String get strokeCenter => 'Centre'; + + @override + String get strokeOutside => 'Extérieur'; + + @override + String get strokeStyle => 'Style'; + + @override + String get strokeSolid => 'Continu'; + + @override + String get strokeDashed => 'Pointillé'; + + @override + String get strokeDashLength => 'Longueur'; + + @override + String get strokeDashGap => 'Espacement'; + + @override + String get distortion => 'Déformation'; + + @override + String get editDistortion => 'Modifier la déformation'; + + @override + String get finishDistortion => 'Terminer la déformation'; + + @override + String get resetDistortion => 'Réinitialiser la déformation'; + + @override + String get freeDistortion => 'Libre'; + + @override + String get perspectiveDistortion => 'Perspective'; + + @override + String get distortionTopLeft => 'Haut gauche'; + + @override + String get distortionTopRight => 'Haut droit'; + + @override + String get distortionBottomRight => 'Bas droit'; + + @override + String get distortionBottomLeft => 'Bas gauche'; } diff --git a/lib/l10n/app_localizations_it.dart b/lib/l10n/app_localizations_it.dart index 95f807f..9862d97 100644 --- a/lib/l10n/app_localizations_it.dart +++ b/lib/l10n/app_localizations_it.dart @@ -2396,4 +2396,181 @@ class AppLocalizationsIt extends AppLocalizations { @override String get cornerBottomLeft => 'Raggio in basso a sinistra'; + + @override + String get effects => 'Effects'; + + @override + String get addEffect => 'Add effect'; + + @override + String get dropShadow => 'Drop shadow'; + + @override + String get innerShadow => 'Inner shadow'; + + @override + String get layerBlur => 'Layer blur'; + + @override + String get backgroundBlur => 'Background blur'; + + @override + String get glassEffect => 'Glass'; + + @override + String get noiseEffect => 'Noise'; + + @override + String get textureEffect => 'Texture'; + + @override + String get updateEffectFailed => 'Could not update effect'; + + @override + String get effectBlurEnd => 'End blur'; + + @override + String get effectProgressive => 'Progressive'; + + @override + String get effectUniform => 'Uniform'; + + @override + String get effectLightAngle => 'Light angle'; + + @override + String get effectLightIntensity => 'Light intensity'; + + @override + String get effectRefraction => 'Refraction'; + + @override + String get effectDepth => 'Depth'; + + @override + String get effectDispersion => 'Dispersion'; + + @override + String get effectFrost => 'Frost'; + + @override + String get effectSplay => 'Splay'; + + @override + String get effectNoiseMode => 'Noise colors'; + + @override + String get effectMono => 'Mono'; + + @override + String get effectDuo => 'Duo'; + + @override + String get effectMulti => 'Multi'; + + @override + String get effectNoiseSize => 'Size'; + + @override + String get effectDensity => 'Density'; + + @override + String get effectSecondColor => 'Second color'; + + @override + String get effectTextureRadius => 'Radius'; + + @override + String get effectClipToShape => 'Clip to shape'; + + @override + String get effectSeed => 'Seed'; + + @override + String get effectStartX => 'Start X'; + + @override + String get effectStartY => 'Start Y'; + + @override + String get effectEndX => 'End X'; + + @override + String get effectEndY => 'End Y'; + + @override + String get effectMoveUp => 'Move effect up'; + + @override + String get effectMoveDown => 'Move effect down'; + + @override + String get strokes => 'Tratti'; + + @override + String get stroke => 'Tratto'; + + @override + String get addStroke => 'Aggiungi tratto'; + + @override + String get updateStrokeFailed => 'Impossibile aggiornare il tratto'; + + @override + String get strokeWidth => 'Spessore'; + + @override + String get strokeInside => 'Interno'; + + @override + String get strokeCenter => 'Centro'; + + @override + String get strokeOutside => 'Esterno'; + + @override + String get strokeStyle => 'Stile'; + + @override + String get strokeSolid => 'Continuo'; + + @override + String get strokeDashed => 'Tratteggiato'; + + @override + String get strokeDashLength => 'Lunghezza'; + + @override + String get strokeDashGap => 'Spazio'; + + @override + String get distortion => 'Distorsione'; + + @override + String get editDistortion => 'Modifica distorsione'; + + @override + String get finishDistortion => 'Termina distorsione'; + + @override + String get resetDistortion => 'Reimposta distorsione'; + + @override + String get freeDistortion => 'Libera'; + + @override + String get perspectiveDistortion => 'Prospettiva'; + + @override + String get distortionTopLeft => 'In alto a sinistra'; + + @override + String get distortionTopRight => 'In alto a destra'; + + @override + String get distortionBottomRight => 'In basso a destra'; + + @override + String get distortionBottomLeft => 'In basso a sinistra'; } diff --git a/lib/l10n/app_localizations_ja.dart b/lib/l10n/app_localizations_ja.dart index fef74b5..7d6607e 100644 --- a/lib/l10n/app_localizations_ja.dart +++ b/lib/l10n/app_localizations_ja.dart @@ -2302,4 +2302,181 @@ class AppLocalizationsJa extends AppLocalizations { @override String get cornerBottomLeft => '左下の半径'; + + @override + String get effects => 'Effects'; + + @override + String get addEffect => 'Add effect'; + + @override + String get dropShadow => 'Drop shadow'; + + @override + String get innerShadow => 'Inner shadow'; + + @override + String get layerBlur => 'Layer blur'; + + @override + String get backgroundBlur => 'Background blur'; + + @override + String get glassEffect => 'Glass'; + + @override + String get noiseEffect => 'Noise'; + + @override + String get textureEffect => 'Texture'; + + @override + String get updateEffectFailed => 'Could not update effect'; + + @override + String get effectBlurEnd => 'End blur'; + + @override + String get effectProgressive => 'Progressive'; + + @override + String get effectUniform => 'Uniform'; + + @override + String get effectLightAngle => 'Light angle'; + + @override + String get effectLightIntensity => 'Light intensity'; + + @override + String get effectRefraction => 'Refraction'; + + @override + String get effectDepth => 'Depth'; + + @override + String get effectDispersion => 'Dispersion'; + + @override + String get effectFrost => 'Frost'; + + @override + String get effectSplay => 'Splay'; + + @override + String get effectNoiseMode => 'Noise colors'; + + @override + String get effectMono => 'Mono'; + + @override + String get effectDuo => 'Duo'; + + @override + String get effectMulti => 'Multi'; + + @override + String get effectNoiseSize => 'Size'; + + @override + String get effectDensity => 'Density'; + + @override + String get effectSecondColor => 'Second color'; + + @override + String get effectTextureRadius => 'Radius'; + + @override + String get effectClipToShape => 'Clip to shape'; + + @override + String get effectSeed => 'Seed'; + + @override + String get effectStartX => 'Start X'; + + @override + String get effectStartY => 'Start Y'; + + @override + String get effectEndX => 'End X'; + + @override + String get effectEndY => 'End Y'; + + @override + String get effectMoveUp => 'Move effect up'; + + @override + String get effectMoveDown => 'Move effect down'; + + @override + String get strokes => '線'; + + @override + String get stroke => '線'; + + @override + String get addStroke => '線を追加'; + + @override + String get updateStrokeFailed => '線を更新できませんでした'; + + @override + String get strokeWidth => '太さ'; + + @override + String get strokeInside => '内側'; + + @override + String get strokeCenter => '中央'; + + @override + String get strokeOutside => '外側'; + + @override + String get strokeStyle => 'スタイル'; + + @override + String get strokeSolid => '実線'; + + @override + String get strokeDashed => '破線'; + + @override + String get strokeDashLength => '破線の長さ'; + + @override + String get strokeDashGap => '間隔'; + + @override + String get distortion => '変形'; + + @override + String get editDistortion => '変形を編集'; + + @override + String get finishDistortion => '変形を完了'; + + @override + String get resetDistortion => '変形をリセット'; + + @override + String get freeDistortion => '自由'; + + @override + String get perspectiveDistortion => '遠近連動'; + + @override + String get distortionTopLeft => '左上'; + + @override + String get distortionTopRight => '右上'; + + @override + String get distortionBottomRight => '右下'; + + @override + String get distortionBottomLeft => '左下'; } diff --git a/lib/l10n/app_localizations_ko.dart b/lib/l10n/app_localizations_ko.dart index 508acab..5799851 100644 --- a/lib/l10n/app_localizations_ko.dart +++ b/lib/l10n/app_localizations_ko.dart @@ -2302,4 +2302,181 @@ class AppLocalizationsKo extends AppLocalizations { @override String get cornerBottomLeft => '왼쪽 아래 반경'; + + @override + String get effects => 'Effects'; + + @override + String get addEffect => 'Add effect'; + + @override + String get dropShadow => 'Drop shadow'; + + @override + String get innerShadow => 'Inner shadow'; + + @override + String get layerBlur => 'Layer blur'; + + @override + String get backgroundBlur => 'Background blur'; + + @override + String get glassEffect => 'Glass'; + + @override + String get noiseEffect => 'Noise'; + + @override + String get textureEffect => 'Texture'; + + @override + String get updateEffectFailed => 'Could not update effect'; + + @override + String get effectBlurEnd => 'End blur'; + + @override + String get effectProgressive => 'Progressive'; + + @override + String get effectUniform => 'Uniform'; + + @override + String get effectLightAngle => 'Light angle'; + + @override + String get effectLightIntensity => 'Light intensity'; + + @override + String get effectRefraction => 'Refraction'; + + @override + String get effectDepth => 'Depth'; + + @override + String get effectDispersion => 'Dispersion'; + + @override + String get effectFrost => 'Frost'; + + @override + String get effectSplay => 'Splay'; + + @override + String get effectNoiseMode => 'Noise colors'; + + @override + String get effectMono => 'Mono'; + + @override + String get effectDuo => 'Duo'; + + @override + String get effectMulti => 'Multi'; + + @override + String get effectNoiseSize => 'Size'; + + @override + String get effectDensity => 'Density'; + + @override + String get effectSecondColor => 'Second color'; + + @override + String get effectTextureRadius => 'Radius'; + + @override + String get effectClipToShape => 'Clip to shape'; + + @override + String get effectSeed => 'Seed'; + + @override + String get effectStartX => 'Start X'; + + @override + String get effectStartY => 'Start Y'; + + @override + String get effectEndX => 'End X'; + + @override + String get effectEndY => 'End Y'; + + @override + String get effectMoveUp => 'Move effect up'; + + @override + String get effectMoveDown => 'Move effect down'; + + @override + String get strokes => '선'; + + @override + String get stroke => '선'; + + @override + String get addStroke => '선 추가'; + + @override + String get updateStrokeFailed => '선을 업데이트할 수 없습니다'; + + @override + String get strokeWidth => '두께'; + + @override + String get strokeInside => '안쪽'; + + @override + String get strokeCenter => '가운데'; + + @override + String get strokeOutside => '바깥쪽'; + + @override + String get strokeStyle => '스타일'; + + @override + String get strokeSolid => '실선'; + + @override + String get strokeDashed => '파선'; + + @override + String get strokeDashLength => '선 길이'; + + @override + String get strokeDashGap => '간격'; + + @override + String get distortion => '왜곡'; + + @override + String get editDistortion => '왜곡 편집'; + + @override + String get finishDistortion => '왜곡 완료'; + + @override + String get resetDistortion => '왜곡 초기화'; + + @override + String get freeDistortion => '자유'; + + @override + String get perspectiveDistortion => '원근 연동'; + + @override + String get distortionTopLeft => '왼쪽 위'; + + @override + String get distortionTopRight => '오른쪽 위'; + + @override + String get distortionBottomRight => '오른쪽 아래'; + + @override + String get distortionBottomLeft => '왼쪽 아래'; } diff --git a/lib/l10n/app_localizations_pt.dart b/lib/l10n/app_localizations_pt.dart index da5572c..0966505 100644 --- a/lib/l10n/app_localizations_pt.dart +++ b/lib/l10n/app_localizations_pt.dart @@ -2396,4 +2396,181 @@ class AppLocalizationsPt extends AppLocalizations { @override String get cornerBottomLeft => 'Raio inferior esquerdo'; + + @override + String get effects => 'Effects'; + + @override + String get addEffect => 'Add effect'; + + @override + String get dropShadow => 'Drop shadow'; + + @override + String get innerShadow => 'Inner shadow'; + + @override + String get layerBlur => 'Layer blur'; + + @override + String get backgroundBlur => 'Background blur'; + + @override + String get glassEffect => 'Glass'; + + @override + String get noiseEffect => 'Noise'; + + @override + String get textureEffect => 'Texture'; + + @override + String get updateEffectFailed => 'Could not update effect'; + + @override + String get effectBlurEnd => 'End blur'; + + @override + String get effectProgressive => 'Progressive'; + + @override + String get effectUniform => 'Uniform'; + + @override + String get effectLightAngle => 'Light angle'; + + @override + String get effectLightIntensity => 'Light intensity'; + + @override + String get effectRefraction => 'Refraction'; + + @override + String get effectDepth => 'Depth'; + + @override + String get effectDispersion => 'Dispersion'; + + @override + String get effectFrost => 'Frost'; + + @override + String get effectSplay => 'Splay'; + + @override + String get effectNoiseMode => 'Noise colors'; + + @override + String get effectMono => 'Mono'; + + @override + String get effectDuo => 'Duo'; + + @override + String get effectMulti => 'Multi'; + + @override + String get effectNoiseSize => 'Size'; + + @override + String get effectDensity => 'Density'; + + @override + String get effectSecondColor => 'Second color'; + + @override + String get effectTextureRadius => 'Radius'; + + @override + String get effectClipToShape => 'Clip to shape'; + + @override + String get effectSeed => 'Seed'; + + @override + String get effectStartX => 'Start X'; + + @override + String get effectStartY => 'Start Y'; + + @override + String get effectEndX => 'End X'; + + @override + String get effectEndY => 'End Y'; + + @override + String get effectMoveUp => 'Move effect up'; + + @override + String get effectMoveDown => 'Move effect down'; + + @override + String get strokes => 'Traços'; + + @override + String get stroke => 'Traço'; + + @override + String get addStroke => 'Adicionar traço'; + + @override + String get updateStrokeFailed => 'Não foi possível atualizar o traço'; + + @override + String get strokeWidth => 'Espessura'; + + @override + String get strokeInside => 'Interior'; + + @override + String get strokeCenter => 'Centro'; + + @override + String get strokeOutside => 'Exterior'; + + @override + String get strokeStyle => 'Estilo'; + + @override + String get strokeSolid => 'Contínuo'; + + @override + String get strokeDashed => 'Tracejado'; + + @override + String get strokeDashLength => 'Comprimento'; + + @override + String get strokeDashGap => 'Espaçamento'; + + @override + String get distortion => 'Distorção'; + + @override + String get editDistortion => 'Editar distorção'; + + @override + String get finishDistortion => 'Concluir distorção'; + + @override + String get resetDistortion => 'Redefinir distorção'; + + @override + String get freeDistortion => 'Livre'; + + @override + String get perspectiveDistortion => 'Perspectiva'; + + @override + String get distortionTopLeft => 'Superior esquerdo'; + + @override + String get distortionTopRight => 'Superior direito'; + + @override + String get distortionBottomRight => 'Inferior direito'; + + @override + String get distortionBottomLeft => 'Inferior esquerdo'; } diff --git a/lib/l10n/app_localizations_ru.dart b/lib/l10n/app_localizations_ru.dart index 913252a..bc78494 100644 --- a/lib/l10n/app_localizations_ru.dart +++ b/lib/l10n/app_localizations_ru.dart @@ -2389,4 +2389,181 @@ class AppLocalizationsRu extends AppLocalizations { @override String get cornerBottomLeft => 'Радиус слева снизу'; + + @override + String get effects => 'Effects'; + + @override + String get addEffect => 'Add effect'; + + @override + String get dropShadow => 'Drop shadow'; + + @override + String get innerShadow => 'Inner shadow'; + + @override + String get layerBlur => 'Layer blur'; + + @override + String get backgroundBlur => 'Background blur'; + + @override + String get glassEffect => 'Glass'; + + @override + String get noiseEffect => 'Noise'; + + @override + String get textureEffect => 'Texture'; + + @override + String get updateEffectFailed => 'Could not update effect'; + + @override + String get effectBlurEnd => 'End blur'; + + @override + String get effectProgressive => 'Progressive'; + + @override + String get effectUniform => 'Uniform'; + + @override + String get effectLightAngle => 'Light angle'; + + @override + String get effectLightIntensity => 'Light intensity'; + + @override + String get effectRefraction => 'Refraction'; + + @override + String get effectDepth => 'Depth'; + + @override + String get effectDispersion => 'Dispersion'; + + @override + String get effectFrost => 'Frost'; + + @override + String get effectSplay => 'Splay'; + + @override + String get effectNoiseMode => 'Noise colors'; + + @override + String get effectMono => 'Mono'; + + @override + String get effectDuo => 'Duo'; + + @override + String get effectMulti => 'Multi'; + + @override + String get effectNoiseSize => 'Size'; + + @override + String get effectDensity => 'Density'; + + @override + String get effectSecondColor => 'Second color'; + + @override + String get effectTextureRadius => 'Radius'; + + @override + String get effectClipToShape => 'Clip to shape'; + + @override + String get effectSeed => 'Seed'; + + @override + String get effectStartX => 'Start X'; + + @override + String get effectStartY => 'Start Y'; + + @override + String get effectEndX => 'End X'; + + @override + String get effectEndY => 'End Y'; + + @override + String get effectMoveUp => 'Move effect up'; + + @override + String get effectMoveDown => 'Move effect down'; + + @override + String get strokes => 'Обводки'; + + @override + String get stroke => 'Обводка'; + + @override + String get addStroke => 'Добавить обводку'; + + @override + String get updateStrokeFailed => 'Не удалось обновить обводку'; + + @override + String get strokeWidth => 'Толщина'; + + @override + String get strokeInside => 'Внутри'; + + @override + String get strokeCenter => 'По центру'; + + @override + String get strokeOutside => 'Снаружи'; + + @override + String get strokeStyle => 'Стиль'; + + @override + String get strokeSolid => 'Сплошная'; + + @override + String get strokeDashed => 'Пунктирная'; + + @override + String get strokeDashLength => 'Длина штриха'; + + @override + String get strokeDashGap => 'Интервал'; + + @override + String get distortion => 'Искажение'; + + @override + String get editDistortion => 'Изменить искажение'; + + @override + String get finishDistortion => 'Завершить искажение'; + + @override + String get resetDistortion => 'Сбросить искажение'; + + @override + String get freeDistortion => 'Свободно'; + + @override + String get perspectiveDistortion => 'Перспектива'; + + @override + String get distortionTopLeft => 'Верхний левый'; + + @override + String get distortionTopRight => 'Верхний правый'; + + @override + String get distortionBottomRight => 'Нижний правый'; + + @override + String get distortionBottomLeft => 'Нижний левый'; } diff --git a/lib/l10n/app_localizations_zh.dart b/lib/l10n/app_localizations_zh.dart index 6b5ea49..c446c29 100644 --- a/lib/l10n/app_localizations_zh.dart +++ b/lib/l10n/app_localizations_zh.dart @@ -2259,6 +2259,183 @@ class AppLocalizationsZh extends AppLocalizations { @override String get cornerBottomLeft => '左下圆角'; + + @override + String get effects => '效果'; + + @override + String get addEffect => '添加效果'; + + @override + String get dropShadow => '外阴影'; + + @override + String get innerShadow => '内阴影'; + + @override + String get layerBlur => '图层模糊'; + + @override + String get backgroundBlur => '背景模糊'; + + @override + String get glassEffect => '玻璃'; + + @override + String get noiseEffect => '噪点'; + + @override + String get textureEffect => '纹理'; + + @override + String get updateEffectFailed => '无法更新效果'; + + @override + String get effectBlurEnd => '结束模糊'; + + @override + String get effectProgressive => '渐进'; + + @override + String get effectUniform => '均匀'; + + @override + String get effectLightAngle => '光照角度'; + + @override + String get effectLightIntensity => '光照强度'; + + @override + String get effectRefraction => '折射'; + + @override + String get effectDepth => '深度'; + + @override + String get effectDispersion => '色散'; + + @override + String get effectFrost => '磨砂'; + + @override + String get effectSplay => '光照扩散'; + + @override + String get effectNoiseMode => '噪点颜色'; + + @override + String get effectMono => '单色'; + + @override + String get effectDuo => '双色'; + + @override + String get effectMulti => '多色'; + + @override + String get effectNoiseSize => '颗粒大小'; + + @override + String get effectDensity => '密度'; + + @override + String get effectSecondColor => '第二颜色'; + + @override + String get effectTextureRadius => '扰动半径'; + + @override + String get effectClipToShape => '裁剪到形状'; + + @override + String get effectSeed => '随机种子'; + + @override + String get effectStartX => '起点 X'; + + @override + String get effectStartY => '起点 Y'; + + @override + String get effectEndX => '终点 X'; + + @override + String get effectEndY => '终点 Y'; + + @override + String get effectMoveUp => '上移效果'; + + @override + String get effectMoveDown => '下移效果'; + + @override + String get strokes => '描边'; + + @override + String get stroke => '描边'; + + @override + String get addStroke => '添加描边'; + + @override + String get updateStrokeFailed => '无法更新描边'; + + @override + String get strokeWidth => '粗细'; + + @override + String get strokeInside => '内侧'; + + @override + String get strokeCenter => '居中'; + + @override + String get strokeOutside => '外侧'; + + @override + String get strokeStyle => '样式'; + + @override + String get strokeSolid => '实线'; + + @override + String get strokeDashed => '虚线'; + + @override + String get strokeDashLength => '线段长度'; + + @override + String get strokeDashGap => '间隔'; + + @override + String get distortion => '变形'; + + @override + String get editDistortion => '编辑变形'; + + @override + String get finishDistortion => '完成变形'; + + @override + String get resetDistortion => '重置变形'; + + @override + String get freeDistortion => '自由'; + + @override + String get perspectiveDistortion => '透视联动'; + + @override + String get distortionTopLeft => '左上角'; + + @override + String get distortionTopRight => '右上角'; + + @override + String get distortionBottomRight => '右下角'; + + @override + String get distortionBottomLeft => '左下角'; } /// The translations for Chinese, using the Han script (`zh_Hans`). @@ -4515,6 +4692,183 @@ class AppLocalizationsZhHans extends AppLocalizationsZh { @override String get cornerBottomLeft => '左下圆角'; + + @override + String get effects => '效果'; + + @override + String get addEffect => '添加效果'; + + @override + String get dropShadow => '外阴影'; + + @override + String get innerShadow => '内阴影'; + + @override + String get layerBlur => '图层模糊'; + + @override + String get backgroundBlur => '背景模糊'; + + @override + String get glassEffect => '玻璃'; + + @override + String get noiseEffect => '噪点'; + + @override + String get textureEffect => '纹理'; + + @override + String get updateEffectFailed => '无法更新效果'; + + @override + String get effectBlurEnd => '结束模糊'; + + @override + String get effectProgressive => '渐进'; + + @override + String get effectUniform => '均匀'; + + @override + String get effectLightAngle => '光照角度'; + + @override + String get effectLightIntensity => '光照强度'; + + @override + String get effectRefraction => '折射'; + + @override + String get effectDepth => '深度'; + + @override + String get effectDispersion => '色散'; + + @override + String get effectFrost => '磨砂'; + + @override + String get effectSplay => '光照扩散'; + + @override + String get effectNoiseMode => '噪点颜色'; + + @override + String get effectMono => '单色'; + + @override + String get effectDuo => '双色'; + + @override + String get effectMulti => '多色'; + + @override + String get effectNoiseSize => '颗粒大小'; + + @override + String get effectDensity => '密度'; + + @override + String get effectSecondColor => '第二颜色'; + + @override + String get effectTextureRadius => '扰动半径'; + + @override + String get effectClipToShape => '裁剪到形状'; + + @override + String get effectSeed => '随机种子'; + + @override + String get effectStartX => '起点 X'; + + @override + String get effectStartY => '起点 Y'; + + @override + String get effectEndX => '终点 X'; + + @override + String get effectEndY => '终点 Y'; + + @override + String get effectMoveUp => '上移效果'; + + @override + String get effectMoveDown => '下移效果'; + + @override + String get strokes => '描边'; + + @override + String get stroke => '描边'; + + @override + String get addStroke => '添加描边'; + + @override + String get updateStrokeFailed => '无法更新描边'; + + @override + String get strokeWidth => '粗细'; + + @override + String get strokeInside => '内侧'; + + @override + String get strokeCenter => '居中'; + + @override + String get strokeOutside => '外侧'; + + @override + String get strokeStyle => '样式'; + + @override + String get strokeSolid => '实线'; + + @override + String get strokeDashed => '虚线'; + + @override + String get strokeDashLength => '线段长度'; + + @override + String get strokeDashGap => '间隔'; + + @override + String get distortion => '变形'; + + @override + String get editDistortion => '编辑变形'; + + @override + String get finishDistortion => '完成变形'; + + @override + String get resetDistortion => '重置变形'; + + @override + String get freeDistortion => '自由'; + + @override + String get perspectiveDistortion => '透视联动'; + + @override + String get distortionTopLeft => '左上角'; + + @override + String get distortionTopRight => '右上角'; + + @override + String get distortionBottomRight => '右下角'; + + @override + String get distortionBottomLeft => '左下角'; } /// The translations for Chinese, using the Han script (`zh_Hant`). @@ -6771,4 +7125,181 @@ class AppLocalizationsZhHant extends AppLocalizationsZh { @override String get cornerBottomLeft => '左下圓角'; + + @override + String get effects => '效果'; + + @override + String get addEffect => '添加效果'; + + @override + String get dropShadow => '外阴影'; + + @override + String get innerShadow => '内阴影'; + + @override + String get layerBlur => '图层模糊'; + + @override + String get backgroundBlur => '背景模糊'; + + @override + String get glassEffect => '玻璃'; + + @override + String get noiseEffect => '噪点'; + + @override + String get textureEffect => '纹理'; + + @override + String get updateEffectFailed => '无法更新效果'; + + @override + String get effectBlurEnd => '结束模糊'; + + @override + String get effectProgressive => '渐进'; + + @override + String get effectUniform => '均匀'; + + @override + String get effectLightAngle => '光照角度'; + + @override + String get effectLightIntensity => '光照强度'; + + @override + String get effectRefraction => '折射'; + + @override + String get effectDepth => '深度'; + + @override + String get effectDispersion => '色散'; + + @override + String get effectFrost => '磨砂'; + + @override + String get effectSplay => '光照扩散'; + + @override + String get effectNoiseMode => '噪点颜色'; + + @override + String get effectMono => '单色'; + + @override + String get effectDuo => '双色'; + + @override + String get effectMulti => '多色'; + + @override + String get effectNoiseSize => '颗粒大小'; + + @override + String get effectDensity => '密度'; + + @override + String get effectSecondColor => '第二颜色'; + + @override + String get effectTextureRadius => '扰动半径'; + + @override + String get effectClipToShape => '裁剪到形状'; + + @override + String get effectSeed => '随机种子'; + + @override + String get effectStartX => '起点 X'; + + @override + String get effectStartY => '起点 Y'; + + @override + String get effectEndX => '终点 X'; + + @override + String get effectEndY => '终点 Y'; + + @override + String get effectMoveUp => '上移效果'; + + @override + String get effectMoveDown => '下移效果'; + + @override + String get strokes => '描邊'; + + @override + String get stroke => '描邊'; + + @override + String get addStroke => '新增描邊'; + + @override + String get updateStrokeFailed => '無法更新描邊'; + + @override + String get strokeWidth => '粗細'; + + @override + String get strokeInside => '內側'; + + @override + String get strokeCenter => '置中'; + + @override + String get strokeOutside => '外側'; + + @override + String get strokeStyle => '樣式'; + + @override + String get strokeSolid => '實線'; + + @override + String get strokeDashed => '虛線'; + + @override + String get strokeDashLength => '線段長度'; + + @override + String get strokeDashGap => '間隔'; + + @override + String get distortion => '變形'; + + @override + String get editDistortion => '編輯變形'; + + @override + String get finishDistortion => '完成變形'; + + @override + String get resetDistortion => '重設變形'; + + @override + String get freeDistortion => '自由'; + + @override + String get perspectiveDistortion => '透視連動'; + + @override + String get distortionTopLeft => '左上角'; + + @override + String get distortionTopRight => '右上角'; + + @override + String get distortionBottomRight => '右下角'; + + @override + String get distortionBottomLeft => '左下角'; } diff --git a/lib/l10n/app_pt.arb b/lib/l10n/app_pt.arb index 15add09..1311452 100644 --- a/lib/l10n/app_pt.arb +++ b/lib/l10n/app_pt.arb @@ -14,7 +14,6 @@ "agentUntitledConversation": "Nova conversa", "agentConversationActions": "Ações da conversa", "agentElapsedTime": "Duração {duration}", - "agentConversationActions": "Ações da conversa", "agentMoveToTrash": "Mover para a lixeira", "agentTrash": "Lixeira", "agentRestore": "Restaurar", @@ -955,5 +954,64 @@ "cornerTopLeft": "Raio superior esquerdo", "cornerTopRight": "Raio superior direito", "cornerBottomRight": "Raio inferior direito", - "cornerBottomLeft": "Raio inferior esquerdo" + "cornerBottomLeft": "Raio inferior esquerdo", + "effects": "Effects", + "addEffect": "Add effect", + "dropShadow": "Drop shadow", + "innerShadow": "Inner shadow", + "layerBlur": "Layer blur", + "backgroundBlur": "Background blur", + "glassEffect": "Glass", + "noiseEffect": "Noise", + "textureEffect": "Texture", + "updateEffectFailed": "Could not update effect", + "effectBlurEnd": "End blur", + "effectProgressive": "Progressive", + "effectUniform": "Uniform", + "effectLightAngle": "Light angle", + "effectLightIntensity": "Light intensity", + "effectRefraction": "Refraction", + "effectDepth": "Depth", + "effectDispersion": "Dispersion", + "effectFrost": "Frost", + "effectSplay": "Splay", + "effectNoiseMode": "Noise colors", + "effectMono": "Mono", + "effectDuo": "Duo", + "effectMulti": "Multi", + "effectNoiseSize": "Size", + "effectDensity": "Density", + "effectSecondColor": "Second color", + "effectTextureRadius": "Radius", + "effectClipToShape": "Clip to shape", + "effectSeed": "Seed", + "effectStartX": "Start X", + "effectStartY": "Start Y", + "effectEndX": "End X", + "effectEndY": "End Y", + "effectMoveUp": "Move effect up", + "effectMoveDown": "Move effect down", + "strokes": "Traços", + "stroke": "Traço", + "addStroke": "Adicionar traço", + "updateStrokeFailed": "Não foi possível atualizar o traço", + "strokeWidth": "Espessura", + "strokeInside": "Interior", + "strokeCenter": "Centro", + "strokeOutside": "Exterior", + "strokeStyle": "Estilo", + "strokeSolid": "Contínuo", + "strokeDashed": "Tracejado", + "strokeDashLength": "Comprimento", + "strokeDashGap": "Espaçamento", + "distortion": "Distorção", + "editDistortion": "Editar distorção", + "finishDistortion": "Concluir distorção", + "resetDistortion": "Redefinir distorção", + "freeDistortion": "Livre", + "perspectiveDistortion": "Perspectiva", + "distortionTopLeft": "Superior esquerdo", + "distortionTopRight": "Superior direito", + "distortionBottomRight": "Inferior direito", + "distortionBottomLeft": "Inferior esquerdo" } diff --git a/lib/l10n/app_ru.arb b/lib/l10n/app_ru.arb index 6a07a7a..471de30 100644 --- a/lib/l10n/app_ru.arb +++ b/lib/l10n/app_ru.arb @@ -12,9 +12,8 @@ "showFewerConversations": "Показать меньше", "agentNewConversation": "Новый диалог", "agentUntitledConversation": "Новый чат", - "agentConversationActions": "Действия с чатом", - "agentElapsedTime": "Время {duration}", "agentConversationActions": "Действия с диалогом", + "agentElapsedTime": "Время {duration}", "agentMoveToTrash": "Переместить в корзину", "agentTrash": "Корзина", "agentRestore": "Восстановить", @@ -955,5 +954,64 @@ "cornerTopLeft": "Радиус слева сверху", "cornerTopRight": "Радиус справа сверху", "cornerBottomRight": "Радиус справа снизу", - "cornerBottomLeft": "Радиус слева снизу" + "cornerBottomLeft": "Радиус слева снизу", + "effects": "Effects", + "addEffect": "Add effect", + "dropShadow": "Drop shadow", + "innerShadow": "Inner shadow", + "layerBlur": "Layer blur", + "backgroundBlur": "Background blur", + "glassEffect": "Glass", + "noiseEffect": "Noise", + "textureEffect": "Texture", + "updateEffectFailed": "Could not update effect", + "effectBlurEnd": "End blur", + "effectProgressive": "Progressive", + "effectUniform": "Uniform", + "effectLightAngle": "Light angle", + "effectLightIntensity": "Light intensity", + "effectRefraction": "Refraction", + "effectDepth": "Depth", + "effectDispersion": "Dispersion", + "effectFrost": "Frost", + "effectSplay": "Splay", + "effectNoiseMode": "Noise colors", + "effectMono": "Mono", + "effectDuo": "Duo", + "effectMulti": "Multi", + "effectNoiseSize": "Size", + "effectDensity": "Density", + "effectSecondColor": "Second color", + "effectTextureRadius": "Radius", + "effectClipToShape": "Clip to shape", + "effectSeed": "Seed", + "effectStartX": "Start X", + "effectStartY": "Start Y", + "effectEndX": "End X", + "effectEndY": "End Y", + "effectMoveUp": "Move effect up", + "effectMoveDown": "Move effect down", + "strokes": "Обводки", + "stroke": "Обводка", + "addStroke": "Добавить обводку", + "updateStrokeFailed": "Не удалось обновить обводку", + "strokeWidth": "Толщина", + "strokeInside": "Внутри", + "strokeCenter": "По центру", + "strokeOutside": "Снаружи", + "strokeStyle": "Стиль", + "strokeSolid": "Сплошная", + "strokeDashed": "Пунктирная", + "strokeDashLength": "Длина штриха", + "strokeDashGap": "Интервал", + "distortion": "Искажение", + "editDistortion": "Изменить искажение", + "finishDistortion": "Завершить искажение", + "resetDistortion": "Сбросить искажение", + "freeDistortion": "Свободно", + "perspectiveDistortion": "Перспектива", + "distortionTopLeft": "Верхний левый", + "distortionTopRight": "Верхний правый", + "distortionBottomRight": "Нижний правый", + "distortionBottomLeft": "Нижний левый" } diff --git a/lib/l10n/app_zh.arb b/lib/l10n/app_zh.arb index b988e29..7e5ff7c 100644 --- a/lib/l10n/app_zh.arb +++ b/lib/l10n/app_zh.arb @@ -27,9 +27,8 @@ "showFewerConversations": "收起显示", "agentNewConversation": "新建对话", "agentUntitledConversation": "新聊天", - "agentConversationActions": "聊天操作", - "agentElapsedTime": "用时 {duration}", "agentConversationActions": "对话操作", + "agentElapsedTime": "用时 {duration}", "agentMoveToTrash": "移至回收区", "agentTrash": "回收区", "agentRestore": "恢复", @@ -955,5 +954,64 @@ "cornerTopLeft": "左上圆角", "cornerTopRight": "右上圆角", "cornerBottomRight": "右下圆角", - "cornerBottomLeft": "左下圆角" + "cornerBottomLeft": "左下圆角", + "effects": "效果", + "addEffect": "添加效果", + "dropShadow": "外阴影", + "innerShadow": "内阴影", + "layerBlur": "图层模糊", + "backgroundBlur": "背景模糊", + "glassEffect": "玻璃", + "noiseEffect": "噪点", + "textureEffect": "纹理", + "updateEffectFailed": "无法更新效果", + "effectBlurEnd": "结束模糊", + "effectProgressive": "渐进", + "effectUniform": "均匀", + "effectLightAngle": "光照角度", + "effectLightIntensity": "光照强度", + "effectRefraction": "折射", + "effectDepth": "深度", + "effectDispersion": "色散", + "effectFrost": "磨砂", + "effectSplay": "光照扩散", + "effectNoiseMode": "噪点颜色", + "effectMono": "单色", + "effectDuo": "双色", + "effectMulti": "多色", + "effectNoiseSize": "颗粒大小", + "effectDensity": "密度", + "effectSecondColor": "第二颜色", + "effectTextureRadius": "扰动半径", + "effectClipToShape": "裁剪到形状", + "effectSeed": "随机种子", + "effectStartX": "起点 X", + "effectStartY": "起点 Y", + "effectEndX": "终点 X", + "effectEndY": "终点 Y", + "effectMoveUp": "上移效果", + "effectMoveDown": "下移效果", + "strokes": "描边", + "stroke": "描边", + "addStroke": "添加描边", + "updateStrokeFailed": "无法更新描边", + "strokeWidth": "粗细", + "strokeInside": "内侧", + "strokeCenter": "居中", + "strokeOutside": "外侧", + "strokeStyle": "样式", + "strokeSolid": "实线", + "strokeDashed": "虚线", + "strokeDashLength": "线段长度", + "strokeDashGap": "间隔", + "distortion": "变形", + "editDistortion": "编辑变形", + "finishDistortion": "完成变形", + "resetDistortion": "重置变形", + "freeDistortion": "自由", + "perspectiveDistortion": "透视联动", + "distortionTopLeft": "左上角", + "distortionTopRight": "右上角", + "distortionBottomRight": "右下角", + "distortionBottomLeft": "左下角" } diff --git a/lib/l10n/app_zh_Hans.arb b/lib/l10n/app_zh_Hans.arb index 04521cf..be47e1f 100644 --- a/lib/l10n/app_zh_Hans.arb +++ b/lib/l10n/app_zh_Hans.arb @@ -27,9 +27,8 @@ "showFewerConversations": "收起显示", "agentNewConversation": "新建对话", "agentUntitledConversation": "新聊天", - "agentConversationActions": "聊天操作", - "agentElapsedTime": "用时 {duration}", "agentConversationActions": "对话操作", + "agentElapsedTime": "用时 {duration}", "agentMoveToTrash": "移至回收区", "agentTrash": "回收区", "agentRestore": "恢复", @@ -955,5 +954,64 @@ "cornerTopLeft": "左上圆角", "cornerTopRight": "右上圆角", "cornerBottomRight": "右下圆角", - "cornerBottomLeft": "左下圆角" + "cornerBottomLeft": "左下圆角", + "effects": "效果", + "addEffect": "添加效果", + "dropShadow": "外阴影", + "innerShadow": "内阴影", + "layerBlur": "图层模糊", + "backgroundBlur": "背景模糊", + "glassEffect": "玻璃", + "noiseEffect": "噪点", + "textureEffect": "纹理", + "updateEffectFailed": "无法更新效果", + "effectBlurEnd": "结束模糊", + "effectProgressive": "渐进", + "effectUniform": "均匀", + "effectLightAngle": "光照角度", + "effectLightIntensity": "光照强度", + "effectRefraction": "折射", + "effectDepth": "深度", + "effectDispersion": "色散", + "effectFrost": "磨砂", + "effectSplay": "光照扩散", + "effectNoiseMode": "噪点颜色", + "effectMono": "单色", + "effectDuo": "双色", + "effectMulti": "多色", + "effectNoiseSize": "颗粒大小", + "effectDensity": "密度", + "effectSecondColor": "第二颜色", + "effectTextureRadius": "扰动半径", + "effectClipToShape": "裁剪到形状", + "effectSeed": "随机种子", + "effectStartX": "起点 X", + "effectStartY": "起点 Y", + "effectEndX": "终点 X", + "effectEndY": "终点 Y", + "effectMoveUp": "上移效果", + "effectMoveDown": "下移效果", + "strokes": "描边", + "stroke": "描边", + "addStroke": "添加描边", + "updateStrokeFailed": "无法更新描边", + "strokeWidth": "粗细", + "strokeInside": "内侧", + "strokeCenter": "居中", + "strokeOutside": "外侧", + "strokeStyle": "样式", + "strokeSolid": "实线", + "strokeDashed": "虚线", + "strokeDashLength": "线段长度", + "strokeDashGap": "间隔", + "distortion": "变形", + "editDistortion": "编辑变形", + "finishDistortion": "完成变形", + "resetDistortion": "重置变形", + "freeDistortion": "自由", + "perspectiveDistortion": "透视联动", + "distortionTopLeft": "左上角", + "distortionTopRight": "右上角", + "distortionBottomRight": "右下角", + "distortionBottomLeft": "左下角" } diff --git a/lib/l10n/app_zh_Hant.arb b/lib/l10n/app_zh_Hant.arb index 064ea76..5a4c65c 100644 --- a/lib/l10n/app_zh_Hant.arb +++ b/lib/l10n/app_zh_Hant.arb @@ -27,9 +27,8 @@ "showFewerConversations": "收起顯示", "agentNewConversation": "新增對話", "agentUntitledConversation": "新聊天", - "agentConversationActions": "聊天操作", - "agentElapsedTime": "耗時 {duration}", "agentConversationActions": "對話操作", + "agentElapsedTime": "耗時 {duration}", "agentMoveToTrash": "移至資源回收桶", "agentTrash": "資源回收桶", "agentRestore": "還原", @@ -955,5 +954,64 @@ "cornerTopLeft": "左上圓角", "cornerTopRight": "右上圓角", "cornerBottomRight": "右下圓角", - "cornerBottomLeft": "左下圓角" + "cornerBottomLeft": "左下圓角", + "effects": "效果", + "addEffect": "添加效果", + "dropShadow": "外阴影", + "innerShadow": "内阴影", + "layerBlur": "图层模糊", + "backgroundBlur": "背景模糊", + "glassEffect": "玻璃", + "noiseEffect": "噪点", + "textureEffect": "纹理", + "updateEffectFailed": "无法更新效果", + "effectBlurEnd": "结束模糊", + "effectProgressive": "渐进", + "effectUniform": "均匀", + "effectLightAngle": "光照角度", + "effectLightIntensity": "光照强度", + "effectRefraction": "折射", + "effectDepth": "深度", + "effectDispersion": "色散", + "effectFrost": "磨砂", + "effectSplay": "光照扩散", + "effectNoiseMode": "噪点颜色", + "effectMono": "单色", + "effectDuo": "双色", + "effectMulti": "多色", + "effectNoiseSize": "颗粒大小", + "effectDensity": "密度", + "effectSecondColor": "第二颜色", + "effectTextureRadius": "扰动半径", + "effectClipToShape": "裁剪到形状", + "effectSeed": "随机种子", + "effectStartX": "起点 X", + "effectStartY": "起点 Y", + "effectEndX": "终点 X", + "effectEndY": "终点 Y", + "effectMoveUp": "上移效果", + "effectMoveDown": "下移效果", + "strokes": "描邊", + "stroke": "描邊", + "addStroke": "新增描邊", + "updateStrokeFailed": "無法更新描邊", + "strokeWidth": "粗細", + "strokeInside": "內側", + "strokeCenter": "置中", + "strokeOutside": "外側", + "strokeStyle": "樣式", + "strokeSolid": "實線", + "strokeDashed": "虛線", + "strokeDashLength": "線段長度", + "strokeDashGap": "間隔", + "distortion": "變形", + "editDistortion": "編輯變形", + "finishDistortion": "完成變形", + "resetDistortion": "重設變形", + "freeDistortion": "自由", + "perspectiveDistortion": "透視連動", + "distortionTopLeft": "左上角", + "distortionTopRight": "右上角", + "distortionBottomRight": "右下角", + "distortionBottomLeft": "左下角" } diff --git a/packages/cutdex_ui/lib/src/widgets/app_menu.dart b/packages/cutdex_ui/lib/src/widgets/app_menu.dart index b63938f..5184b88 100644 --- a/packages/cutdex_ui/lib/src/widgets/app_menu.dart +++ b/packages/cutdex_ui/lib/src/widgets/app_menu.dart @@ -146,6 +146,7 @@ class AppMenuItem extends StatefulWidget { this.destructive = false, this.selectOption = false, this.requestFocusOnHover = true, + this.closeAncestors = true, }); final String label; final String? description; @@ -156,6 +157,9 @@ class AppMenuItem extends StatefulWidget { final bool selectOption; final bool requestFocusOnHover; + /// False closes this menu while retaining an enclosing property popover. + final bool closeAncestors; + @override State createState() => _AppMenuItemState(); } @@ -191,7 +195,15 @@ class _AppMenuItemState extends State { } _focusFromHover = hovered; }, - onPressed: widget.onPressed, + closeOnActivate: widget.closeAncestors, + onPressed: widget.onPressed == null + ? null + : () { + if (!widget.closeAncestors) { + MenuController.maybeOf(context)?.close(); + } + widget.onPressed!(); + }, style: widget.description != null ? AppMenuStyle.descriptionItem( context, @@ -427,6 +439,7 @@ class AppSelect extends StatelessWidget { this.searchable = false, this.controlHeight, this.textStyle, + this.closeAncestors = true, }) : assert(!searchable || searchHint != null); final T value; final List> options; @@ -438,6 +451,7 @@ class AppSelect extends StatelessWidget { final bool searchable; final double? controlHeight; final TextStyle? textStyle; + final bool closeAncestors; @override Widget build(BuildContext context) => searchable @@ -473,6 +487,7 @@ class AppSelect extends StatelessWidget { label: option.label, selected: option.value == value, selectOption: true, + closeAncestors: closeAncestors, onPressed: onChanged == null || !option.enabled ? null : () => onChanged!(option.value), diff --git a/test/compact_inspector_test.dart b/test/compact_inspector_test.dart index f537bb5..a04832d 100644 --- a/test/compact_inspector_test.dart +++ b/test/compact_inspector_test.dart @@ -210,7 +210,8 @@ void main() { expect(tester.getRect(input('x')).left, 16); expect(tester.getRect(input('x')).width, (width - 64) / 2); expect(tester.getRect(input('rotation')).width, (width - 64) / 2); - expect(find.byType(AppPropertyGroup), findsNWidgets(4)); + expect(find.byType(AppPropertyGroup), findsNWidgets(6)); + expect(find.byKey(const ValueKey('stroke-add')), findsOneWidget); expect( tester.getRect(input('corner-radius')).width, (width - 64) / 2, diff --git a/test/picture_distortion_test.dart b/test/picture_distortion_test.dart new file mode 100644 index 0000000..5c66542 --- /dev/null +++ b/test/picture_distortion_test.dart @@ -0,0 +1,123 @@ +import 'package:cutdex/app/editor_theme.dart'; +import 'package:cutdex/features/preview/preview_panel.dart'; +import 'package:cutdex/features/properties/distortion_properties.dart'; +import 'package:cutdex/l10n/app_localizations.dart'; +import 'package:cutdex_sdk/editor.dart'; +import 'package:cutdex_sdk/timeline/model.dart'; +import 'package:cutdex_sdk/timeline/engine.dart'; +import 'package:cutdex_ui/theme.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:flutter_test/flutter_test.dart'; + +import 'support/preview_fixture.dart'; + +void main() { + testWidgets( + 'four corner fields use paired keys; reset preserves animation; no px', + (tester) async { + final f = (await tester.runAsync( + () => createPreviewFixture( + Uri.file('/test/video.mov'), + clipDuration: RationalTime.seconds(5), + ), + ))!; + addTearDown( + () => tester.runAsync(() async { + await f.workspace.close(); + await f.directory.delete(recursive: true); + }), + ); + final sequence = SequenceId('one'), + clip = ElementId('clip'), + project = f.workspace.project!.info.id; + final view = f.timeline.view(sequence); + ElementRecord record() { + final q = view.version.kernelVersion.query(); + return q.element(q.elementById(clip)!); + } + + await tester.pumpWidget( + ProviderScope( + overrides: [ + editorPreviewProvider( + project, + 'project', + ).overrideWith((ref) => null), + ], + child: MaterialApp( + localizationsDelegates: AppLocalizations.localizationsDelegates, + supportedLocales: AppLocalizations.supportedLocales, + locale: const Locale('zh'), + theme: AppTheme.propertiesPanelTheme( + EditorTheme.desktop(EditorTheme.penDark), + ), + home: Scaffold( + body: Align( + alignment: Alignment.topRight, + child: SizedBox( + width: 240, + child: SingleChildScrollView( + child: DistortionProperties( + projectId: project, + timelineId: 'project', + session: f.timeline, + sequence: sequence, + clip: clip, + ), + ), + ), + ), + ), + ), + ), + ); + Future settle() async { + await tester.pump(); + await tester.runAsync(f.timeline.flush); + await tester.pumpAndSettle(); + expect(tester.takeException(), isNull); + } + + await settle(); + expect(find.text('变形'), findsOneWidget); + expect(find.text('px'), findsNothing); + expect(find.text('X'), findsNWidgets(4)); + expect(find.text('Y'), findsNWidgets(4)); + expect(find.byType(TextField), findsNWidgets(8)); + final key = find.byKey(const ValueKey('distortion-topLeft-key')); + await tester.tap(key); + await settle(); + for (final id in ClipDistortion.ids.take(2)) { + expect(record().parameters![id]!.length, 1); + } + view.seekTo(TimelineClock.ticksPerSecond); + await settle(); + final input = find.descendant( + of: find.byKey(const ValueKey('distortion-topLeft-y')), + matching: find.byType(TextField), + ); + await tester.enterText(input, '20'); + await tester.testTextInput.receiveAction(TextInputAction.done); + await settle(); + for (final id in ClipDistortion.ids.take(2)) { + expect(record().parameters![id]!.length, 2); + } + final y = record().parameters![ClipDistortion.ids[1]]!; + expect(y.valueAt(TimelineClock.ticksPerSecond), greaterThan(0)); + for (final id in ClipDistortion.ids.skip(2)) { + expect(record().parameters?[id]?.length ?? 0, 0); + } + await tester.tap(find.byKey(const ValueKey('distortion-reset'))); + await settle(); + expect(record().parameters![ClipDistortion.ids[1]]!.length, 2); + expect( + record().parameters![ClipDistortion.ids[1]]!.valueAt( + TimelineClock.ticksPerSecond, + ), + 0, + ); + await tester.pumpWidget(const SizedBox()); + }, + ); +} diff --git a/test/picture_edits_test.dart b/test/picture_edits_test.dart new file mode 100644 index 0000000..f3e611a --- /dev/null +++ b/test/picture_edits_test.dart @@ -0,0 +1,139 @@ +import 'dart:async'; + +import 'package:cutdex/features/properties/picture_edits.dart'; +import 'package:cutdex_sdk/editor.dart'; +import 'package:cutdex_sdk/preview.dart'; +import 'package:cutdex_sdk/runtime.dart'; +import 'package:cutdex_sdk/timeline/model.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:flutter_test/flutter_test.dart'; + +import 'support/preview_fixture.dart'; + +void main() { + TestWidgetsFlutterBinding.ensureInitialized(); + for (final invalidation in [ + 'dispose', + 'seek', + 'version', + 'sequence', + 'selection', + ]) { + test( + 'picture edit cannot publish after $invalidation during pause', + () async { + final f = await createPreviewFixture(Uri.file('/test/video.mov')); + final preview = _PausedPreview( + timeline: f.timeline, + runtime: CutdexRuntime(), + activeSequence: () => f.timeline.activeSequenceId, + viewForSequence: f.timeline.view, + ); + final container = ProviderContainer(); + var disposed = false; + addTearDown(() async { + if (!disposed) container.dispose(); + await preview.close(); + await f.workspace.close(); + await f.directory.delete(recursive: true); + }); + final sequence = SequenceId('one'), clip = ElementId('clip'); + final provider = pictureEditsProvider(f.timeline, sequence, clip); + container.listen(provider, (_, _) {}); + final edits = container.read(provider.notifier); + var current = true; + var applied = 0; + final pending = edits.commit(preview, (value) { + applied++; + return value.copyWith(x: .25); + }, isCurrent: () => current); + expect(container.read(provider).isLoading, isTrue); + switch (invalidation) { + case 'dispose': + container.dispose(); + disposed = true; + case 'seek': + f.timeline.view(sequence).seekTo(1); + case 'version': + f.timeline.commands.addEffect( + sequence: sequence, + clip: clip, + tick: 0, + effectId: 'external', + type: ClipEffectType.dropShadow, + ); + case 'sequence': + f.timeline.selectSequence(SequenceId('empty')); + case 'selection': + current = false; + } + preview.paused.complete(); + expect(await pending, isFalse); + expect(applied, 0); + if (!disposed) expect(container.read(provider).hasError, isFalse); + }, + ); + } + + test( + 'picture keys wait for the input commit and record its new value', + () async { + final f = await createPreviewFixture(Uri.file('/test/video.mov')); + final preview = _PausedPreview( + timeline: f.timeline, + runtime: CutdexRuntime(), + activeSequence: () => f.timeline.activeSequenceId, + viewForSequence: f.timeline.view, + ); + final container = ProviderContainer(); + addTearDown(() async { + container.dispose(); + await preview.close(); + await f.workspace.close(); + await f.directory.delete(recursive: true); + }); + final provider = pictureEditsProvider( + f.timeline, + SequenceId('one'), + ElementId('clip'), + ); + container.listen(provider, (_, _) {}); + final edits = container.read(provider.notifier); + final commit = edits.commit( + preview, + (v) => v.copyWith(x: .25), + isCurrent: () => true, + ); + expect( + await edits.commit( + preview, + (v) => v.copyWith(x: .75), + isCurrent: () => true, + ), + isFalse, + ); + final keys = edits.editKeys( + preview, + TransformChannel.position, + isCurrent: () => true, + ); + preview.paused.complete(); + expect(await commit, isTrue); + await keys; + expect(edits.animation()!.value.x, .25); + expect(edits.animation()!.keyed(TransformChannel.position), isTrue); + }, + ); +} + +class _PausedPreview extends PreviewController { + _PausedPreview({ + required super.timeline, + required super.runtime, + required super.activeSequence, + required super.viewForSequence, + }); + final paused = Completer(); + @override + Future pauseForCanvasInteraction() => paused.future; +} diff --git a/test/picture_effect_test.dart b/test/picture_effect_test.dart new file mode 100644 index 0000000..ed7d6bd --- /dev/null +++ b/test/picture_effect_test.dart @@ -0,0 +1,199 @@ +import 'package:cutdex/app/editor_theme.dart'; +import 'package:cutdex/features/preview/preview_panel.dart'; +import 'package:cutdex/features/properties/effect_properties.dart'; +import 'package:cutdex/features/properties/effect_labels.dart'; +import 'package:cutdex/l10n/app_localizations.dart'; +import 'package:cutdex_sdk/editor.dart'; +import 'package:cutdex_sdk/timeline/model.dart'; +import 'package:cutdex_ui/theme.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:flutter_test/flutter_test.dart'; + +import 'support/preview_fixture.dart'; + +void main() { + testWidgets( + 'blur input and keyframe control edit only the selected property', + (tester) async { + final f = (await tester.runAsync( + () => createPreviewFixture( + Uri.file('/test/video.mov'), + clipDuration: RationalTime.seconds(5), + ), + ))!; + addTearDown( + () => tester.runAsync(() async { + await f.workspace.close(); + await f.directory.delete(recursive: true); + }), + ); + final sequence = SequenceId('one'), clip = ElementId('clip'); + final view = f.timeline.view(sequence); + final commands = f.timeline.commands; + ClipEffectStack current() { + final query = view.version.kernelVersion.query(); + final handle = query.elementById(clip)!; + return ClipEffectStack( + query.element(handle), + view.playheadTick - query.absoluteStart(handle), + ); + } + + for (final id in ['a', 'b']) { + commands.addEffect( + sequence: sequence, + clip: clip, + tick: 0, + effectId: id, + type: ClipEffectType.dropShadow, + ); + } + final project = f.workspace.project!.info.id; + await tester.pumpWidget( + ProviderScope( + overrides: [ + editorPreviewProvider( + project, + 'project', + ).overrideWith((ref) => null), + ], + child: MaterialApp( + localizationsDelegates: AppLocalizations.localizationsDelegates, + supportedLocales: AppLocalizations.supportedLocales, + locale: const Locale('zh'), + theme: AppTheme.propertiesPanelTheme( + EditorTheme.desktop(EditorTheme.penDark), + ), + home: Scaffold( + body: Align( + alignment: Alignment.topRight, + child: SizedBox( + width: 240, + child: SingleChildScrollView( + child: EffectProperties( + projectId: project, + timelineId: 'project', + session: f.timeline, + sequence: sequence, + clip: clip, + ), + ), + ), + ), + ), + ), + ), + ); + Future settle() async { + await tester.pump(); + await tester.runAsync(f.timeline.flush); + await tester.pumpAndSettle(); + expect(tester.takeException(), isNull); + } + + await settle(); + await tester.tap(find.byKey(const ValueKey('effect-settings-a'))); + await settle(); + await tester.tap(find.byKey(const ValueKey('effect-a-blur-key'))); + await settle(); + final blurId = const EffectParameterTarget('a', 'blur').parameterId; + expect(current().record.parameters?[blurId]?.length, 1); + for (final id in current().parameterIds.where((id) => id != blurId)) { + expect(current().record.parameters?[id]?.length, 0); + } + view.seekTo(TimelineClock.ticksPerSecond); + await settle(); + final input = find.descendant( + of: find.byKey(const ValueKey('effect-a-blur')), + matching: find.byType(TextField), + ); + await tester.enterText(input, '20'); + await tester.testTextInput.receiveAction(TextInputAction.done); + await settle(); + expect(current().record.parameters?[blurId]?.length, 2); + expect(current().layers.first.values['blur'], 20); + for (final id in current().parameterIds.where((id) => id != blurId)) { + expect(current().record.parameters?[id]?.length, 0); + } + view.seekTo(TimelineClock.ticksPerSecond ~/ 2); + expect(current().layers.last.values['blur'], 8); + expect(current().layers.first.values['blur'], closeTo(14, .001)); + await settle(); + await tester.pumpWidget(const SizedBox()); + }, + ); + + for (final type in ClipEffectType.values) { + testWidgets('${type.name} exposes valid controls at 240 width', ( + tester, + ) async { + final f = (await tester.runAsync( + () => createPreviewFixture(Uri.file('/test/video.mov')), + ))!; + addTearDown( + () => tester.runAsync(() async { + await f.workspace.close(); + await f.directory.delete(recursive: true); + }), + ); + final sequence = SequenceId('one'), clip = ElementId('clip'); + f.timeline.commands.addEffect( + sequence: sequence, + clip: clip, + tick: 0, + effectId: 'test', + type: type, + ); + final project = f.workspace.project!.info.id; + await tester.pumpWidget( + ProviderScope( + overrides: [ + editorPreviewProvider( + project, + 'project', + ).overrideWith((ref) => null), + ], + child: MaterialApp( + localizationsDelegates: AppLocalizations.localizationsDelegates, + supportedLocales: AppLocalizations.supportedLocales, + locale: const Locale('zh'), + theme: AppTheme.propertiesPanelTheme( + EditorTheme.desktop(EditorTheme.penDark), + ), + home: Scaffold( + body: Align( + alignment: Alignment.topRight, + child: SizedBox( + width: 240, + child: SingleChildScrollView( + child: EffectProperties( + projectId: project, + timelineId: 'project', + session: f.timeline, + sequence: sequence, + clip: clip, + ), + ), + ), + ), + ), + ), + ), + ); + await tester.runAsync(f.timeline.flush); + await tester.pumpAndSettle(); + await tester.tap(find.byKey(const ValueKey('effect-settings-test'))); + await tester.runAsync(f.timeline.flush); + await tester.pumpAndSettle(); + expect(find.byKey(const ValueKey('effect-editor-test')), findsOneWidget); + expect( + find.text(type.label(tester.element(find.byType(EffectProperties)))), + findsWidgets, + ); + expect(tester.takeException(), isNull); + await tester.runAsync(f.timeline.flush); + await tester.pumpWidget(const SizedBox()); + }); + } +} diff --git a/test/picture_shadow_test.dart b/test/picture_shadow_test.dart deleted file mode 100644 index 51f2687..0000000 --- a/test/picture_shadow_test.dart +++ /dev/null @@ -1,485 +0,0 @@ -import 'package:cutdex/app/editor_theme.dart'; -import 'package:cutdex/features/preview/preview_panel.dart'; -import 'package:cutdex/features/properties/shadow_properties.dart'; -import 'package:cutdex/features/properties/picture_properties.dart'; -import 'package:cutdex/l10n/app_localizations.dart'; -import 'package:cutdex_sdk/editor.dart'; -import 'package:cutdex_sdk/runtime.dart'; -import 'package:cutdex_sdk/timeline/model.dart'; -import 'package:cutdex_sdk/timeline/engine.dart'; -import 'package:cutdex_ui/theme.dart'; -import 'package:cutdex_ui/widgets.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'package:flutter_test/flutter_test.dart'; - -import 'support/preview_fixture.dart'; - -void main() { - testWidgets( - 'one shadow key captures all layers and structural edits preserve curves', - (tester) async { - final f = (await tester.runAsync( - () => createPreviewFixture( - Uri.file('/test/video.mov'), - clipDuration: RationalTime.seconds(5), - ), - ))!; - addTearDown( - () => tester.runAsync(() async { - await f.workspace.close(); - await f.directory.delete(recursive: true); - }), - ); - final seq = SequenceId('one'); - final clip = ElementId('clip'); - final view = f.timeline.view(seq); - final project = f.workspace.project!.info.id; - ClipShadowStack current() { - final q = view.version.kernelVersion.query(); - final h = q.elementById(clip)!; - return ClipShadowStack( - q.element(h), - view.playheadTick - q.absoluteStart(h), - ); - } - - await tester.pumpWidget( - ProviderScope( - overrides: [ - editorPreviewProvider( - project, - 'project', - ).overrideWith((ref) => null), - ], - child: MaterialApp( - localizationsDelegates: AppLocalizations.localizationsDelegates, - supportedLocales: AppLocalizations.supportedLocales, - locale: const Locale('zh'), - theme: AppTheme.propertiesPanelTheme( - EditorTheme.desktop(EditorTheme.penDark), - ), - home: Scaffold( - body: Align( - alignment: Alignment.topRight, - child: SizedBox( - width: 240, - child: SingleChildScrollView( - child: ShadowProperties( - projectId: project, - timelineId: 'project', - session: f.timeline, - sequence: seq, - clip: clip, - ), - ), - ), - ), - ), - ), - ), - ); - Future settle() async { - await tester.pump(); - await tester.runAsync(f.timeline.flush); - await tester.pumpAndSettle(); - expect(tester.takeException(), isNull); - } - - Future closeEditor() async { - final close = find.byWidgetPredicate( - (w) => - w is IconButton && - w.key is ValueKey && - (w.key! as ValueKey).value.startsWith( - 'shadow-editor-close-', - ), - ); - if (close.evaluate().isNotEmpty) { - await tester.tap(close); - await settle(); - } - } - - Future tap(Key key) async { - await closeEditor(); - final w = find.byKey(key); - await tester.ensureVisible(w); - await tester.tap(w); - await settle(); - } - - Future enter(String id, String field, String value) async { - if (find.byKey(ValueKey('shadow-editor-$id')).evaluate().isEmpty) { - await closeEditor(); - await tester.tap(find.byKey(ValueKey('shadow-settings-$id'))); - await settle(); - } - final input = find.descendant( - of: find.byKey(ValueKey('shadow-$id-$field')), - matching: find.byType(TextField), - ); - await tester.ensureVisible(input); - await tester.enterText(input, value); - await tester.testTextInput.receiveAction(TextInputAction.done); - await settle(); - } - - await settle(); - expect(current().layers, isEmpty); - expect(tester.getSize(find.byType(AppPropertySection)).height, 40); - await tap(const ValueKey('shadow-add')); - final a = current().layers.single.id; - await tap(const ValueKey('shadow-add')); - final b = current().layers.last.id; - expect(find.byType(TextField), findsNothing); - expect( - tester.getSize(find.byKey(ValueKey('shadow-layer-$a'))).height, - 32, - ); - await enter(a, 'x', '12'); - expect( - tester.getSize(find.byKey(ValueKey('shadow-editor-$a'))).width, - 240, - ); - expect( - tester.getRect(find.byKey(ValueKey('shadow-editor-$a'))).right, - lessThan(tester.getRect(find.byKey(ValueKey('shadow-layer-$a'))).left), - ); - final xField = find.descendant( - of: find.byKey(ValueKey('shadow-$a-x')), - matching: find.byType(TextField), - ); - expect(tester.getSize(xField), const Size(100, 24)); - expect( - tester.getSize(find.byKey(ValueKey('shadow-editor-$a'))).height, - 225, - ); - final yField = find.descendant( - of: find.byKey(ValueKey('shadow-$a-y')), - matching: find.byType(TextField), - ); - expect(tester.getRect(yField).left - tester.getRect(xField).right, 8); - final blurInput = find.descendant( - of: find.byKey(ValueKey('shadow-$a-blur')), - matching: find.byType(TextField), - ); - final blurLabel = find.descendant( - of: find.byKey(ValueKey('shadow-$a-blur')), - matching: find.text('模糊'), - ); - final colorLabel = find.descendant( - of: find.byKey(ValueKey('shadow-editor-$a')), - matching: find.text('颜色'), - ); - expect(tester.getSize(blurLabel).height, 16); - expect( - tester.getRect(blurInput).top - tester.getRect(blurLabel).bottom, - 4, - ); - expect(tester.getRect(blurLabel).top - tester.getRect(xField).bottom, 12); - expect( - tester.getRect(colorLabel).top - tester.getRect(blurInput).bottom, - 12, - ); - expect(tester.widget(blurLabel).style!.fontSize, 11); - expect( - tester.widget(blurLabel).style!.color, - Colors.white.withValues(alpha: .7), - ); - expect(tester.widget(xField).style!.fontSize, 11); - await tester.sendKeyEvent(LogicalKeyboardKey.escape); - await settle(); - await tester.sendKeyEvent(LogicalKeyboardKey.escape); - await settle(); - expect(find.byKey(ValueKey('shadow-editor-$a')), findsNothing); - await enter(b, 'blur', '20'); - expect(current().animated, isFalse); - expect(current().layers[0].shadow.x, 12); - expect(current().layers[1].shadow.blur, 20); - await enter(a, 'color', 'FF8800'); - expect(current().layers.first.shadow.red, 1); - expect( - tester.getSize(find.byKey(ValueKey('shadow-$a-color'))).width, - closeTo( - 2 * tester.getSize(find.byKey(ValueKey('shadow-$a-opacity'))).width, - .01, - ), - ); - await tester.tap(find.byKey(const ValueKey('shadow-color-swatch'))); - await settle(); - final plane = tester.getRect( - find.byKey(const ValueKey('shadow-color-plane')), - ); - await tester.tapAt(plane.topCenter + const Offset(0, 2)); - await settle(); - expect(current().layers.first.shadow.blue, greaterThan(.45)); - expect(find.byKey(const ValueKey('shadow-color-plane')), findsOneWidget); - view.undo(); - await settle(); - expect(current().layers.first.shadow.green, closeTo(136 / 255, .001)); - await tester.sendKeyEvent(LogicalKeyboardKey.escape); - await settle(); - expect(find.byKey(const ValueKey('shadow-color-plane')), findsNothing); - await enter(a, 'blur', '-1'); - expect(current().layers.first.shadow.blur, 8); - await tap(const ValueKey('shadow-key')); - expect(current().keyed, isTrue); - expect(current().parameterIds.length, 16); - expect( - current().parameterIds.every( - (id) => current().record.parameters?[id]?.length == 1, - ), - isTrue, - ); - view.seekTo(2 * TimelineClock.ticksPerSecond); - await settle(); - await enter(a, 'x', '32'); - await enter(b, 'blur', '40'); - expect( - current().parameterIds.every( - (id) => current().record.parameters?[id]?.length == 2, - ), - isTrue, - ); - view.seekTo(TimelineClock.ticksPerSecond); - await settle(); - expect(current().layers[0].shadow.x, 22); - expect(current().layers[1].shadow.blur, 30); - final blurField = find.descendant( - of: find.byKey(ValueKey('shadow-$b-blur')), - matching: find.byType(TextField), - ); - expect(tester.widget(blurField).controller!.text, '30'); - view.seekTo(0); - f.timeline.commands.editKeyframeChannel( - sequence: seq, - clip: clip, - tick: 0, - parameterIds: current().parameterIds, - action: KeyframeAction.set, - interpolation: ParameterInterpolation.hold, - ); - view.seekTo(TimelineClock.ticksPerSecond); - await settle(); - expect(current().layers.first.shadow.x, 12); - expect(current().layers.last.shadow.blur, 20); - view.undo(); - await settle(); - expect(current().layers.first.shadow.x, 22); - f.timeline.commands.editKeyframeChannel( - sequence: seq, - clip: clip, - tick: view.playheadTick, - parameterIds: current().parameterIds, - action: KeyframeAction.clear, - ); - await settle(); - expect(current().animated, isFalse); - expect(current().layers.first.shadow.x, 22); - view.undo(); - await settle(); - expect(current().animated, isTrue); - final before = current() - .record - .parameters?[ShadowParameterTarget(a, 'x').parameterId]; - await closeEditor(); - final dragWidget = find.byKey(ValueKey('shadow-drag-$a')); - expect( - tester.widget(dragWidget).enabled, - isTrue, - ); - final drag = tester.getCenter(dragWidget); - final gesture = await tester.startGesture(drag); - await tester.pump(); - await gesture.moveBy(const Offset(0, 12)); - await tester.pump(); - await gesture.moveBy(const Offset(0, 80)); - await tester.pump(const Duration(milliseconds: 300)); - await gesture.up(); - await settle(); - expect(current().layers.map((l) => l.id), [b, a]); - expect( - current().record.parameters?[ShadowParameterTarget(a, 'x').parameterId], - same(before), - ); - await tap(ValueKey('shadow-enabled-$b')); - expect(current().layers.first.enabled, isFalse); - await tap(ValueKey('shadow-remove-$a')); - expect(current().layers.length, 1); - expect( - current().record.parameters?[ShadowParameterTarget(a, 'x').parameterId], - isNull, - ); - view.undo(); - await settle(); - expect(current().layers.length, 2); - expect(current().layers.last.shadow.x, 22); - await tap(const ValueKey('shadow-add')); - final c = current().layers.last.id; - expect( - current() - .record - .parameters?[ShadowParameterTarget(c, 'x').parameterId] - ?.length, - 2, - ); - await tap(const ValueKey('shadow-add')); - expect(current().layers.length, 4); - expect( - tester - .widget(find.byKey(const ValueKey('shadow-add'))) - .onPressed, - isNull, - ); - expect( - () => f.timeline.commands.addShadow( - sequence: seq, - clip: clip, - tick: view.playheadTick, - shadowId: 'fifth', - ), - throwsA(isA()), - ); - await tester.tap(find.byKey(ValueKey('shadow-settings-$a'))); - await settle(); - await tester.tapAt(const Offset(50, 500)); - await settle(); - expect(find.byKey(ValueKey('shadow-editor-$a')), findsNothing); - await tester.tap(find.byKey(ValueKey('shadow-settings-$a'))); - await settle(); - f.timeline.commands.removeShadow( - sequence: seq, - clip: clip, - tick: view.playheadTick, - shadowId: a, - ); - await settle(); - expect(find.byKey(ValueKey('shadow-editor-$a')), findsNothing); - view.undo(); - await settle(); - expect(current().layers.length, 4); - final compiled = const ExecutionCompiler().compile( - ExecutionInput( - timeline: f.timeline.persistence.timeline(seq), - renderSize: RenderSize(64, 64), - media: { - PayloadRef('source'): ExecutionMediaBinding( - media: MediaReference( - id: 'media', - uri: Uri.file('/test/video.mov'), - ), - videoTrackSelection: TrackSelection.index(0), - ), - }, - parameterTargets: ClipTransform.targets, - ), - ); - expect( - compiled.plan.visualLayers.single.automation.map((a) => a.target), - contains(ShadowParameterTarget(a, 'x').parameterId), - ); - expect( - compiled.plan.visualLayers.single.automation - .firstWhere( - (c) => c.target == ShadowParameterTarget(a, 'x').parameterId, - ) - .keys - .length, - 2, - ); - // Existing persistence serializes all curves and feeds execution bindings unchanged. - final saved = await tester.runAsync( - () => f.workspace.project!.loadTimeline('project'), - ); - expect( - saved!.sequences.first.elements.first.parameters.map( - (p) => p.definition.id, - ), - contains(ShadowParameterTarget(a, 'x').parameterId), - ); - await tester.pumpWidget( - ProviderScope( - overrides: [ - editorPreviewProvider( - project, - 'project', - ).overrideWith((ref) => null), - ], - child: MaterialApp( - localizationsDelegates: AppLocalizations.localizationsDelegates, - supportedLocales: AppLocalizations.supportedLocales, - locale: const Locale('zh'), - theme: AppTheme.propertiesPanelTheme( - EditorTheme.desktop(EditorTheme.penDark), - ), - home: Scaffold( - body: SizedBox( - width: 240, - child: SingleChildScrollView( - child: PictureProperties( - projectId: project, - timelineId: 'project', - session: f.timeline, - sequence: seq, - clip: current().record, - animationView: true, - ), - ), - ), - ), - ), - ), - ); - await settle(); - expect( - find.byKey(const ValueKey('picture-key-marker-shadow-0')), - findsOneWidget, - ); - expect( - find.byKey( - const ValueKey( - 'picture-key-marker-shadow-${2 * TimelineClock.ticksPerSecond}', - ), - ), - findsOneWidget, - ); - await tester.pumpWidget(const SizedBox()); - }, - ); - - test( - 'shadow validation and retimed group keys use the existing source clock', - () { - expect(const ClipShadow(blur: -1).isValid, isFalse); - expect(const ClipShadow(opacity: 2).isValid, isFalse); - expect(const ClipShadow(x: double.nan).isValid, isFalse); - expect(RenderShadowTarget.parse('shadow.a.color.r')?.field, 'color.r'); - expect(isRenderVisualTarget('shadow.a.blur'), isTrue); - expect(isRenderVisualTarget('shadow.a.invalid'), isFalse); - expect(ShadowParameterTarget.parse('shadow.中文.x'), isNull); - for (final delta in [8, -8]) { - final record = ElementRecord( - id: ElementId('clip'), - structure: ElementStructure.content, - duration: 4 * TimelineClock.ticksPerSecond, - sourceStart: 10 * TimelineClock.ticksPerSecond, - sourceDuration: 8 * TimelineClock.ticksPerSecond, - enabled: true, - retime: RetimeMapRecord([ - RetimeSegmentRecord( - projectDuration: 4 * TimelineClock.ticksPerSecond, - sourceStart: 10 * TimelineClock.ticksPerSecond, - sourceDelta: delta * TimelineClock.ticksPerSecond, - ), - ]), - ); - expect( - ClipShadowStack(record, TimelineClock.ticksPerSecond).sourceTick, - (10 + delta ~/ 4) * TimelineClock.ticksPerSecond, - ); - } - }, - ); -} diff --git a/test/picture_stroke_test.dart b/test/picture_stroke_test.dart new file mode 100644 index 0000000..c37c0c7 --- /dev/null +++ b/test/picture_stroke_test.dart @@ -0,0 +1,156 @@ +import 'package:cutdex/app/editor_theme.dart'; +import 'package:cutdex/features/preview/preview_panel.dart'; +import 'package:cutdex/features/properties/stroke_properties.dart'; +import 'package:cutdex/l10n/app_localizations.dart'; +import 'package:cutdex_sdk/editor.dart'; +import 'package:cutdex_sdk/timeline/model.dart'; +import 'package:cutdex_ui/theme.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:flutter_test/flutter_test.dart'; + +import 'support/preview_fixture.dart'; + +void main() { + testWidgets( + 'stroke weight input and keyframe control edit only the selected property', + (tester) async { + final f = (await tester.runAsync( + () => createPreviewFixture( + Uri.file('/test/video.mov'), + clipDuration: RationalTime.seconds(5), + ), + ))!; + addTearDown( + () => tester.runAsync(() async { + await f.workspace.close(); + await f.directory.delete(recursive: true); + }), + ); + final sequence = SequenceId('one'), clip = ElementId('clip'); + final view = f.timeline.view(sequence); + final commands = f.timeline.commands; + ClipStrokeStack current() { + final query = view.version.kernelVersion.query(); + final handle = query.elementById(clip)!; + return ClipStrokeStack( + query.element(handle), + view.playheadTick - query.absoluteStart(handle), + ); + } + + for (final id in ['a', 'b']) { + commands.addStroke( + sequence: sequence, + clip: clip, + tick: 0, + strokeId: id, + ); + } + final project = f.workspace.project!.info.id; + await tester.pumpWidget( + ProviderScope( + overrides: [ + editorPreviewProvider( + project, + 'project', + ).overrideWith((ref) => null), + ], + child: MaterialApp( + localizationsDelegates: AppLocalizations.localizationsDelegates, + supportedLocales: AppLocalizations.supportedLocales, + locale: const Locale('zh'), + theme: AppTheme.propertiesPanelTheme( + EditorTheme.desktop(EditorTheme.penDark), + ), + home: Scaffold( + body: Align( + alignment: Alignment.topRight, + child: SizedBox( + width: 240, + child: SingleChildScrollView( + child: StrokeProperties( + projectId: project, + timelineId: 'project', + session: f.timeline, + sequence: sequence, + clip: clip, + ), + ), + ), + ), + ), + ), + ), + ); + Future settle() async { + await tester.pump(); + await tester.runAsync(f.timeline.flush); + await tester.pumpAndSettle(); + expect(tester.takeException(), isNull); + } + + await settle(); + await tester.tap(find.byKey(const ValueKey('stroke-settings-a'))); + await settle(); + await tester.tap(find.byKey(const ValueKey('stroke-a-width-key'))); + await settle(); + final blurId = const StrokeParameterTarget('a', 'width').parameterId; + expect(current().record.parameters?[blurId]?.length, 1); + for (final id in current().parameterIds.where((id) => id != blurId)) { + expect(current().record.parameters?[id]?.length, 0); + } + view.seekTo(TimelineClock.ticksPerSecond); + await settle(); + final input = find.descendant( + of: find.byKey(const ValueKey('stroke-a-width')), + matching: find.byType(TextField), + ); + await tester.enterText(input, '20'); + await tester.testTextInput.receiveAction(TextInputAction.done); + await settle(); + expect(current().record.parameters?[blurId]?.length, 2); + expect(current().layers.first.values['width'], 20); + for (final id in current().parameterIds.where((id) => id != blurId)) { + expect(current().record.parameters?[id]?.length, 0); + } + view.seekTo(TimelineClock.ticksPerSecond ~/ 2); + expect(current().layers.last.values['width'], 1); + expect(current().layers.first.values['width'], closeTo(10.5, .001)); + await settle(); + // Structural selectors and dash fields update statically without keyframe controls. + await tester.tap(find.byKey(const ValueKey('stroke-a-alignment'))); + await settle(); + await tester.tap(find.text('外侧').last); + await settle(); + expect(current().layers.first.alignment, ClipStrokeAlignment.outside); + expect( + find.byKey(const ValueKey('stroke-a-alignment-key')), + findsNothing, + ); + await tester.tap(find.byKey(const ValueKey('stroke-a-style'))); + await settle(); + await tester.tap(find.text('虚线').last); + await settle(); + expect(find.byKey(const ValueKey('stroke-a-dashLength')), findsOneWidget); + expect( + find.byKey(const ValueKey('stroke-a-dashLength-key')), + findsNothing, + ); + expect(find.textContaining('px'), findsNothing); + await tester.tap(find.byKey(const ValueKey('stroke-editor-close-a'))); + await settle(); + await tester.tap(find.byKey(const ValueKey('stroke-enabled-a'))); + await settle(); + expect(current().layers.first.enabled, isFalse); + await tester.tap(find.byKey(const ValueKey('stroke-add'))); + await settle(); + expect(current().layers.length, 3); + await tester.tap(find.byKey(const ValueKey('stroke-remove-a'))); + await settle(); + expect(current().layers.map((l) => l.id), isNot(contains('a'))); + expect(current().record.parameters?[blurId], isNull); + await tester.pumpWidget(const SizedBox()); + }, + ); +} diff --git a/test/preview_controller_test.dart b/test/preview_controller_test.dart index 4ee1387..770cc6a 100644 --- a/test/preview_controller_test.dart +++ b/test/preview_controller_test.dart @@ -209,6 +209,199 @@ void main() { messenger.setMockMethodCallHandler(events, null); }); + test( + 'canvas tools share one owner and reject cleanup from an earlier tool', + () async { + final f = await createPreviewFixture(Uri.file('/test/video.mov')); + final preview = PreviewController( + timeline: f.timeline, + activeSequence: () => f.timeline.activeSequenceId, + viewForSequence: f.timeline.view, + runtime: CutdexRuntime(), + ); + addTearDown(() async { + await preview.close(); + await f.workspace.close(); + await f.directory.delete(recursive: true); + }); + await preview.initialize(); + final clip = ElementId('clip'); + final owner = Object(); + void enter(PreviewCanvasEditMode mode, Object owner) { + switch (mode) { + case PreviewCanvasEditMode.mask: + preview.setMaskEditing(clip, owner: owner); + case PreviewCanvasEditMode.obscure: + preview.setObscureEditing(clip, owner: owner); + case PreviewCanvasEditMode.distortion: + preview.setDistortionEditing(clip, owner: owner, perspective: true); + } + } + + void release(PreviewCanvasEditMode mode, Object owner) { + switch (mode) { + case PreviewCanvasEditMode.mask: + preview.releaseMaskEditing(owner); + case PreviewCanvasEditMode.obscure: + preview.releaseObscureEditing(owner); + case PreviewCanvasEditMode.distortion: + preview.releaseDistortionEditing(owner); + } + } + + for (final previous in PreviewCanvasEditMode.values) { + for (final next in PreviewCanvasEditMode.values) { + enter(previous, owner); + final replacement = Object(); + enter(next, replacement); + release(previous, owner); + expect(preview.canvasEditing!.mode, next); + expect(preview.canvasEditing!.owner, same(replacement)); + expect( + preview.maskEditingElement, + next == PreviewCanvasEditMode.mask ? clip : null, + ); + expect( + preview.obscureEditingElement, + next == PreviewCanvasEditMode.obscure ? clip : null, + ); + expect( + preview.distortionEditingElement, + next == PreviewCanvasEditMode.distortion ? clip : null, + ); + release(next, replacement); + expect(preview.canvasEditing, isNull); + expect(preview.distortionPerspective, isFalse); + } + } + // Even when one widget owns both tools, delayed cleanup is specific to its old mode. + enter(PreviewCanvasEditMode.mask, owner); + enter(PreviewCanvasEditMode.distortion, owner); + preview.releaseMaskEditing(owner); + preview.setMaskEditing(null); + expect(preview.canvasEditing!.mode, PreviewCanvasEditMode.distortion); + var notifications = 0; + preview.addListener(() => notifications++); + enter(PreviewCanvasEditMode.distortion, owner); + expect( + notifications, + 0, + reason: 'Re-entering the same mode must not cancel its gesture', + ); + preview.selectVisual(null); + expect(preview.canvasEditing, isNull); + enter(PreviewCanvasEditMode.obscure, owner); + f.timeline.selectSequence(SequenceId('empty')); + expect(preview.canvasEditing, isNull); + }, + ); + + test( + 'switching canvas tools invalidates a gesture that is still preparing', + () async { + final f = await createPreviewFixture(Uri.file('/test/video.mov')); + final preview = PreviewController( + timeline: f.timeline, + activeSequence: () => f.timeline.activeSequenceId, + viewForSequence: f.timeline.view, + runtime: CutdexRuntime(), + ); + addTearDown(() async { + await preview.close(); + await f.workspace.close(); + await f.directory.delete(recursive: true); + }); + await preview.initialize(); + final clip = ElementId('clip'); + preview.setMaskEditing(clip); + preview.addMask(ClipMaskShape.rectangle); + await until(() => !preview.busy); + preview.cancelTransform(); + blockedTransform = Completer(); + final before = f.timeline.view(SequenceId('one')).version.kernelVersion; + final pending = preview.beginMaskEdit(); + preview.updateMask(preview.maskFor(clip)!.copyWith(x: .75)); + preview.setDistortionEditing(clip); + blockedTransform!.complete(); + expect(await pending, isFalse); + preview.endMaskEdit(); + expect( + f.timeline.view(SequenceId('one')).version.kernelVersion, + same(before), + ); + expect(preview.maskFor(clip)!.x, .5); + expect(preview.canvasEditing!.mode, PreviewCanvasEditMode.distortion); + }, + ); + + test('distortion snapshots replace all eight coordinates and share one undo entry', () async { + final f = await createPreviewFixture(Uri.file('/test/video.mov')); + final preview = PreviewController( + timeline: f.timeline, + activeSequence: () => f.timeline.activeSequenceId, + viewForSequence: f.timeline.view, + runtime: CutdexRuntime(), + ); + addTearDown(() async { + await preview.close(); + await f.workspace.close(); + await f.directory.delete(recursive: true); + }); + await preview.initialize(); + final clip = ElementId('clip'), sequence = SequenceId('one'); + final owner = Object(); + preview.setDistortionEditing(clip, owner: owner); + preview.releaseDistortionEditing(Object()); + expect(preview.distortionEditingElement, clip); + final edit = preview.transforms.begin(preview.visuals.single)!; + await edit.prepared; + const pose = ClipDistortion(topLeft: (.1, .2)); + edit.update(edit.initial.transform.copyWith(distortion: pose)); + await until( + () => calls + .where((c) => c.method == 'updateInteractiveTransform') + .any( + (c) => + ((c.arguments as Map)['transforms'] as List) + .single['distortion'][0] == + .1, + ), + ); + final payload = + ((calls + .lastWhere( + (c) => c.method == 'updateInteractiveTransform', + ) + .arguments + as Map)['transforms'] + as List) + .single + as Map; + expect(payload['distortion'], pose.values); + expect(preview.visuals.single.transform.distortion.same(pose), isTrue); + await edit.end(); + final view = f.timeline.view(sequence); + final q = view.version.kernelVersion.query(); + expect( + ClipTransform.fromRecord(q.element(q.elementById(clip)!)).distortion + .same(pose), + isTrue, + ); + view.undo(); + await until(() => !preview.busy); + expect( + preview.visuals.single.transform.distortion.values, + List.filled(8, 0), + ); + preview.setMaskEditing(clip, owner: Object()); + expect(preview.distortionEditingElement, isNull); + preview.setDistortionEditing(clip, owner: owner, perspective: true); + expect(preview.maskEditingElement, isNull); + expect(preview.distortionPerspective, isTrue); + preview.releaseDistortionEditing(owner); + expect(preview.distortionEditingElement, isNull); + }); + testWidgets('alignment refreshes selection when the native scene settles', ( tester, ) async { @@ -1064,7 +1257,39 @@ void main() { await tester.binding.setSurfaceSize(const Size(320, 760)); addTearDown(() => tester.binding.setSurfaceSize(null)); final f = (await tester.runAsync( - () => createPreviewFixture(Uri.file('/test/video.mov')), + () => createPreviewFixture( + Uri.file('/test/video.mov'), + timelineOverride: TimelineDto( + id: SequenceId('one'), + name: 'One', + format: TimelineFormat.fps30, + primaryStorylineId: StorylineId('primary'), + storylines: [ + StorylineDto( + id: StorylineId('primary'), + elementIds: [ElementId('clip'), ElementId('other')], + ), + ], + elements: [ + for (final id in ['clip', 'other']) + ElementDto( + id: ElementId(id), + name: id, + structure: ElementStructure.content, + payloadRef: PayloadRef('source'), + duration: RationalTime.seconds(2), + sourceRange: TimeRange( + start: RationalTime.zero, + duration: RationalTime.seconds(2), + ), + mediaRange: TimeRange( + start: RationalTime.zero, + duration: RationalTime.seconds(2), + ), + ), + ], + ), + ), ))!; final preview = PreviewController( timeline: f.timeline, diff --git a/test/preview_interaction_test.dart b/test/preview_interaction_test.dart index 64fb8fa..5ceb33c 100644 --- a/test/preview_interaction_test.dart +++ b/test/preview_interaction_test.dart @@ -765,6 +765,48 @@ void main() { replacement.dispose(); }); + testWidgets( + 'distortion drag edits one paired corner; perspective links the edge; escape cancels', + (tester) async { + final preview = _Preview()..selectVisual(ElementId('upper')); + preview.setDistortionEditing(ElementId('upper')); + await mount(tester, preview); + final original = preview.visuals.last.geometry; + final corner = const Offset(40, 40) + original.corners[0] * .5; + var gesture = await tester.startGesture(corner); + await gesture.moveBy(const Offset(15, 10)); + await gesture.up(); + await tester.pumpAndSettle(); + expect(preview.value.distortion.topLeft.$1, closeTo(.1, 1e-6)); + expect(preview.value.distortion.topLeft.$2, closeTo(.1, 1e-6)); + expect(preview.value.scale, 1); + expect(preview.value.x, 0); + expect(preview.value.distortion.topRight, (0, 0)); + expect(preview.commits, 1); + final before = preview.value; + final moved = + const Offset(40, 40) + preview.visuals.last.geometry.corners[0] * .5; + gesture = await tester.startGesture(moved); + await gesture.moveBy(const Offset(15, 10)); + await tester.pump(); + await tester.sendKeyEvent(LogicalKeyboardKey.escape); + await gesture.up(); + await tester.pumpAndSettle(); + expect(preview.value, same(before)); + expect(preview.commits, 1); + preview.setDistortionEditing(ElementId('upper'), perspective: true); + gesture = await tester.startGesture(moved); + await gesture.moveBy(const Offset(15, 10)); + await gesture.up(); + await tester.pumpAndSettle(); + expect(preview.value.distortion.topLeft.$1, closeTo(.2, 1e-6)); + expect(preview.value.distortion.topRight.$1, closeTo(-.1, 1e-6)); + expect(preview.value.distortion.topRight.$2, closeTo(.1, 1e-6)); + await tester.pumpWidget(const SizedBox()); + preview.dispose(); + }, + ); + testWidgets( 'selection follows video rotation and its visible corners resize', (tester) async { @@ -1105,6 +1147,21 @@ class _MaskPreview extends _Preview { } class _Preview extends ChangeNotifier implements PreviewController { + @override + ElementId? distortionEditingElement; + @override + bool distortionPerspective = false; + @override + void setDistortionEditing( + ElementId? element, { + Object? owner, + bool perspective = false, + }) { + distortionEditingElement = element; + distortionPerspective = perspective; + notifyListeners(); + } + @override Listenable get positionChanges => this; diff --git a/test/preview_panel_test.dart b/test/preview_panel_test.dart index 960fe8d..20066a0 100644 --- a/test/preview_panel_test.dart +++ b/test/preview_panel_test.dart @@ -519,6 +519,21 @@ void main() { } class _Preview extends ChangeNotifier implements PreviewController { + @override + ElementId? distortionEditingElement; + @override + bool distortionPerspective = false; + @override + void setDistortionEditing( + ElementId? element, { + Object? owner, + bool perspective = false, + }) { + distortionEditingElement = element; + distortionPerspective = perspective; + notifyListeners(); + } + @override Listenable get positionChanges => this; diff --git a/test/property_color_input_test.dart b/test/property_color_input_test.dart new file mode 100644 index 0000000..5d5e627 --- /dev/null +++ b/test/property_color_input_test.dart @@ -0,0 +1,79 @@ +import 'dart:async'; + +import 'package:cutdex/features/properties/property_color_input.dart'; +import 'package:cutdex/l10n/app_localizations.dart'; +import 'package:cutdex_ui/theme.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; + +Widget input({ + required String value, + required Object context, + required Future Function(int) submit, +}) => MaterialApp( + localizationsDelegates: AppLocalizations.localizationsDelegates, + supportedLocales: AppLocalizations.supportedLocales, + locale: const Locale('zh'), + theme: AppTheme.propertiesPanelTheme( + AppTheme.desktopWorkspaceTheme(AppTheme.penDark), + ), + home: Scaffold( + body: SizedBox( + width: 180, + child: PropertyColorInput( + value: value, + color: Color(0xFF000000 | int.parse(value, radix: 16)), + enabled: true, + editContext: context, + submit: submit, + ), + ), + ), +); + +void main() { + testWidgets( + 'hex input rejects invalid text and submits the selected RGB value', + (tester) async { + int? submitted; + Future submit(int value) async { + submitted = value; + return true; + } + + await tester.pumpWidget( + input(value: '3366FF', context: 'a', submit: submit), + ); + await tester.enterText(find.byType(TextField), 'invalid'); + await tester.testTextInput.receiveAction(TextInputAction.done); + await tester.pump(); + expect(submitted, isNull); + await tester.enterText(find.byType(TextField), '#12aB34'); + await tester.testTextInput.receiveAction(TextInputAction.done); + await tester.pump(); + expect(submitted, 0x12AB34); + expect(tester.takeException(), isNull); + }, + ); + + testWidgets( + 'a pending color submission cannot overwrite a newly selected field', + (tester) async { + final pending = Completer(); + await tester.pumpWidget( + input(value: '3366FF', context: 'a', submit: (_) => pending.future), + ); + await tester.enterText(find.byType(TextField), '12AB34'); + await tester.testTextInput.receiveAction(TextInputAction.done); + await tester.pump(); + await tester.pumpWidget( + input(value: 'FF0000', context: 'b', submit: (_) async => true), + ); + pending.complete(false); + await tester.pump(); + final text = tester.widget(find.byType(TextField)); + expect(text.controller!.text, 'FF0000'); + expect(tester.takeException(), isNull); + }, + ); +} diff --git a/test/property_edit_controller_test.dart b/test/property_edit_controller_test.dart new file mode 100644 index 0000000..1fd6da7 --- /dev/null +++ b/test/property_edit_controller_test.dart @@ -0,0 +1,88 @@ +import 'package:cutdex/features/properties/property_edit_controller.dart'; +import 'package:cutdex_sdk/editor.dart'; +import 'package:cutdex_sdk/timeline/model.dart'; +import 'package:flutter_test/flutter_test.dart'; + +import 'support/preview_fixture.dart'; + +void main() { + TestWidgetsFlutterBinding.ensureInitialized(); + + for (final invalidation in ['dispose', 'seek', 'version', 'sequence']) { + test('pending effect edit is cancelled after $invalidation', () async { + final f = await createPreviewFixture(Uri.file('/test/video.mov')); + final sequence = SequenceId('one'), clip = ElementId('clip'); + final controller = PropertyEditController( + session: f.timeline, + sequence: sequence, + clip: clip, + projectId: f.workspace.project!.info.id, + timelineId: 'project', + operation: 'editEffect', + ); + var disposed = false; + addTearDown(() async { + if (!disposed) controller.dispose(); + await f.workspace.close(); + await f.directory.delete(recursive: true); + }); + var publications = 0; + final pending = controller.run(null, (_, _) => publications++); + expect(controller.saving, isTrue); + switch (invalidation) { + case 'dispose': + controller.dispose(); + disposed = true; + case 'seek': + f.timeline.view(sequence).seekTo(1); + case 'version': + f.timeline.commands.addEffect( + sequence: sequence, + clip: clip, + tick: 0, + effectId: 'external', + type: ClipEffectType.dropShadow, + ); + case 'sequence': + f.timeline.selectSequence(SequenceId('empty')); + } + expect(await pending, isFalse); + expect(publications, 0); + if (!disposed) { + expect(controller.saving, isFalse); + expect(controller.failed, isFalse); + } + }); + } + + test('effect edit excludes duplicate submissions and recovers after a command failure', () async { + final f = await createPreviewFixture(Uri.file('/test/video.mov')); + final controller = PropertyEditController( + session: f.timeline, + sequence: SequenceId('one'), + clip: ElementId('clip'), + projectId: f.workspace.project!.info.id, + timelineId: 'project', + operation: 'editEffect', + ); + addTearDown(() async { + controller.dispose(); + await f.workspace.close(); + await f.directory.delete(recursive: true); + }); + var publications = 0; + final first = controller.run(null, (_, _) => publications++); + expect(await controller.run(null, (_, _) => publications++), isFalse); + expect(await first, isTrue); + expect(publications, 1); + expect( + await controller.run(null, (_, _) => throw StateError('Rejected edit')), + isFalse, + ); + expect(controller.failed, isTrue); + expect(controller.saving, isFalse); + expect(await controller.run(null, (_, _) => publications++), isTrue); + expect(controller.failed, isFalse); + expect(publications, 2); + }); +} diff --git a/tool/diagnostics/compare_property_performance.py b/tool/diagnostics/compare_property_performance.py new file mode 100644 index 0000000..c40df16 --- /dev/null +++ b/tool/diagnostics/compare_property_performance.py @@ -0,0 +1,88 @@ +#!/usr/bin/env python3 +"""Compare repeated release-mode PropertyPerformanceTests logs; fail on regressions.""" + +import argparse +import json +import math +import re +import statistics +from pathlib import Path + +LINE = re.compile( + r"PROPERTY_BENCH (\w+) median_us=(\S+) p95_us=(\S+) checksum=(\S+)" +) + + +def read(paths): + runs = {} + for path in paths: + current = {} + for name, median, p95, checksum in LINE.findall(Path(path).read_text()): + values = tuple(float(value) for value in (median, p95, checksum)) + if (name in current or not all(math.isfinite(value) for value in values) + or values[0] < 0 or values[1] < values[0]): + raise ValueError(f"Invalid or duplicate measurement in {path}: {name}") + current[name] = values + if not current or (runs and current.keys() != runs.keys()): + raise ValueError(f"Missing benchmark scenarios in {path}") + for name, values in current.items(): + runs.setdefault(name, []).append(values) + return runs + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--before", nargs="+", required=True) + parser.add_argument("--after", nargs="+", required=True) + parser.add_argument("--output", type=Path) + parser.add_argument("--tolerance", type=float, default=0.15, + help="Allowed relative timing noise (default: 0.15)") + args = parser.parse_args() + if not 0 <= args.tolerance < 1: + parser.error("--tolerance must be in [0, 1)") + if len(args.before) < 3 or len(args.after) < 3: + parser.error("At least three independent runs are required on each side") + try: + before, after = read(args.before), read(args.after) + expected = {"render_plain", "render_effects", "sampling_empty", "sampling_normal", "sampling_dense"} + if before.keys() != expected or after.keys() != expected: + raise ValueError("Before/after scenarios do not match") + result = { + "method": "Median of independent run medians and run P95 values; times in microseconds", + "scope": "Scalar sampling and 640x360 native frozen-frame compositor, not display FPS", + "checksumScope": "Scalar outputs and rendered-frame work counters; pixel parity is tested separately", + "relativeNoiseTolerance": args.tolerance, + "beforeLogs": args.before, + "afterLogs": args.after, + "scenarios": {}, + } + passed = True + for name in before: + checksums = {row[2] for row in before[name] + after[name]} + scenario = {"checksumMatches": len(checksums) == 1, + "beforeRuns": len(before[name]), "afterRuns": len(after[name])} + passed &= scenario["checksumMatches"] + # Timer noise dominates empty, sub-microsecond sampling measurements. + absolute_noise = 0.1 if name.startswith("sampling_") else 100.0 + for index, metric in enumerate(["median", "p95"]): + old = statistics.median(row[index] for row in before[name]) + new = statistics.median(row[index] for row in after[name]) + limit = old * (1 + args.tolerance) + absolute_noise + scenario[metric] = {"beforeUs": old, "afterUs": new, + "changePercent": (new / old - 1) * 100 if old else None, + "limitUs": limit, "passed": new <= limit} + passed &= new <= limit + result["scenarios"][name] = scenario + result["passed"] = bool(passed) + encoded = json.dumps(result, indent=2) + "\n" + if args.output: + args.output.parent.mkdir(parents=True, exist_ok=True) + args.output.write_text(encoded) + print(encoded, end="") + return 0 if passed else 1 + except (OSError, ValueError) as error: + parser.exit(2, f"Invalid benchmark input: {error}\n") + + +if __name__ == "__main__": + raise SystemExit(main())