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

+90 -13
View File
@@ -1,4 +1,7 @@
import 'package:cutdex/app/editor_theme.dart';
import 'package:cutdex/features/editor/layouts/bounded_editor_layout.dart';
import 'package:cutdex/features/editor/editor_presentation_controller.dart';
import 'package:cutdex/integrations/platform/device_experience.dart';
import 'package:cutdex/features/preview/preview_panel.dart';
import 'package:cutdex/features/properties/picture_properties.dart';
import 'package:cutdex/features/properties/audio_properties.dart';
@@ -15,6 +18,50 @@ import 'package:flutter_test/flutter_test.dart';
import 'support/preview_fixture.dart';
void main() {
testWidgets(
'floating desktop inspector keeps the UI3 width in narrow windows',
(tester) async {
for (final width in [200.0, 320.0, 800.0]) {
await tester.pumpWidget(
MaterialApp(
localizationsDelegates: AppLocalizations.localizationsDelegates,
supportedLocales: AppLocalizations.supportedLocales,
locale: const Locale('en'),
theme: EditorTheme.desktop(EditorTheme.penDark),
home: Scaffold(
body: Align(
alignment: Alignment.topRight,
child: SizedBox(
width: width,
height: 400,
child: BoundedEditorLayout(
experience: DeviceExperience.desktop,
editing: const SizedBox.expand(),
tool: EditorTool.properties,
media: const SizedBox.expand(),
properties: const SizedBox.expand(),
onCloseTool: () {},
),
),
),
),
),
);
await tester.pumpAndSettle();
expect(
tester.getSize(find.byKey(const Key('editor-tool-surface'))).width,
width < 240 ? width : 240,
);
final title = tester.widget<Text>(
find.byWidgetPredicate((w) => w is Text && w.style?.fontSize == 13),
);
expect(title.style!.fontSize, 13);
expect(title.style!.height, 22 / 13);
expect(tester.takeException(), isNull);
}
},
);
testWidgets(
'audio and speed controls fit desktop group headers at narrow widths',
(tester) async {
@@ -74,10 +121,10 @@ void main() {
of: find.byKey(const Key('audio-db')),
matching: find.byType(TextField),
);
expect(tester.getSize(field).height, 28);
expect(tester.getSize(field).height, 24);
expect(
tester.getRect(find.byKey(const Key('audio-key'))).bottom,
tester.getRect(field).top - 4,
tester.getRect(find.byKey(const Key('audio-key'))).center.dy,
tester.getRect(field).center.dy,
);
expect(find.byType(AppPropertyGroup), findsNWidgets(2));
expect(tester.takeException(), isNull);
@@ -120,6 +167,7 @@ void main() {
for (final brightness in Brightness.values) {
for (final (width, locale) in [
(220.0, 'de'),
(240.0, 'en'),
(280.0, 'zh'),
(360.0, 'en'),
]) {
@@ -157,13 +205,34 @@ void main() {
);
await tester.pumpAndSettle();
for (final name in ['x', 'y', 'scale-x', 'scale-y', 'rotation']) {
expect(tester.getSize(input(name)).height, 28);
expect(tester.getSize(input(name)).height, 24);
}
expect(tester.getRect(input('x')).left, 12);
expect(tester.getRect(input('x')).width, (width - 28) / 2);
expect(tester.getRect(input('x')).left, 16);
expect(tester.getRect(input('x')).width, (width - 64) / 2);
expect(tester.getRect(input('rotation')).width, (width - 64) / 2);
expect(find.byType(AppPropertyGroup), findsNWidgets(4));
expect(
tester.getRect(input('corner-radius')).width,
(width - 64) / 2,
);
expect(
tester.getSize(find.byType(AppPropertySection).first).height,
148,
);
final align = find.byKey(const ValueKey('picture-align-left'));
final verticalAlign = find.byKey(const ValueKey('picture-align-top'));
expect(
tester.getCenter(align).dy,
tester.getCenter(verticalAlign).dy,
);
for (final name in ['x', 'y', 'scale-x', 'scale-y', 'rotation']) {
final field = tester.widget<TextField>(input(name));
expect(field.decoration!.prefixIcon, isNotNull);
final handle = find.descendant(
of: find.byKey(ValueKey('picture-$name')),
matching: find.byType(AppScrubLabel),
);
expect(tester.getSize(handle).width, 24);
}
expect(
find.descendant(
@@ -194,12 +263,20 @@ void main() {
? 'scale-x'
: 'rotation',
);
expect(
tester.getRect(action).bottom,
tester.getRect(field).top - 4,
);
if (channel == 'scale') {
expect(
tester.getRect(action).bottom,
tester.getRect(field).top - 12,
);
} else {
expect(tester.getCenter(action).dy, tester.getCenter(field).dy);
}
}
expect(right, width - 12);
expect(
tester.getCenter(find.byKey(const Key('picture-lock'))).dy,
tester.getCenter(input('scale-x')).dy,
);
expect(right, width - 8);
expect(
tester.getRect(input('x')).left,
tester.getRect(input('rotation')).left,
@@ -215,8 +292,8 @@ void main() {
);
expect(
tester.getRect(input('rotation')).top -
tester.getRect(input('scale-x')).bottom,
40,
tester.getRect(input('x')).bottom,
8,
);
}
expect(