feat(inspector): edit animated effects, strokes and corner distortion
Replace the shadow-only inspector with layered effect and stroke controls and per-corner distortion editors. Share color inputs, layer rows, keyframe controls and property edit boundaries; keep nested selection menus within their property popover and update localized labels. Add property editing, preview interaction and benchmark comparison coverage. Validation: Dart analysis reports no issues and 160 targeted application tests pass. The macOS development app was rebuilt and visually checked during native rendering validation. Exclude local dependency override changes from the committed lockfile.
This commit is contained in:
1 parent
8d1f8db7e8
commit
789af7a68e
58 files changed
+6911
-1972
No files matched your search
@@ -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<EffectProperties> createState() => _EffectPropertiesState();
|
||||
}
|
||||
|
||||
class _EffectPropertiesState extends ConsumerState<EffectProperties> {
|
||||
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<bool> 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,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user