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

+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(