feat(inspector): add animated independent corners and layered shadow controls

This commit is contained in:
lingjhf committed 2026-10-09 19:24:00 +08:00
1 parent 77dbb1897f
commit 8d1f8db7e8
23 files changed
+2375 -228

No files matched your search

@@ -7,6 +7,7 @@ extension TransformChannelLabel on TransformChannel {
TransformChannel.position => context.l10n.position,
TransformChannel.rotation => context.l10n.rotation,
TransformChannel.scale => context.l10n.scale,
TransformChannel.cornerRadius => context.l10n.cornerRadius,
};
}
@@ -169,8 +169,7 @@ class _AudioPropertiesState extends State<AudioProperties> {
if (_text.text != text) _text.text = text;
}
if (ClipAudioGain.isDetached(record)) {
return Padding(
padding: AppTheme.propertySectionPadding(context),
return AppPropertySection(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
@@ -343,15 +342,18 @@ class _AudioPropertiesState extends State<AudioProperties> {
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Padding(
padding: AppTheme.propertySectionPadding(context),
AppPropertySection(
child: AppTheme.isDesktop(context)
? AppPropertyGroup(
label: widget.hasAudio
? context.l10n.volume
: context.l10n.unboundAudio,
actions: volumeActions,
child: volumeControls,
actions: volumeActions.skip(1).toList(),
padChild: false,
child: AppPropertyRow(
trailing: volumeActions.first,
children: [volumeControls],
),
)
: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
+56 -26
View File
@@ -196,8 +196,7 @@ class _CaptionPropertiesState extends State<CaptionProperties> {
: 28.0;
return Column(
children: [
Padding(
padding: AppTheme.propertySectionPadding(context),
AppPropertySection(
child: SizedBox(
height: AppTheme.propertyInputHeight(context),
child: Row(
@@ -226,9 +225,13 @@ class _CaptionPropertiesState extends State<CaptionProperties> {
vertical: 0,
),
prefixIcon: const Icon(AppIcons.search, size: 14),
prefixIconConstraints: const BoxConstraints(
minWidth: 28,
minHeight: 28,
prefixIconConstraints: BoxConstraints(
minWidth: AppTheme.isCompactInspector(context)
? 24
: 28,
minHeight: AppTheme.isCompactInspector(context)
? 24
: 28,
),
),
onChanged: (value) => setState(
@@ -448,7 +451,7 @@ class _CaptionPropertiesState extends State<CaptionProperties> {
Widget panel(Widget content) => WorkspacePanel(
paintBackground: false,
headerHeight: AppTheme.isDesktop(context)
? AppDesktopMetrics.panelHeader
? AppInspectorMetrics.sectionHeader
: CompactPanelTabs.height,
headerPadding: EdgeInsets.zero,
showHeaderDivider: false,
@@ -564,7 +567,9 @@ class _CaptionPropertiesState extends State<CaptionProperties> {
key: const ValueKey('caption-detail-scroll-fade'),
builder: (controller) => ListView(
controller: controller,
padding: const EdgeInsets.symmetric(vertical: AppSpacing.small),
padding: AppTheme.isDesktop(context)
? EdgeInsets.zero
: const EdgeInsets.symmetric(vertical: AppSpacing.small),
children:
[
if (AppTheme.isDesktop(context))
@@ -775,16 +780,21 @@ class _CaptionPropertiesState extends State<CaptionProperties> {
},
),
]
.where(
(item) =>
!AppTheme.isDesktop(context) ||
(item is! SizedBox && item is! Divider),
)
.map(
(item) =>
item is SizedBox ||
identical(item, widget.transformProperties)
? item
: AppTheme.isDesktop(context)
? AppPropertySection(child: item)
: Padding(
padding: EdgeInsets.symmetric(
horizontal: AppTheme.isDesktop(context)
? AppInspectorMetrics.padding
: AppSpacing.panelContentHorizontal,
padding: const EdgeInsets.symmetric(
horizontal: AppSpacing.panelContentHorizontal,
),
child: item,
),
@@ -804,11 +814,13 @@ class _CaptionTextInput extends StatefulWidget {
required this.editContext,
required this.onSubmit,
this.label,
this.leading,
this.maxLines = 1,
});
final String value;
final Object editContext;
final String? label;
final Widget? leading;
final int maxLines;
final bool Function(String) onSubmit;
@@ -870,6 +882,7 @@ class _CaptionTextInputState extends State<_CaptionTextInput> {
controller: _controller,
focusNode: _focus,
label: widget.label,
leading: widget.leading,
minLines: widget.maxLines,
maxLines: widget.maxLines,
textInputAction: TextInputAction.done,
@@ -901,17 +914,39 @@ class _CaptionColorInput extends StatelessWidget {
@override
Widget build(BuildContext context) {
final desktop = AppTheme.isDesktop(context);
final swatch = Container(
width: desktop ? 14 : 20,
height: desktop ? 14 : 20,
decoration: BoxDecoration(
color: Color(int.parse('FF${value.substring(1)}', radix: 16)),
border: Border.all(
color: desktop
? Theme.of(context).colorScheme.outlineVariant
: Theme.of(context).colorScheme.outline,
),
borderRadius: BorderRadius.circular(AppRadius.extraSmall),
),
);
if (desktop) {
return AppPropertyGroup(
label: label,
padChild: false,
child: AppPropertyRow(
reserveTrailing: false,
children: [
_CaptionTextInput(
value: value,
editContext: editContext,
leading: SizedBox(width: 24, child: Center(child: swatch)),
onSubmit: onSubmit,
),
],
),
);
}
final controls = Row(
children: [
Container(
width: 20,
height: 20,
decoration: BoxDecoration(
color: Color(int.parse('FF${value.substring(1)}', radix: 16)),
border: Border.all(color: Theme.of(context).colorScheme.outline),
borderRadius: BorderRadius.circular(AppRadius.extraSmall),
),
),
swatch,
const SizedBox(width: AppSpacing.small),
Expanded(
child: _CaptionTextInput(
@@ -923,11 +958,6 @@ class _CaptionColorInput extends StatelessWidget {
),
],
);
return desktop
? AppPropertyGroup(
label: label,
child: Semantics(label: label, child: controls),
)
: controls;
return controls;
}
}
@@ -94,8 +94,8 @@ class ColorInterpretationProperties extends ConsumerWidget {
),
],
);
return Padding(
padding: AppTheme.propertySectionPadding(context),
return AppPropertySection(
bottomSpacing: AppTheme.isDesktop(context) ? 0 : null,
child: AppTheme.isDesktop(context)
? ExpansionTile(
key: PageStorageKey((
@@ -109,9 +109,9 @@ class ColorInterpretationProperties extends ConsumerWidget {
),
tilePadding: EdgeInsets.zero,
childrenPadding: const EdgeInsets.only(
top: AppInspectorMetrics.rowGap,
bottom: AppInspectorMetrics.groupGap,
),
minTileHeight: AppInspectorMetrics.input,
minTileHeight: AppInspectorMetrics.sectionHeader,
dense: true,
maintainState: true,
initiallyExpanded: selected != null,
+98 -57
View File
@@ -180,7 +180,7 @@ class _MaskPropertiesState extends ConsumerState<MaskProperties> {
}
},
child: ListenableSelector<Object>(
listenable: preview,
listenable: Listenable.merge([preview, preview.positionChanges]),
select: () {
final mask = preview.maskFor(widget.element);
final animation = preview.maskAnimation(widget.element);
@@ -264,10 +264,11 @@ class _MaskPropertiesState extends ConsumerState<MaskProperties> {
}) => PropertyNumberInput(
key: ValueKey((selectedId, label)),
label: label,
inlineLabel: inlineLabel,
labelActions: AppTheme.isDesktop(context) && !inlineLabel
? [key(label)]
: const [],
inlineLabel: inlineLabel || AppTheme.isDesktop(context),
prefix: AppTheme.isDesktop(context) && !inlineLabel ? '' : null,
prefixIcon: AppTheme.isDesktop(context) && wrapRotation
? AppIcons.angle
: null,
unit: unit,
value: value,
enabled: enabled,
@@ -338,45 +339,65 @@ class _MaskPropertiesState extends ConsumerState<MaskProperties> {
if (mounted) setState(() => _scrubField = null);
},
);
Widget axes(String label, Widget first, Widget second) =>
LayoutBuilder(
builder: (context, constraints) {
final desktop = AppTheme.isDesktop(context);
final gap = AppTheme.propertyRowGap(context);
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
? AppPropertyGroup(
label: label,
actions: [key(label)],
child: pair,
)
: Row(
children: [
Expanded(child: pair),
SizedBox(width: gap),
key(label),
],
);
},
Widget axes(
String label,
Widget first,
Widget second, {
Widget? additional,
}) => LayoutBuilder(
builder: (context, constraints) {
final desktop = AppTheme.isDesktop(context);
final gap = AppTheme.propertyRowGap(context);
if (desktop) {
return AppPropertyGroup(
label: label,
padChild: false,
child: Column(
children: [
AppPropertyRow(
trailing: key(label),
children: [first, second],
),
?additional,
],
),
);
}
final pair = constraints.maxWidth < 240
? Column(
children: [
first,
SizedBox(height: gap),
second,
],
)
: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(child: first),
SizedBox(width: gap),
Expanded(child: second),
],
);
return Row(
children: [
Expanded(child: pair),
SizedBox(width: gap),
key(label),
],
);
},
);
Widget singleField(String label, Widget input) =>
AppTheme.isDesktop(context)
? input
? AppPropertyGroup(
label: label,
padChild: false,
child: AppPropertyRow(
trailing: key(label),
children: [input],
),
)
: Row(
children: [
Expanded(child: input),
@@ -395,8 +416,7 @@ class _MaskPropertiesState extends ConsumerState<MaskProperties> {
style: AppTheme.propertySectionTitleStyle(context),
),
);
Widget section(List<Widget> children) => Padding(
padding: AppTheme.propertySectionPadding(context),
Widget section(List<Widget> children) => AppPropertySection(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: children,
@@ -586,8 +606,11 @@ class _MaskPropertiesState extends ConsumerState<MaskProperties> {
if (AppTheme.isDesktop(context))
AppPropertyGroup(
label: context.l10n.type,
actions: [shapeReset()],
child: shapeSelector(),
padChild: false,
child: AppPropertyRow(
trailing: shapeReset(),
children: [shapeSelector()],
),
)
else
Row(
@@ -620,22 +643,40 @@ class _MaskPropertiesState extends ConsumerState<MaskProperties> {
unit: '%',
inlineLabel: true,
),
additional: AppTheme.isDesktop(context)
? AppPropertyRow(
trailing: key(context.l10n.rotation),
children: [
field(
context.l10n.rotation,
mask.rotation,
-180,
180,
(v) => mask.copyWith(rotation: v),
unit: '°',
wrapRotation: true,
),
const SizedBox.shrink(),
],
)
: null,
),
]),
section([
singleField(
context.l10n.rotation,
field(
if (!AppTheme.isDesktop(context))
section([
singleField(
context.l10n.rotation,
mask.rotation,
-180,
180,
(v) => mask.copyWith(rotation: v),
unit: '°',
wrapRotation: true,
field(
context.l10n.rotation,
mask.rotation,
-180,
180,
(v) => mask.copyWith(rotation: v),
unit: '°',
wrapRotation: true,
),
),
),
]),
]),
section([
heading(context.l10n.size),
axes(
+2 -1
View File
@@ -100,7 +100,8 @@ class PictureEdits extends _$PictureEdits {
value.y == current.y &&
value.scale == current.scale &&
value.scaleY == current.scaleY &&
value.rotation == current.rotation) {
value.rotation == current.rotation &&
value.sameCorners(current)) {
return true;
}
session.commands.setTransform(
+1 -1
View File
@@ -58,7 +58,7 @@ final class PictureEditsProvider
}
}
String _$pictureEditsHash() => r'6385f3bd53094d57ed054681d142591e059e8b08';
String _$pictureEditsHash() => r'5a8ab10fcac9638fb0d98e214744f190fa499434';
final class PictureEditsFamily extends $Family
with
+260 -78
View File
@@ -22,6 +22,7 @@ import '../../shared/state/operation_scope.dart';
import '../preview/preview_panel.dart';
import 'property_number_input.dart';
import 'picture_edits.dart';
import 'shadow_properties.dart';
class PictureProperties extends ConsumerStatefulWidget {
const PictureProperties({
@@ -57,6 +58,7 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
late final _operations = OperationScope<Object>(_operationContext);
late final _seeks = OperationScope<Object>(_operationContext);
bool _locked = true;
bool? _independentCorners;
bool _hasFocusedControl = false;
PictureEditsProvider get _editProvider =>
pictureEditsProvider(widget.session, widget.sequence, widget.clip.id);
@@ -87,6 +89,7 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
oldWidget.clip.id,
);
if (previousIdentity != _editIdentity) {
_independentCorners = null;
final edit = _clearScrub();
if (edit != null) scheduleMicrotask(edit.cancel);
}
@@ -204,7 +207,8 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
value.y == _scrubBase!.y &&
value.rotation == _scrubBase!.rotation &&
value.scale == _scrubBase!.scale &&
value.scaleY == _scrubBase!.scaleY)) {
value.scaleY == _scrubBase!.scaleY &&
value.sameCorners(_scrubBase!))) {
_cancelScrub();
return;
}
@@ -267,6 +271,12 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
value.scale,
value.scaleY,
value.rotation,
value.cornerRadius,
value.topLeftRadius,
value.topRightRadius,
value.bottomRightRadius,
value.bottomLeftRadius,
_independentCorners,
_scrubValid,
_scrubBase != null,
_saving,
@@ -359,36 +369,46 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
final desktop = AppTheme.isDesktop(context);
final gap = AppTheme.propertyRowGap(context);
Widget axes(TransformChannel channel, Widget first, Widget second) =>
LayoutBuilder(
builder: (context, constraints) {
final pair = constraints.maxWidth < (desktop ? 180 : 240)
? Column(
children: [
first,
SizedBox(height: gap),
second,
],
)
: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(child: first),
SizedBox(width: gap),
Expanded(child: second),
],
);
return desktop
? pair
: Row(
children: [
Expanded(child: pair),
SizedBox(width: gap),
keyButton(channel),
],
);
},
Widget axes(
TransformChannel channel,
Widget first,
Widget second, {
Widget? trailing,
}) => LayoutBuilder(
builder: (context, constraints) {
if (desktop) {
return AppPropertyRow(
trailing: channel == TransformChannel.position
? keyButton(channel)
: trailing,
children: [first, second],
);
}
final pair = constraints.maxWidth < 240
? Column(
children: [
first,
SizedBox(height: gap),
second,
],
)
: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(child: first),
SizedBox(width: gap),
Expanded(child: second),
],
);
return Row(
children: [
Expanded(child: pair),
SizedBox(width: gap),
keyButton(channel),
],
);
},
);
Widget keyTools(TransformChannel channel) {
if (animation == null || !animation.animated(channel)) {
@@ -488,17 +508,23 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
bool inlineLabel = false,
String? prefix,
IconData? prefixIcon,
int prefixQuarterTurns = 0,
String? valueText,
}) => PropertyNumberInput(
key: ValueKey(id),
label: label,
inlineLabel: inlineLabel,
prefix: prefix,
prefixIcon: prefixIcon,
prefixQuarterTurns: prefixQuarterTurns,
valueText: valueText,
unit: unit,
value: value,
enabled: !_saving,
readOnly: _scrubBase != null || preview?.transforms.hasPending == true,
submit: (v) => _commit(preview, (current) => change(current, v)),
submit: (v) => v < min || v > max
? Future.value(false)
: _commit(preview, (current) => change(current, v)),
onScrubStart: () => _startScrub(
preview,
id,
@@ -520,8 +546,7 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
widget.session.view(widget.sequence).playheadTick,
),
);
Widget section(List<Widget> children) => Padding(
padding: AppTheme.propertySectionPadding(context),
Widget section(List<Widget> children) => AppPropertySection(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: children,
@@ -555,7 +580,10 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
prefixIcon: desktop ? AppIcons.angle : null,
);
final rotation = desktop
? rotationInput
? AppPropertyRow(
trailing: keyButton(TransformChannel.rotation),
children: [rotationInput, const SizedBox.shrink()],
)
: Row(
children: [
Expanded(child: rotationInput),
@@ -563,7 +591,7 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
keyButton(TransformChannel.rotation),
],
);
final scale = axes(
Widget scaleControls({Widget? trailing}) => axes(
TransformChannel.scale,
number(
'picture-scale-x',
@@ -595,6 +623,7 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
: 10000,
inlineLabel: true,
),
trailing: trailing,
);
final lock = IconButton(
key: const Key('picture-lock'),
@@ -610,11 +639,10 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
}
: null,
);
final scale = scaleControls();
final alignmentControls = LayoutBuilder(
builder: (context, constraints) => Wrap(
spacing: AppSpacing.small,
runSpacing: AppSpacing.small,
children: [
builder: (context, constraints) {
final groups = <Widget>[
for (final group in [
[
(
@@ -648,7 +676,9 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
],
])
SizedBox(
width: constraints.maxWidth < 200
width: desktop
? null
: constraints.maxWidth < 200
? constraints.maxWidth
: (constraints.maxWidth - AppSpacing.small) / 2,
child: AppButtonGroup(
@@ -675,9 +705,89 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
],
),
),
],
),
];
if (desktop) return AppPropertyRow(children: groups);
return Wrap(
spacing: AppSpacing.small,
runSpacing: AppSpacing.small,
children: groups,
);
},
);
final radiusInput = number(
'picture-corner-radius',
context.l10n.cornerRadius,
value.topLeftRadius,
(c, v) => c.copyWith(cornerRadius: v),
min: 0,
max: 1000000,
inlineLabel: desktop,
prefix: desktop ? '' : null,
prefixIcon: desktop ? AppIcons.cornerRadius : null,
valueText: value.hasMixedCorners ? '—' : null,
);
final independent = _independentCorners ?? value.hasMixedCorners;
final cornerToggle = IconButton(
key: const ValueKey('picture-independent-corners'),
tooltip: context.l10n.independentCorners,
icon: const Icon(AppIcons.independentCorners),
isSelected: independent,
onPressed:
enabled &&
_scrubBase == null &&
preview?.transforms.hasPending != true
? () => setState(() => _independentCorners = !independent)
: null,
);
final cornerInputs = [
number(
'picture-corner-top-left',
context.l10n.cornerTopLeft,
value.topLeftRadius,
(c, v) => c.copyWith(topLeftRadius: v),
min: 0,
max: 1000000,
inlineLabel: true,
prefix: '',
prefixIcon: Icons.rounded_corner,
prefixQuarterTurns: 3,
),
number(
'picture-corner-top-right',
context.l10n.cornerTopRight,
value.topRightRadius,
(c, v) => c.copyWith(topRightRadius: v),
min: 0,
max: 1000000,
inlineLabel: true,
prefix: '',
prefixIcon: Icons.rounded_corner,
),
number(
'picture-corner-bottom-left',
context.l10n.cornerBottomLeft,
value.bottomLeftRadius,
(c, v) => c.copyWith(bottomLeftRadius: v),
min: 0,
max: 1000000,
inlineLabel: true,
prefix: '',
prefixIcon: Icons.rounded_corner,
prefixQuarterTurns: 2,
),
number(
'picture-corner-bottom-right',
context.l10n.cornerBottomRight,
value.bottomRightRadius,
(c, v) => c.copyWith(bottomRightRadius: v),
min: 0,
max: 1000000,
inlineLabel: true,
prefix: '',
prefixIcon: Icons.rounded_corner,
prefixQuarterTurns: 1,
),
];
final content = Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
@@ -690,46 +800,43 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
),
]),
],
if (!widget.animationView)
if (!widget.animationView && !desktop)
section([
if (desktop)
AppPropertyGroup(
label: context.l10n.alignment,
child: alignmentControls,
)
else ...[
Text(
context.l10n.alignment,
style: AppTheme.propertySectionTitleStyle(context),
),
SizedBox(height: gap),
alignmentControls,
],
Text(
context.l10n.alignment,
style: AppTheme.propertySectionTitleStyle(context),
),
SizedBox(height: gap),
alignmentControls,
]),
if (desktop) ...[
section([
AppPropertyGroup(
label: context.l10n.position,
actions: [keyButton(TransformChannel.position)],
child: position,
padChild: false,
child: Column(
children: [
if (!widget.animationView) alignmentControls,
position,
keyTools(TransformChannel.position),
rotation,
keyTools(TransformChannel.rotation),
],
),
),
keyTools(TransformChannel.position),
]),
section([
AppPropertyGroup(
label: context.l10n.scale,
actions: [lock, keyButton(TransformChannel.scale)],
child: scale,
actions: [keyButton(TransformChannel.scale)],
padChild: false,
child: Column(
children: [
scaleControls(trailing: lock),
keyTools(TransformChannel.scale),
],
),
),
keyTools(TransformChannel.scale),
]),
section([
AppPropertyGroup(
label: context.l10n.rotation,
actions: [keyButton(TransformChannel.rotation)],
child: rotation,
),
keyTools(TransformChannel.rotation),
]),
] else ...[
section([
@@ -759,6 +866,68 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
keyTools(TransformChannel.scale),
]),
],
section([
if (desktop)
AppPropertyGroup(
label: context.l10n.cornerRadius,
padChild: false,
child: Column(
children: [
AppPropertyRow(
trailing: keyButton(TransformChannel.cornerRadius),
children: [
radiusInput,
Align(
alignment: Alignment.centerRight,
child: cornerToggle,
),
],
),
if (independent) ...[
AppPropertyRow(children: cornerInputs.sublist(0, 2)),
AppPropertyRow(children: cornerInputs.sublist(2, 4)),
],
keyTools(TransformChannel.cornerRadius),
],
),
)
else ...[
Row(
children: [
Expanded(child: radiusInput),
SizedBox(width: gap),
cornerToggle,
keyButton(TransformChannel.cornerRadius),
],
),
if (independent) ...[
SizedBox(height: gap),
Row(
children: [
Expanded(child: cornerInputs[0]),
SizedBox(width: gap),
Expanded(child: cornerInputs[1]),
],
),
SizedBox(height: gap),
Row(
children: [
Expanded(child: cornerInputs[2]),
SizedBox(width: gap),
Expanded(child: cornerInputs[3]),
],
),
],
keyTools(TransformChannel.cornerRadius),
],
]),
ShadowProperties(
projectId: widget.projectId,
timelineId: widget.timelineId,
session: widget.session,
sequence: widget.sequence,
clip: widget.clip.id,
),
if (_error != null)
section([
Text(
@@ -824,7 +993,22 @@ class _KeyframeTimeline extends StatelessWidget {
],
),
const SizedBox(height: AppSpacing.small),
for (final channel in TransformChannel.values)
for (final (id, label, times) in [
for (final channel in TransformChannel.values)
(channel.name, channel.label(context), animation.keyTimes(channel)),
if (ClipShadowStack(
animation.record,
animation.localTick,
).layers.isNotEmpty)
(
'shadow',
context.l10n.shadow,
ClipShadowStack(
animation.record,
animation.localTick,
).keyOffsets.map((t) => animation.start + t).toList(),
),
])
SizedBox(
height: 32,
child: Row(
@@ -832,7 +1016,7 @@ class _KeyframeTimeline extends StatelessWidget {
SizedBox(
width: 36,
child: Text(
channel.label(context),
label,
style: Theme.of(context).textTheme.bodySmall,
),
),
@@ -851,7 +1035,7 @@ class _KeyframeTimeline extends StatelessWidget {
) *
extent;
return GestureDetector(
key: ValueKey('picture-key-track-${channel.name}'),
key: ValueKey('picture-key-track-$id'),
behavior: HitTestBehavior.opaque,
onTapDown: !enabled
? null
@@ -883,18 +1067,16 @@ class _KeyframeTimeline extends StatelessWidget {
width: 1,
child: ColoredBox(color: colors.primary),
),
for (final tick in animation.keyTimes(channel))
for (final tick in times)
Positioned(
left: x(tick) - AppControlSize.compact / 2,
top: 4,
width: AppControlSize.compact,
height: AppControlSize.compact,
child: IconButton(
key: ValueKey(
'picture-key-marker-${channel.name}-$tick',
),
key: ValueKey('picture-key-marker-$id-$tick'),
tooltip:
'${channel.label(context)} ${((tick - animation.start) / TimelineClock.ticksPerSecond).toStringAsFixed(2)} s',
'$label ${((tick - animation.start) / TimelineClock.ticksPerSecond).toStringAsFixed(2)} s',
padding: EdgeInsets.zero,
onPressed: enabled
? () => onSeek(tick)
+14 -10
View File
@@ -39,7 +39,9 @@ class ProjectProperties extends StatelessWidget {
height: AppTheme.isDesktop(context) ? AppInspectorMetrics.input : null,
child: TextButton(
key: const ValueKey('project-settings-edit'),
style: AppTheme.isDesktop(context)
style:
AppTheme.isDesktop(context) &&
!AppTheme.isCompactInspector(context)
? AppTheme.toolbarButtonStyle(context)
: null,
onPressed: () => showAppDialog<void>(
@@ -50,14 +52,17 @@ class ProjectProperties extends StatelessWidget {
),
),
headerHeight: AppTheme.isDesktop(context)
? AppDesktopMetrics.panelHeader
? AppInspectorMetrics.sectionHeader
: AppControlSize.panelToolbar,
headerPadding: EdgeInsets.symmetric(
horizontal: AppTheme.isDesktop(context)
? AppInspectorMetrics.padding
: AppSpacing.panelContentHorizontal,
),
showHeaderDivider: false,
headerPadding: AppTheme.isDesktop(context)
? const EdgeInsets.only(
left: AppInspectorMetrics.padding,
right: AppInspectorMetrics.trailingPadding,
)
: const EdgeInsets.symmetric(
horizontal: AppSpacing.panelContentHorizontal,
),
showHeaderDivider: AppTheme.isCompactInspector(context),
child: ScrollEdgeFadeBuilder(
builder: (controller) => SingleChildScrollView(
controller: controller,
@@ -133,8 +138,7 @@ class _Info extends StatelessWidget {
style: Theme.of(context).textTheme.bodyMedium,
),
);
return Padding(
padding: AppTheme.propertySectionPadding(context),
return AppPropertySection(
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
spacing: AppSpacing.small,
@@ -14,9 +14,11 @@ class ProjectPropertyRow extends StatelessWidget {
@override
Widget build(BuildContext context) => Padding(
padding: const EdgeInsets.symmetric(
horizontal: AppInspectorMetrics.padding,
vertical: AppInspectorMetrics.rowGap,
padding: const EdgeInsets.fromLTRB(
AppInspectorMetrics.padding,
AppInspectorMetrics.rowPadding,
AppInspectorMetrics.trailingPadding,
AppInspectorMetrics.rowPadding,
),
child: ConstrainedBox(
constraints: const BoxConstraints(minHeight: AppInspectorMetrics.input),
@@ -35,13 +37,11 @@ class ProjectPropertyRow extends StatelessWidget {
label,
maxLines: 3,
overflow: TextOverflow.ellipsis,
style: AppTheme.toolbarTextStyle(context).copyWith(
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
style: AppTheme.propertyLabelStyle(context),
),
),
),
const SizedBox(width: AppInspectorMetrics.rowGap * 2),
const SizedBox(width: AppInspectorMetrics.rowGap),
Expanded(
flex: 3,
child: Tooltip(
@@ -51,7 +51,7 @@ class ProjectPropertyRow extends StatelessWidget {
maxLines: 3,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.right,
style: AppTheme.toolbarTextStyle(context),
style: AppTheme.inputTextStyle(context),
),
),
),
@@ -20,8 +20,10 @@ Widget lightProjectSummaryPreview() => _preview(Brightness.light);
Widget _preview(Brightness brightness) => MaterialApp(
debugShowCheckedModeBanner: false,
theme: AppTheme.desktopWorkspaceTheme(
AppTheme.forPalette(AppPalette.graphite, brightness),
theme: AppTheme.propertiesPanelTheme(
AppTheme.desktopWorkspaceTheme(
AppTheme.forPalette(AppPalette.graphite, brightness),
),
),
home: const Scaffold(
body: SingleChildScrollView(
@@ -20,7 +20,7 @@ class EditorPropertiesPanel extends StatelessWidget {
projectId: projectId,
timelineId: timelineId,
categoryHeaderHeight: AppTheme.isDesktop(context)
? AppDesktopMetrics.panelHeader
? AppInspectorMetrics.sectionHeader
: CompactPanelTabs.height,
categoryControls: (context, categories, selected, onSelected) =>
CompactPanelTabs<PropertyCategory>(
@@ -19,6 +19,8 @@ class PropertyNumberInput extends StatefulWidget {
this.inlineLabel = false,
this.prefix,
this.prefixIcon,
this.prefixQuarterTurns = 0,
this.valueText,
this.labelActions = const [],
this.decimalPlaces = 2,
this.onScrubStart,
@@ -33,6 +35,8 @@ class PropertyNumberInput extends StatefulWidget {
final bool inlineLabel;
final String? prefix;
final IconData? prefixIcon;
final int prefixQuarterTurns;
final String? valueText;
final List<Widget> labelActions;
final int decimalPlaces;
final bool Function()? onScrubStart;
@@ -50,11 +54,12 @@ class PropertyNumberInput extends StatefulWidget {
}
class _PropertyNumberInputState extends State<PropertyNumberInput> {
late final _text = TextEditingController(text: _format(widget.value));
late final _text = TextEditingController(text: _displayValue);
final _focus = FocusNode();
bool _dirty = false;
late final _operations = OperationScope<Object>(widget.editContext);
String? _error;
String get _displayValue => widget.valueText ?? _format(widget.value);
String _format(double value) {
var text = value.toStringAsFixed(widget.decimalPlaces);
if (text.contains('.')) text = text.replaceFirst(RegExp(r'\.?0+$'), '');
@@ -84,7 +89,7 @@ class _PropertyNumberInputState extends State<PropertyNumberInput> {
if (!mounted || !isCurrent()) return;
setState(() {
_error = accepted ? null : context.l10n.notApplied;
_text.text = _format(widget.value);
_text.text = _displayValue;
});
}
@@ -98,7 +103,7 @@ class _PropertyNumberInputState extends State<PropertyNumberInput> {
_dirty = false;
_error = null;
}
final text = _format(widget.value);
final text = _displayValue;
// A no-op assignment still resets selection and asks EditableText to
// reveal its caret, competing with the user's scroll on preview updates.
if (!_dirty && _text.text != text) _text.text = text;
@@ -115,8 +120,8 @@ class _PropertyNumberInputState extends State<PropertyNumberInput> {
@override
Widget build(BuildContext context) {
final labelAbove =
AppTheme.isCompactInspector(context) && !widget.inlineLabel;
final compact = AppTheme.isCompactInspector(context);
final labelAbove = compact && !widget.inlineLabel;
final label = widget.onScrubStart == null
? Text(widget.label ?? '', style: AppTheme.propertyLabelStyle(context))
: AppScrubLabel(
@@ -126,7 +131,7 @@ class _PropertyNumberInputState extends State<PropertyNumberInput> {
? AppTheme.propertySectionTitleStyle(context)
: null,
alignment: labelAbove ? Alignment.centerLeft : Alignment.center,
padding: labelAbove
padding: labelAbove || compact
? EdgeInsets.zero
: const EdgeInsets.symmetric(horizontal: AppSpacing.small),
enabled: widget.enabled && (!widget.readOnly || widget.scrubbing),
@@ -134,7 +139,7 @@ class _PropertyNumberInputState extends State<PropertyNumberInput> {
_operations.invalidate();
_dirty = false;
_error = null;
_text.text = _format(widget.value);
_text.text = _displayValue;
return widget.onScrubStart!();
},
onUpdate: widget.onScrubUpdate,
@@ -154,7 +159,17 @@ class _PropertyNumberInputState extends State<PropertyNumberInput> {
label: widget.label,
labelAbove: labelAbove,
labelActions: widget.labelActions,
leading: widget.onScrubStart == null ? null : label,
leading: widget.onScrubStart == null
? null
: compact && !labelAbove
? SizedBox(
width: AppInspectorMetrics.action,
child: RotatedBox(
quarterTurns: widget.prefixQuarterTurns,
child: label,
),
)
: label,
unit: widget.unit,
errorText: _error,
onChanged: (_) {
@@ -173,7 +188,7 @@ class _PropertyNumberInputState extends State<PropertyNumberInput> {
_operations.invalidate();
_dirty = false;
_error = null;
_text.text = _format(widget.value);
_text.text = _displayValue;
});
_focus.unfocus();
return KeyEventResult.handled;
File diff suppressed because it is too large. Load diff
@@ -204,15 +204,14 @@ class _SpeedPropertiesState extends State<SpeedProperties> {
_version == null || identical(_version, view.version.kernelVersion)
? _timeline ?? saved ?? 1
: saved ?? 1;
return Padding(
padding: AppTheme.propertySectionPadding(context),
return AppPropertySection(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
ConstrainedBox(
constraints: BoxConstraints(
minHeight: AppTheme.isDesktop(context)
? AppInspectorMetrics.action
? AppInspectorMetrics.sectionHeader
: AppControlSize.propertyControl,
),
child: Row(