feat(ui): align desktop controls and inspector typography with Figma UI3
This commit is contained in:
1 parent
abc1868550
commit
bc3fdd6119
45 files changed
+1806
-227
No files matched your search
@@ -19,8 +19,7 @@ void main() {
|
||||
home: Scaffold(
|
||||
body: SizedBox(
|
||||
width: 220,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: AppPropertySection(
|
||||
child: AppPropertyGroup(
|
||||
label: 'Position',
|
||||
actions: [
|
||||
@@ -38,7 +37,7 @@ void main() {
|
||||
errorText: 'Invalid value',
|
||||
),
|
||||
),
|
||||
SizedBox(width: 4),
|
||||
SizedBox(width: AppInspectorMetrics.rowGap),
|
||||
Expanded(child: AppTextField(label: 'Y')),
|
||||
],
|
||||
),
|
||||
@@ -51,8 +50,8 @@ void main() {
|
||||
await tester.pumpAndSettle();
|
||||
final first = find.byType(TextField).first;
|
||||
final second = find.byType(TextField).last;
|
||||
expect(tester.getRect(first).width, 96);
|
||||
expect(tester.getRect(second).right, 208);
|
||||
expect(tester.getRect(first).width, 94);
|
||||
expect(tester.getRect(second).right, 212);
|
||||
expect(tester.getRect(first).top, tester.getRect(second).top);
|
||||
expect(
|
||||
tester.getRect(first).height,
|
||||
@@ -60,7 +59,7 @@ void main() {
|
||||
);
|
||||
expect(
|
||||
tester.getRect(find.byType(IconButton)).bottom,
|
||||
tester.getRect(first).top - 4,
|
||||
tester.getRect(first).top - 12,
|
||||
);
|
||||
expect(
|
||||
tester.widget<TextField>(first).decoration!.prefixIcon,
|
||||
|
||||
@@ -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),
|
||||
|
||||
Reference in new issue
Block a user