Each tab is wrapped in a Draggable (when allowReorder is true and the entry itself is reorderable) and a DragTarget (always — the controller's barrier logic decides whether the move actually happens). Drops insert the dragged entry at the target tab's index. A 2px leading insertion indicator highlights the active drop target. The widget harness now wraps children in an Overlay so Draggable's feedback can mount without each test re-wrapping. Sized by the test view's bounds to avoid disturbing existing tests that query find.byType(SizedBox).first. Four widget tests cover the gesture path: drop reorders, pinned barrier blocks, pinned tabs aren't draggable, and allowReorder=false disables drag entirely. Co-Authored-By: Claude <noreply@anthropic.com>
33 lines
1.0 KiB
Dart
33 lines
1.0 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(builder: (_) => child),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|