Move editor UI into the app and release verified Core dependencies (#14)
Gitea CI / Assemble and validate CI artifacts (push) Successful in 1m47s
Gitea CI / Check code and tests (push) Successful in 7m15s
Gitea CI / Build Android APK (push) Successful in 4m6s
Gitea CI / Build Windows x64 app (push) Successful in 3m34s
Gitea CI / Audit and package Windows x64 (push) Successful in 1m29s
Gitea CI / Gitea CI passed (push) Successful in 1s
Gitea Release / Prepare draft Release (push) Failing after 8s
Gitea Release / Upload Android to draft Release (push) Skipped
Gitea Release / Upload Windows to draft Release (push) Skipped
Gitea Release / Verify and publish Release (push) Skipped
Gitea CI / Assemble and validate CI artifacts (push) Successful in 1m47s
Gitea CI / Check code and tests (push) Successful in 7m15s
Gitea CI / Build Android APK (push) Successful in 4m6s
Gitea CI / Build Windows x64 app (push) Successful in 3m34s
Gitea CI / Audit and package Windows x64 (push) Successful in 1m29s
Gitea CI / Gitea CI passed (push) Successful in 1s
Gitea Release / Prepare draft Release (push) Failing after 8s
Gitea Release / Upload Android to draft Release (push) Skipped
Gitea Release / Upload Windows to draft Release (push) Skipped
Gitea Release / Verify and publish Release (push) Skipped
This commit was merged in pull request #14.
This commit is contained in:
1 parent
abc1868550
commit
06f1c26681
452 files changed
+43806
-2329
No files matched your search
@@ -0,0 +1,211 @@
|
||||
import 'package:cutdex/l10n/l10n.dart';
|
||||
import 'package:cutdex_core/editor.dart';
|
||||
import 'package:cutdex_core/timeline/model.dart';
|
||||
import 'package:cutdex_core/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<bool> Function(int corner, int axis, double value) onSubmit;
|
||||
final VoidCallback? onToggle;
|
||||
final VoidCallback onReset;
|
||||
final ValueChanged<bool> 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<bool>(
|
||||
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),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user