feat(draw): DrawingCard widget — SVG region + themed caption (T-318)

Display-only card (D-78): renders an SvgDocument in a framed, aspect-
ratio-sized region with an optional clide-themed label/description caption
beneath. The SVG is content (its own palette); the frame + captions are
chrome (SurfaceTokens). Widget-tested via the kernel fixture. Per-object
data-* overlay and lightbox remain follow-ons.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-28 22:18:53 +02:00
co-authored by Claude Opus 4.8
parent 1fdba4aba5
commit ed5cd6e312
2 changed files with 115 additions and 0 deletions
+36
View File
@@ -0,0 +1,36 @@
import 'package:clide/src/svg/svg_document.dart';
import 'package:clide/widgets/src/draw/drawing_card.dart';
import 'package:clide/widgets/src/svg/svg_painter.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_test/flutter_test.dart';
import '../../helpers/kernel_fixture.dart';
import '../../helpers/widget_harness.dart';
void main() {
late KernelFixture f;
setUp(() async => f = await KernelFixture.create());
tearDown(() async => f.dispose());
Widget card({String? label, String? description}) => SizedBox(
width: 400,
child: DrawingCard(
document: buildSvgDocument('<svg viewBox="0 0 20 10"><rect width="20" height="10" fill="#FF0000"/></svg>'),
label: label,
description: description,
),
);
testWidgets('renders the SVG region with both captions', (tester) async {
await tester.pumpWidget(anchoredHarness(f, card(label: 'Build pipeline', description: 'how it connects')));
expect(find.byType(SvgView), findsOneWidget);
expect(find.text('Build pipeline'), findsOneWidget);
expect(find.text('how it connects'), findsOneWidget);
});
testWidgets('omits captions when label and description are absent', (tester) async {
await tester.pumpWidget(anchoredHarness(f, card()));
expect(find.byType(SvgView), findsOneWidget);
expect(find.text('Build pipeline'), findsNothing);
});
}