feat(ui): align desktop controls and inspector typography with Figma UI3

This commit is contained in:
lingjhf committed 2026-10-09 19:20:54 +08:00
1 parent abc1868550
commit bc3fdd6119
45 files changed
+1806 -227

No files matched your search

+71 -4
View File
@@ -7,12 +7,79 @@ import 'package:flutter/rendering.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
test(
'desktop inspector keeps panel colors with UI3 typography and inputs',
() {
for (final palette in AppPalette.values) {
for (final brightness in Brightness.values) {
final base = AppTheme.desktopWorkspaceTheme(
AppTheme.forPalette(palette, brightness),
);
final theme = AppTheme.propertiesPanelTheme(base);
final dark = brightness == Brightness.dark;
expect(
theme.colorScheme.surface,
base.colorScheme.surfaceContainerLow,
);
expect(theme.canvasColor, base.colorScheme.surfaceContainerLow);
expect(
theme.colorScheme.surfaceContainerLow,
base.colorScheme.surfaceContainerLow,
);
expect(theme.scaffoldBackgroundColor, base.scaffoldBackgroundColor);
expect(
theme.inputDecorationTheme.fillColor,
dark ? const Color(0xFF383838) : const Color(0xFFF5F5F5),
);
expect(
theme.colorScheme.onSurface,
dark ? Colors.white : Colors.black.withValues(alpha: .9),
);
expect(
theme.colorScheme.onSurfaceVariant,
dark
? Colors.white.withValues(alpha: .7)
: Colors.black.withValues(alpha: .5),
);
expect(
theme.dividerColor,
dark ? const Color(0xFF444444) : const Color(0xFFE6E6E6),
);
expect(theme.colorScheme.primary, base.colorScheme.primary);
final text = theme.textTheme.bodyMedium!;
expect(text.fontFamily, 'packages/cutdex_ui/Inter');
expect(
text.fontFamilyFallback,
base.textTheme.bodyMedium!.fontFamilyFallback,
);
expect(text.fontSize, 11);
expect(text.height! * text.fontSize!, closeTo(16, .001));
expect(text.fontVariations, const [ui.FontVariation('wght', 450)]);
expect(text.letterSpacing, closeTo(.055, .001));
expect(
(theme.inputDecorationTheme.enabledBorder! as OutlineInputBorder)
.borderRadius,
BorderRadius.circular(5),
);
expect(
theme.inputDecorationTheme.enabledBorder!.borderSide,
BorderSide.none,
);
expect(
theme.inputDecorationTheme.focusedBorder!.borderSide.color,
base.colorScheme.primary,
);
}
}
},
);
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),
(AppTheme.propertiesPanelTheme(desktop), 24.0),
(desktop, 36.0),
(
AppTheme.propertiesPanelTheme(AppTheme.penDark),
@@ -44,9 +111,9 @@ void main() {
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.inputDecorationTheme.constraints!.minHeight, 24);
expect(inspector.textTheme.bodyMedium!.fontSize, 11);
expect(inspector.textTheme.bodySmall!.fontSize, 11);
expect(
inspector.iconButtonTheme.style!.fixedSize!.resolve({}),
const Size.square(24),