Files
clide/test/helpers/widget_harness.dart
T
jpmschweitzerandClaude 699bd40423 fix Overlay sizing in widget_harness for Flutter 3.27+
Flutter 3.27 changed Overlay layout: an Overlay given infinite
height constraints now requires at least one OverlayEntry with
`canSizeOverlay: true` to delegate sizing, otherwise the entire
golden suite throws "Overlay was given infinite constraints" before
any test can render.

Marking the harness's only entry as size-determining is the minimal
fix — keeps the existing MediaQuery-driven layout shape intact and
unblocks every widget/golden test that uses `harness()`.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-05-06 22:29:05 +02:00

36 lines
1.1 KiB
Dart

import 'package:clide/kernel/kernel.dart';
import 'package:flutter/widgets.dart';
import 'kernel_fixture.dart';
/// Wraps a widget in the minimum tree a primitive needs to resolve
/// theme + i18n + Overlay (for Draggable feedback / Tooltip / etc.):
/// `Directionality → ClideKernel → ClideTheme → MediaQuery →
/// Overlay → child`.
///
/// The Overlay is sized by the test view's bounds via the surrounding
/// MediaQuery; no extra SizedBox is added so existing tests that
/// query `find.byType(SizedBox).first` still find their target.
Widget harness(KernelFixture fixture, Widget child) {
return Directionality(
textDirection: TextDirection.ltr,
child: ClideKernel(
services: fixture.services,
child: ClideTheme(
controller: fixture.services.theme,
child: MediaQuery(
data: const MediaQueryData(),
child: Overlay(
initialEntries: [
OverlayEntry(
canSizeOverlay: true,
builder: (_) => child,
),
],
),
),
),
),
);
}