feat(workspace): 桌面工作区、主题与交互更新,发布 0.1.2
Gitea CI / Check code and tests (push) Successful in 6m37s
Gitea CI / Build Windows x64 app (push) Successful in 3m18s
Gitea CI / Build Android APK (push) Successful in 3m47s
Gitea CI / Audit and package Windows x64 (push) Successful in 1m7s
Gitea CI / Assemble and validate CI artifacts (push) Successful in 50s
Gitea CI / Gitea CI passed (push) Successful in 2s
Gitea Release / Prepare draft Release (push) Successful in 9s
Gitea Release / Upload Android to draft Release (push) Successful in 16s
Gitea Release / Upload Windows to draft Release (push) Successful in 22s
Gitea Release / Verify and publish Release (push) Successful in 14s
Gitea CI / Check code and tests (push) Successful in 6m37s
Gitea CI / Build Windows x64 app (push) Successful in 3m18s
Gitea CI / Build Android APK (push) Successful in 3m47s
Gitea CI / Audit and package Windows x64 (push) Successful in 1m7s
Gitea CI / Assemble and validate CI artifacts (push) Successful in 50s
Gitea CI / Gitea CI passed (push) Successful in 2s
Gitea Release / Prepare draft Release (push) Successful in 9s
Gitea Release / Upload Android to draft Release (push) Successful in 16s
Gitea Release / Upload Windows to draft Release (push) Successful in 22s
Gitea Release / Verify and publish Release (push) Successful in 14s
This commit was merged in pull request #13.
This commit is contained in:
1 parent
aa5255d1e4
commit
abc1868550
260 files changed
+43964
-5591
No files matched your search
@@ -12,11 +12,13 @@ import 'package:cutdex_sdk/timeline/model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
import 'package:cutdex_ui/icons.dart';
|
||||
import 'package:cutdex_ui/theme.dart';
|
||||
import 'package:cutdex_ui/widgets.dart';
|
||||
|
||||
import '../../workspace/timeline_session.dart';
|
||||
import '../../shared/widgets/listenable_selector.dart';
|
||||
import '../../shared/state/operation_scope.dart';
|
||||
import '../preview/preview_panel.dart';
|
||||
import 'property_number_input.dart';
|
||||
import 'picture_edits.dart';
|
||||
@@ -43,6 +45,17 @@ class PictureProperties extends ConsumerStatefulWidget {
|
||||
}
|
||||
|
||||
class _PicturePropertiesState extends ConsumerState<PictureProperties> {
|
||||
Object get _editIdentity => (
|
||||
widget.projectId,
|
||||
widget.timelineId,
|
||||
widget.session,
|
||||
widget.sequence,
|
||||
widget.clip.id,
|
||||
);
|
||||
PreviewController? _boundPreview;
|
||||
Object get _operationContext => (_editIdentity, _boundPreview);
|
||||
late final _operations = OperationScope<Object>(_operationContext);
|
||||
late final _seeks = OperationScope<Object>(_operationContext);
|
||||
bool _locked = true;
|
||||
bool _hasFocusedControl = false;
|
||||
PictureEditsProvider get _editProvider =>
|
||||
@@ -50,17 +63,56 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
|
||||
PictureEdits get _edits => ref.read(_editProvider.notifier);
|
||||
bool get _saving => ref.read(_editProvider).isLoading;
|
||||
bool Function() _guard() {
|
||||
final isCurrent = _operations.capture();
|
||||
final session = widget.session;
|
||||
final sequence = widget.sequence;
|
||||
final clip = widget.clip.id;
|
||||
return () =>
|
||||
mounted &&
|
||||
isCurrent() &&
|
||||
_scrubBase == null &&
|
||||
identical(widget.session, session) &&
|
||||
widget.sequence == sequence &&
|
||||
widget.clip.id == clip;
|
||||
}
|
||||
|
||||
@override
|
||||
void didUpdateWidget(covariant PictureProperties oldWidget) {
|
||||
super.didUpdateWidget(oldWidget);
|
||||
final previousIdentity = (
|
||||
oldWidget.projectId,
|
||||
oldWidget.timelineId,
|
||||
oldWidget.session,
|
||||
oldWidget.sequence,
|
||||
oldWidget.clip.id,
|
||||
);
|
||||
if (previousIdentity != _editIdentity) {
|
||||
final edit = _clearScrub();
|
||||
if (edit != null) scheduleMicrotask(edit.cancel);
|
||||
}
|
||||
_operations.bind(_operationContext);
|
||||
_seeks.bind(_operationContext);
|
||||
}
|
||||
|
||||
Future<void> _seek(PreviewController? preview, int tick) async {
|
||||
final isCurrent = _guard();
|
||||
final isLatest = _seeks.begin();
|
||||
final session = widget.session;
|
||||
final sequence = widget.sequence;
|
||||
final view = session.view(sequence);
|
||||
final version = view.version.kernelVersion;
|
||||
final position = view.playheadTick;
|
||||
await preview?.pauseForCanvasInteraction();
|
||||
if (!isCurrent() ||
|
||||
!isLatest() ||
|
||||
session.activeSequenceId != sequence ||
|
||||
view.playheadTick != position ||
|
||||
!identical(view.version.kernelVersion, version)) {
|
||||
return;
|
||||
}
|
||||
view.seekTo(tick);
|
||||
}
|
||||
|
||||
String? get _error => switch (ref.read(_editProvider).error) {
|
||||
PictureEditException(:final failure) => switch (failure) {
|
||||
PictureEditFailure.keyframes => context.l10n.updateKeyframesFailed,
|
||||
@@ -78,6 +130,18 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
|
||||
String? _scrubField;
|
||||
ClipTransform Function(ClipTransform, double)? _scrubChange;
|
||||
|
||||
PreviewTransformEdit? _clearScrub() {
|
||||
final edit = _scrubEdit;
|
||||
_scrubEdit = null;
|
||||
_scrubBase = null;
|
||||
_scrubTimeline = null;
|
||||
_scrubField = null;
|
||||
_scrubChange = null;
|
||||
_scrubVersion = null;
|
||||
_scrubTick = null;
|
||||
return edit;
|
||||
}
|
||||
|
||||
bool _startScrub(
|
||||
PreviewController? preview,
|
||||
String field,
|
||||
@@ -144,13 +208,8 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
|
||||
_cancelScrub();
|
||||
return;
|
||||
}
|
||||
final edit = _scrubEdit;
|
||||
_scrubEdit = null;
|
||||
_scrubBase = null;
|
||||
_scrubField = null;
|
||||
_scrubChange = null;
|
||||
_scrubVersion = null;
|
||||
setState(() => _scrubTimeline = null);
|
||||
final edit = _clearScrub();
|
||||
setState(() {});
|
||||
if (edit != null) {
|
||||
unawaited(edit.end());
|
||||
} else {
|
||||
@@ -159,20 +218,16 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
|
||||
}
|
||||
|
||||
void _cancelScrub() {
|
||||
final edit = _scrubEdit;
|
||||
_scrubEdit = null;
|
||||
_scrubBase = null;
|
||||
_scrubField = null;
|
||||
_scrubChange = null;
|
||||
_scrubVersion = null;
|
||||
if (mounted) setState(() => _scrubTimeline = null);
|
||||
final edit = _clearScrub();
|
||||
if (mounted) setState(() {});
|
||||
edit?.cancel();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
final edit = _scrubEdit;
|
||||
_scrubEdit = null;
|
||||
_operations.dispose();
|
||||
_seeks.dispose();
|
||||
final edit = _clearScrub();
|
||||
if (edit != null) scheduleMicrotask(edit.cancel);
|
||||
super.dispose();
|
||||
}
|
||||
@@ -198,7 +253,12 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
|
||||
);
|
||||
return (
|
||||
widget.session.activeSequenceId,
|
||||
view.version.kernelVersion,
|
||||
animation?.record,
|
||||
animation?.start,
|
||||
animation?.frameTicks,
|
||||
_hasFocusedControl || _scrubBase != null
|
||||
? view.version.kernelVersion
|
||||
: null,
|
||||
widget.session.canvas,
|
||||
animation?.containsPlayhead,
|
||||
timeDependent || _hasFocusedControl ? animation?.playhead : null,
|
||||
@@ -247,6 +307,13 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
|
||||
.watch(editorPreviewProvider(widget.projectId, widget.timelineId))
|
||||
.asData
|
||||
?.value;
|
||||
if (!identical(_boundPreview, preview)) {
|
||||
final edit = _clearScrub();
|
||||
if (edit != null) scheduleMicrotask(edit.cancel);
|
||||
_boundPreview = preview;
|
||||
_operations.bind(_operationContext);
|
||||
_seeks.bind(_operationContext);
|
||||
}
|
||||
Widget contents() {
|
||||
final animation = _animation();
|
||||
final live = preview?.activeSequence() == widget.sequence
|
||||
@@ -275,7 +342,10 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
|
||||
color: animated ? Theme.of(context).colorScheme.primary : null,
|
||||
icon: Transform.rotate(
|
||||
angle: math.pi / 4,
|
||||
child: Icon(keyed ? Icons.square : Icons.crop_square, size: 12),
|
||||
child: Icon(
|
||||
keyed ? AppIcons.squareFilled : AppIcons.square,
|
||||
size: 12,
|
||||
),
|
||||
),
|
||||
onPressed:
|
||||
enabled &&
|
||||
@@ -287,31 +357,37 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
|
||||
);
|
||||
}
|
||||
|
||||
final desktop = AppTheme.isDesktop(context);
|
||||
final gap = AppTheme.propertyRowGap(context);
|
||||
Widget axes(TransformChannel channel, Widget first, Widget second) =>
|
||||
LayoutBuilder(
|
||||
builder: (context, constraints) => Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: constraints.maxWidth < 240
|
||||
? Column(
|
||||
children: [
|
||||
first,
|
||||
const SizedBox(height: AppSpacing.small),
|
||||
second,
|
||||
],
|
||||
)
|
||||
: Row(
|
||||
children: [
|
||||
Expanded(child: first),
|
||||
const SizedBox(width: AppSpacing.small),
|
||||
Expanded(child: second),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(width: AppSpacing.small),
|
||||
keyButton(channel),
|
||||
],
|
||||
),
|
||||
builder: (context, constraints) {
|
||||
final pair = constraints.maxWidth < (desktop ? 180 : 240)
|
||||
? Column(
|
||||
children: [
|
||||
first,
|
||||
SizedBox(height: gap),
|
||||
second,
|
||||
],
|
||||
)
|
||||
: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(child: first),
|
||||
SizedBox(width: gap),
|
||||
Expanded(child: second),
|
||||
],
|
||||
);
|
||||
return desktop
|
||||
? pair
|
||||
: Row(
|
||||
children: [
|
||||
Expanded(child: pair),
|
||||
SizedBox(width: gap),
|
||||
keyButton(channel),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
Widget keyTools(TransformChannel channel) {
|
||||
@@ -323,15 +399,12 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
|
||||
final previous = times.where((t) => t < tick).lastOrNull;
|
||||
final next = times.where((t) => t > tick).firstOrNull;
|
||||
final canEdit = enabled && _scrubBase == null && !canvasDragging;
|
||||
Future<void> seek(int target) async {
|
||||
await preview?.pauseForCanvasInteraction();
|
||||
if (mounted && widget.session.activeSequenceId == widget.sequence) {
|
||||
widget.session.view(widget.sequence).seekTo(target);
|
||||
}
|
||||
}
|
||||
Future<void> seek(int target) => _seek(preview, target);
|
||||
|
||||
return SizedBox(
|
||||
height: AppControlSize.standard,
|
||||
height: AppTheme.isDesktop(context)
|
||||
? AppInspectorMetrics.action
|
||||
: AppControlSize.standard,
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
@@ -345,13 +418,13 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
|
||||
onPressed: canEdit && previous != null
|
||||
? () => seek(previous)
|
||||
: null,
|
||||
icon: const Icon(Icons.chevron_left, size: 16),
|
||||
icon: const Icon(AppIcons.chevronLeft, size: 16),
|
||||
),
|
||||
IconButton(
|
||||
key: ValueKey('picture-key-next-${channel.name}'),
|
||||
tooltip: context.l10n.nextKeyframe(channel.label(context)),
|
||||
onPressed: canEdit && next != null ? () => seek(next) : null,
|
||||
icon: const Icon(Icons.chevron_right, size: 16),
|
||||
icon: const Icon(AppIcons.chevronRight, size: 16),
|
||||
),
|
||||
AppDropdownMenu(
|
||||
key: ValueKey('picture-key-menu-${channel.name}'),
|
||||
@@ -362,7 +435,7 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
|
||||
),
|
||||
focusNode: focus,
|
||||
onPressed: toggle,
|
||||
icon: const Icon(Icons.more_horiz, size: 16),
|
||||
icon: const Icon(AppIcons.more, size: 16),
|
||||
),
|
||||
items: [
|
||||
for (final (mode, label) in [
|
||||
@@ -412,9 +485,15 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
|
||||
double min = double.negativeInfinity,
|
||||
double max = double.infinity,
|
||||
bool wrapRotation = false,
|
||||
bool inlineLabel = false,
|
||||
String? prefix,
|
||||
IconData? prefixIcon,
|
||||
}) => PropertyNumberInput(
|
||||
key: ValueKey(id),
|
||||
label: label,
|
||||
inlineLabel: inlineLabel,
|
||||
prefix: prefix,
|
||||
prefixIcon: prefixIcon,
|
||||
unit: unit,
|
||||
value: value,
|
||||
enabled: !_saving,
|
||||
@@ -435,17 +514,170 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
|
||||
onScrubCancel: _cancelScrub,
|
||||
scrubbing: _scrubField == id,
|
||||
editContext: (
|
||||
_editIdentity,
|
||||
preview,
|
||||
widget.session.view(widget.sequence).version.kernelVersion,
|
||||
widget.session.view(widget.sequence).playheadTick,
|
||||
),
|
||||
);
|
||||
Widget section(List<Widget> children) => Padding(
|
||||
padding: AppSpacing.panelSection,
|
||||
padding: AppTheme.propertySectionPadding(context),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: children,
|
||||
),
|
||||
);
|
||||
final position = axes(
|
||||
TransformChannel.position,
|
||||
number(
|
||||
'picture-x',
|
||||
'X',
|
||||
value.x * canvas.width,
|
||||
(c, v) => c.copyWith(x: v / canvas.width),
|
||||
inlineLabel: true,
|
||||
),
|
||||
number(
|
||||
'picture-y',
|
||||
'Y',
|
||||
value.y * canvas.height,
|
||||
(c, v) => c.copyWith(y: v / canvas.height),
|
||||
inlineLabel: true,
|
||||
),
|
||||
);
|
||||
final rotationInput = number(
|
||||
'picture-rotation',
|
||||
context.l10n.rotation,
|
||||
value.rotation,
|
||||
(c, v) => c.copyWith(rotation: v),
|
||||
unit: '°',
|
||||
wrapRotation: true,
|
||||
inlineLabel: desktop,
|
||||
prefixIcon: desktop ? AppIcons.angle : null,
|
||||
);
|
||||
final rotation = desktop
|
||||
? rotationInput
|
||||
: Row(
|
||||
children: [
|
||||
Expanded(child: rotationInput),
|
||||
SizedBox(width: gap),
|
||||
keyButton(TransformChannel.rotation),
|
||||
],
|
||||
);
|
||||
final scale = axes(
|
||||
TransformChannel.scale,
|
||||
number(
|
||||
'picture-scale-x',
|
||||
'W',
|
||||
value.scale * 100,
|
||||
(c, v) => c.copyWith(
|
||||
scale: v / 100,
|
||||
scaleY: locked ? c.scaleY * v / 100 / c.scale : c.scaleY,
|
||||
),
|
||||
unit: '%',
|
||||
min: locked ? math.max(1.0, value.scale / value.scaleY) : 1,
|
||||
max: locked
|
||||
? math.min(10000.0, 10000 * value.scale / value.scaleY)
|
||||
: 10000,
|
||||
inlineLabel: true,
|
||||
),
|
||||
number(
|
||||
'picture-scale-y',
|
||||
'H',
|
||||
value.scaleY * 100,
|
||||
(c, v) => c.copyWith(
|
||||
scaleY: v / 100,
|
||||
scale: locked ? c.scale * v / 100 / c.scaleY : c.scale,
|
||||
),
|
||||
unit: '%',
|
||||
min: locked ? math.max(1.0, value.scaleY / value.scale) : 1,
|
||||
max: locked
|
||||
? math.min(10000.0, 10000 * value.scaleY / value.scale)
|
||||
: 10000,
|
||||
inlineLabel: true,
|
||||
),
|
||||
);
|
||||
final lock = IconButton(
|
||||
key: const Key('picture-lock'),
|
||||
tooltip: context.l10n.keepAspectRatio,
|
||||
icon: const Icon(AppIcons.unlock),
|
||||
selectedIcon: const Icon(AppIcons.lockFilled),
|
||||
isSelected: locked,
|
||||
onPressed: enabled
|
||||
? () {
|
||||
if (preview?.transforms.hasPending == true) return;
|
||||
preview?.setAspectRatioLocked(!locked);
|
||||
setState(() => _locked = !locked);
|
||||
}
|
||||
: null,
|
||||
);
|
||||
final alignmentControls = LayoutBuilder(
|
||||
builder: (context, constraints) => Wrap(
|
||||
spacing: AppSpacing.small,
|
||||
runSpacing: AppSpacing.small,
|
||||
children: [
|
||||
for (final group in [
|
||||
[
|
||||
(
|
||||
CanvasAlignment.left,
|
||||
context.l10n.alignLeft,
|
||||
AppIcons.alignLeft,
|
||||
),
|
||||
(
|
||||
CanvasAlignment.horizontalCenter,
|
||||
context.l10n.alignHorizontalCenter,
|
||||
AppIcons.alignHorizontalCenter,
|
||||
),
|
||||
(
|
||||
CanvasAlignment.right,
|
||||
context.l10n.alignRight,
|
||||
AppIcons.alignRight,
|
||||
),
|
||||
],
|
||||
[
|
||||
(CanvasAlignment.top, context.l10n.alignTop, AppIcons.alignTop),
|
||||
(
|
||||
CanvasAlignment.verticalCenter,
|
||||
context.l10n.alignVerticalCenter,
|
||||
AppIcons.alignVerticalCenter,
|
||||
),
|
||||
(
|
||||
CanvasAlignment.bottom,
|
||||
context.l10n.alignBottom,
|
||||
AppIcons.alignBottom,
|
||||
),
|
||||
],
|
||||
])
|
||||
SizedBox(
|
||||
width: constraints.maxWidth < 200
|
||||
? constraints.maxWidth
|
||||
: (constraints.maxWidth - AppSpacing.small) / 2,
|
||||
child: AppButtonGroup(
|
||||
expanded: true,
|
||||
label: context.l10n.alignment,
|
||||
children: [
|
||||
for (final (alignment, label, icon) in group)
|
||||
IconButton(
|
||||
key: ValueKey('picture-align-${alignment.name}'),
|
||||
tooltip: label,
|
||||
icon: Icon(icon, size: AppIconSize.standard),
|
||||
onPressed: () {
|
||||
if (!enabled ||
|
||||
canvasDragging ||
|
||||
preview == null ||
|
||||
preview.busy ||
|
||||
preview.visualForProperties(widget.clip.id) ==
|
||||
null) {
|
||||
return;
|
||||
}
|
||||
unawaited(_align(preview, alignment));
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
final content = Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
@@ -454,202 +686,79 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
|
||||
_KeyframeTimeline(
|
||||
animation: animation,
|
||||
enabled: enabled && !canvasDragging && _scrubBase == null,
|
||||
onSeek: (tick) async {
|
||||
await preview?.pauseForCanvasInteraction();
|
||||
if (mounted &&
|
||||
widget.session.activeSequenceId == widget.sequence) {
|
||||
widget.session.view(widget.sequence).seekTo(tick);
|
||||
}
|
||||
},
|
||||
onSeek: (tick) => _seek(preview, tick),
|
||||
),
|
||||
]),
|
||||
],
|
||||
if (!widget.animationView) ...[
|
||||
if (!widget.animationView)
|
||||
section([
|
||||
if (desktop)
|
||||
AppPropertyGroup(
|
||||
label: context.l10n.alignment,
|
||||
child: alignmentControls,
|
||||
)
|
||||
else ...[
|
||||
Text(
|
||||
context.l10n.alignment,
|
||||
style: AppTheme.propertySectionTitleStyle(context),
|
||||
),
|
||||
SizedBox(height: gap),
|
||||
alignmentControls,
|
||||
],
|
||||
]),
|
||||
if (desktop) ...[
|
||||
section([
|
||||
AppPropertyGroup(
|
||||
label: context.l10n.position,
|
||||
actions: [keyButton(TransformChannel.position)],
|
||||
child: position,
|
||||
),
|
||||
keyTools(TransformChannel.position),
|
||||
]),
|
||||
section([
|
||||
AppPropertyGroup(
|
||||
label: context.l10n.scale,
|
||||
actions: [lock, keyButton(TransformChannel.scale)],
|
||||
child: scale,
|
||||
),
|
||||
keyTools(TransformChannel.scale),
|
||||
]),
|
||||
section([
|
||||
AppPropertyGroup(
|
||||
label: context.l10n.rotation,
|
||||
actions: [keyButton(TransformChannel.rotation)],
|
||||
child: rotation,
|
||||
),
|
||||
keyTools(TransformChannel.rotation),
|
||||
]),
|
||||
] else ...[
|
||||
section([
|
||||
Text(
|
||||
context.l10n.alignment,
|
||||
context.l10n.position,
|
||||
style: AppTheme.propertySectionTitleStyle(context),
|
||||
),
|
||||
const SizedBox(height: AppSpacing.small),
|
||||
LayoutBuilder(
|
||||
builder: (context, constraints) => Wrap(
|
||||
spacing: AppSpacing.small,
|
||||
runSpacing: AppSpacing.small,
|
||||
children: [
|
||||
for (final group in [
|
||||
[
|
||||
(
|
||||
CanvasAlignment.left,
|
||||
context.l10n.alignLeft,
|
||||
Icons.align_horizontal_left,
|
||||
),
|
||||
(
|
||||
CanvasAlignment.horizontalCenter,
|
||||
context.l10n.alignHorizontalCenter,
|
||||
Icons.align_horizontal_center,
|
||||
),
|
||||
(
|
||||
CanvasAlignment.right,
|
||||
context.l10n.alignRight,
|
||||
Icons.align_horizontal_right,
|
||||
),
|
||||
],
|
||||
[
|
||||
(
|
||||
CanvasAlignment.top,
|
||||
context.l10n.alignTop,
|
||||
Icons.align_vertical_top,
|
||||
),
|
||||
(
|
||||
CanvasAlignment.verticalCenter,
|
||||
context.l10n.alignVerticalCenter,
|
||||
Icons.align_vertical_center,
|
||||
),
|
||||
(
|
||||
CanvasAlignment.bottom,
|
||||
context.l10n.alignBottom,
|
||||
Icons.align_vertical_bottom,
|
||||
),
|
||||
],
|
||||
])
|
||||
SizedBox(
|
||||
width: constraints.maxWidth < 200
|
||||
? constraints.maxWidth
|
||||
: (constraints.maxWidth - AppSpacing.small) / 2,
|
||||
child: AppButtonGroup(
|
||||
expanded: true,
|
||||
label: context.l10n.alignment,
|
||||
children: [
|
||||
for (final (alignment, label, icon) in group)
|
||||
IconButton(
|
||||
key: ValueKey(
|
||||
'picture-align-${alignment.name}',
|
||||
),
|
||||
tooltip: label,
|
||||
icon: Icon(icon, size: AppIconSize.standard),
|
||||
onPressed: () {
|
||||
if (!enabled ||
|
||||
canvasDragging ||
|
||||
preview == null ||
|
||||
preview.busy ||
|
||||
preview.visualForProperties(
|
||||
widget.clip.id,
|
||||
) ==
|
||||
null) {
|
||||
return;
|
||||
}
|
||||
unawaited(_align(preview, alignment));
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: gap),
|
||||
position,
|
||||
keyTools(TransformChannel.position),
|
||||
]),
|
||||
section([rotation, keyTools(TransformChannel.rotation)]),
|
||||
section([
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
context.l10n.scale,
|
||||
style: AppTheme.propertySectionTitleStyle(context),
|
||||
),
|
||||
),
|
||||
lock,
|
||||
],
|
||||
),
|
||||
SizedBox(height: gap),
|
||||
scale,
|
||||
keyTools(TransformChannel.scale),
|
||||
]),
|
||||
],
|
||||
section([
|
||||
Text(
|
||||
context.l10n.position,
|
||||
style: AppTheme.propertySectionTitleStyle(context),
|
||||
),
|
||||
const SizedBox(height: AppSpacing.small),
|
||||
axes(
|
||||
TransformChannel.position,
|
||||
number(
|
||||
'picture-x',
|
||||
'X',
|
||||
value.x * canvas.width,
|
||||
(c, v) => c.copyWith(x: v / canvas.width),
|
||||
),
|
||||
number(
|
||||
'picture-y',
|
||||
'Y',
|
||||
value.y * canvas.height,
|
||||
(c, v) => c.copyWith(y: v / canvas.height),
|
||||
),
|
||||
),
|
||||
keyTools(TransformChannel.position),
|
||||
]),
|
||||
section([
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: number(
|
||||
'picture-rotation',
|
||||
context.l10n.rotation,
|
||||
value.rotation,
|
||||
(c, v) => c.copyWith(rotation: v),
|
||||
unit: '°',
|
||||
wrapRotation: true,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: AppSpacing.small),
|
||||
keyButton(TransformChannel.rotation),
|
||||
],
|
||||
),
|
||||
keyTools(TransformChannel.rotation),
|
||||
]),
|
||||
section([
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
context.l10n.scale,
|
||||
style: AppTheme.propertySectionTitleStyle(context),
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
key: const Key('picture-lock'),
|
||||
tooltip: context.l10n.keepAspectRatio,
|
||||
icon: const Icon(Icons.lock_open_outlined),
|
||||
selectedIcon: const Icon(Icons.lock_outline),
|
||||
isSelected: locked,
|
||||
onPressed: enabled
|
||||
? () {
|
||||
if (preview?.transforms.hasPending == true) return;
|
||||
preview?.setAspectRatioLocked(!locked);
|
||||
setState(() => _locked = !locked);
|
||||
}
|
||||
: null,
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: AppSpacing.small),
|
||||
axes(
|
||||
TransformChannel.scale,
|
||||
number(
|
||||
'picture-scale-x',
|
||||
'W',
|
||||
value.scale * 100,
|
||||
(c, v) => c.copyWith(
|
||||
scale: v / 100,
|
||||
scaleY: locked ? c.scaleY * v / 100 / c.scale : c.scaleY,
|
||||
),
|
||||
unit: '%',
|
||||
min: locked ? math.max(1.0, value.scale / value.scaleY) : 1,
|
||||
max: locked
|
||||
? math.min(10000.0, 10000 * value.scale / value.scaleY)
|
||||
: 10000,
|
||||
),
|
||||
number(
|
||||
'picture-scale-y',
|
||||
'H',
|
||||
value.scaleY * 100,
|
||||
(c, v) => c.copyWith(
|
||||
scaleY: v / 100,
|
||||
scale: locked ? c.scale * v / 100 / c.scaleY : c.scale,
|
||||
),
|
||||
unit: '%',
|
||||
min: locked ? math.max(1.0, value.scaleY / value.scale) : 1,
|
||||
max: locked
|
||||
? math.min(10000.0, 10000 * value.scaleY / value.scale)
|
||||
: 10000,
|
||||
),
|
||||
),
|
||||
keyTools(TransformChannel.scale),
|
||||
]),
|
||||
if (_error != null)
|
||||
section([
|
||||
Text(
|
||||
@@ -793,7 +902,7 @@ class _KeyframeTimeline extends StatelessWidget {
|
||||
icon: Transform.rotate(
|
||||
angle: math.pi / 4,
|
||||
child: Icon(
|
||||
Icons.square,
|
||||
AppIcons.squareFilled,
|
||||
size: 9,
|
||||
color: tick == animation.playhead
|
||||
? colors.primary
|
||||
|
||||
Reference in new issue
Block a user