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

This commit was merged in pull request #13.
This commit is contained in:
lingjhf committed 2026-10-08 18:17:12 +00:00
1 parent aa5255d1e4
commit abc1868550
260 files changed
+43964 -5591

No files matched your search

+161
View File
@@ -7,6 +7,167 @@ import 'package:flutter/rendering.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('slider density follows inspector and desktop contexts', (
tester,
) async {
final desktop = AppTheme.desktopWorkspaceTheme(AppTheme.penDark);
for (final (theme, height) in [
(AppTheme.propertiesPanelTheme(desktop), 28.0),
(desktop, 36.0),
(
AppTheme.propertiesPanelTheme(AppTheme.penDark),
AppControlSize.standard,
),
]) {
await tester.pumpWidget(
MaterialApp(
theme: theme,
home: Scaffold(
body: Center(
child: SizedBox(
width: 220,
child: AppSlider(value: .5, onChanged: (_) {}),
),
),
),
),
);
await tester.pumpAndSettle();
expect(tester.getSize(find.byType(AppSlider)).height, height);
expect(tester.takeException(), isNull);
}
});
test(
'inspector density leaves general desktop and touch inputs unchanged',
() {
final desktop = AppTheme.desktopWorkspaceTheme(AppTheme.penDark);
final inspector = AppTheme.propertiesPanelTheme(desktop);
expect(desktop.inputDecorationTheme.constraints!.minHeight, 36);
expect(inspector.inputDecorationTheme.constraints!.minHeight, 28);
expect(inspector.textTheme.bodyMedium!.fontSize, 13);
expect(inspector.textTheme.bodySmall!.fontSize, 12);
expect(
inspector.iconButtonTheme.style!.fixedSize!.resolve({}),
const Size.square(24),
);
expect(desktop.extension<InspectorControlDensity>(), isNull);
expect(inspector.extension<InspectorControlDensity>(), isNotNull);
final dialog = AppTheme.dialogContentTheme(inspector);
expect(dialog.extension<InspectorControlDensity>(), isNull);
expect(dialog.inputDecorationTheme.constraints!.minHeight, 36);
expect(dialog.textTheme.bodyMedium!.fontSize, 14);
final touch = AppTheme.propertiesPanelTheme(AppTheme.penDark);
expect(touch.extension<InspectorControlDensity>(), isNull);
expect(
touch.iconButtonTheme.style!.fixedSize!.resolve({}),
const Size.square(28),
);
},
);
testWidgets('multiline input keeps its first line near the top', (
tester,
) async {
final controller = TextEditingController(text: 'First\nSecond');
addTearDown(controller.dispose);
await tester.pumpWidget(
MaterialApp(
theme: AppTheme.desktopWorkspaceTheme(AppTheme.penDark),
home: Scaffold(
body: Center(
child: SizedBox(
width: 240,
height: 100,
child: AppTextField(
controller: controller,
minLines: 3,
maxLines: 3,
),
),
),
),
),
);
await tester.pumpAndSettle();
final editable = tester
.state<EditableTextState>(find.byType(EditableText))
.renderEditable;
final caret = editable.getLocalRectForCaret(const TextPosition(offset: 0));
expect(
editable.localToGlobal(caret.center).dy -
tester.getTopLeft(find.byType(TextField)).dy,
lessThan(25),
);
expect(tester.takeException(), isNull);
await tester.pumpWidget(const SizedBox());
});
testWidgets('labelled single-line inputs keep text and caret centered', (
tester,
) async {
final controller = TextEditingController(text: '125');
addTearDown(controller.dispose);
for (final brightness in Brightness.values) {
for (final desktop in [false, true]) {
final base = AppTheme.forPalette(AppPalette.graphite, brightness);
final theme = AppTheme.propertiesPanelTheme(
desktop ? AppTheme.desktopWorkspaceTheme(base) : base,
);
final height = desktop
? AppInspectorMetrics.input
: AppControlSize.propertyControl;
await tester.pumpWidget(
MaterialApp(
theme: theme,
home: Scaffold(
body: Center(
child: SizedBox(
width: 240,
height: height,
child: AppTextField(
controller: controller,
label: 'W',
unit: '%',
hintText: 'Value',
),
),
),
),
),
);
await tester.pumpAndSettle();
final field = find.byType(TextField);
final label = find.text('W');
expect(
tester.getRect(label).center.dy,
tester.getRect(field).center.dy,
);
expect(
tester.widget<TextField>(field).decoration!.prefixIcon,
isNotNull,
);
for (final text in ['', '125', '项目']) {
await tester.enterText(field, text);
await tester.pump();
final editable = tester
.state<EditableTextState>(find.byType(EditableText))
.renderEditable;
final caret = editable.getLocalRectForCaret(
TextPosition(offset: text.length),
);
expect(
editable.localToGlobal(caret.center).dy,
closeTo(tester.getCenter(field).dy, 1),
);
expect(tester.getSize(field).height, height);
expect(tester.takeException(), isNull);
}
await tester.pumpWidget(const SizedBox());
}
}
});
test('Icon button states use translucent ink without stacking selection', () {
final style = AppTheme.penDark.iconButtonTheme.style!;
const ink = Color(0xFFFCFCFC);