Enable floating chat window resizing everywhere

Install directional hit regions in the shared window layer so floating chats can be moved and resized on every destination. Keep geometry updates in the shared manager and cover directional resizing with window host regressions.
This commit is contained in:
2026-11-13 18:00:53 +00:00
parent 5639e5cb05
commit cfd9f22f4b
4 changed files with 265 additions and 19 deletions
@@ -130,6 +130,72 @@ void main() {
);
});
testWidgets(
'all resize edges and corners change the rendered frame and manager entry',
(tester) async {
final entry = manager.open(
'probe',
'a',
frame: const Rect.fromLTWH(300, 200, 360, 420),
);
await pumpProbe(tester, manager, destination: 1);
Future<void> drag(String key, Offset delta) async {
await tester.drag(find.byKey(ValueKey(key)), delta);
await tester.pumpAndSettle();
expect(
windowRect(tester, 'Probe a'),
manager.byId(entry.id)!.frame,
reason: '$key did not rebuild from the manager frame',
);
}
await drag('window-resize-left', const Offset(20, 0));
expect(windowRect(tester, 'Probe a').left, 320);
await drag('window-resize-right', const Offset(20, 0));
expect(windowRect(tester, 'Probe a').width, 360);
await drag('window-resize-top', const Offset(0, 20));
expect(windowRect(tester, 'Probe a').top, 220);
await drag('window-resize-bottom', const Offset(0, 20));
expect(windowRect(tester, 'Probe a').height, 420);
await drag('window-resize-top-left', const Offset(20, 20));
expect(windowRect(tester, 'Probe a').topLeft, const Offset(340, 240));
await drag('window-resize-top-right', const Offset(20, 20));
expect(windowRect(tester, 'Probe a').top, 260);
await drag('window-resize-bottom-left', const Offset(20, 20));
expect(windowRect(tester, 'Probe a').left, 360);
await drag('window-resize', const Offset(20, 20));
expect(windowRect(tester, 'Probe a').bottomRight, const Offset(720, 680));
await drag('window-resize-left', const Offset(1000, 0));
expect(windowRect(tester, 'Probe a').width, 240);
expect(manager.byId(entry.id)!.frame.width, 240);
},
);
testWidgets('geometry persists when switching away from and back to Chat', (
tester,
) async {
final entry = manager.open('probe', 'a');
await pumpProbe(tester, manager, destination: 1);
await tester.drag(
find.byKey(const ValueKey('window-title')),
const Offset(48, 24),
);
await tester.drag(
find.byKey(const ValueKey('window-resize-right')),
const Offset(32, 0),
);
await tester.pumpAndSettle();
final changed = manager.byId(entry.id)!.frame;
await pumpProbe(tester, manager, destination: 0);
expect(windowRect(tester, 'Probe a'), changed);
await pumpProbe(tester, manager, destination: 1);
expect(windowRect(tester, 'Probe a'), changed);
});
testWidgets('maximise fills the app and restores; double click toggles', (
tester,
) async {