Float one chat pane over the app and toggle it with Ctrl+Y / Cmd+Y

This commit is contained in:
2026-11-10 12:56:39 +00:00
parent 19aa726e7f
commit bb669aface
18 changed files with 1957 additions and 56 deletions
@@ -0,0 +1,80 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/ui/floating/floating_layer.dart';
void main() {
testWidgets('the layer last pressed or focused paints on top', (
tester,
) async {
tester.view.physicalSize = const Size(800, 600);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.reset);
final hits = <String>[];
final focus = FocusNode();
addTearDown(focus.dispose);
Widget window(String name, double left, {FocusNode? node}) => Positioned(
left: left,
top: 100,
width: 200,
height: 200,
child: Focus(
focusNode: node,
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () => hits.add(name),
child: const SizedBox.expand(),
),
),
);
var behind = 0;
await tester.pumpWidget(
MaterialApp(
home: Scaffold(
body: Stack(
children: [
Positioned.fill(
child: GestureDetector(
onTap: () => behind++,
child: const ColoredBox(color: Colors.white),
),
),
// Nested inside a page, like the chat workspace.
Positioned.fill(
child: FloatingLayer(
coverOverlay: true,
builder: (context, bounds) => [
window('chat', 100, node: focus),
],
),
),
Positioned.fill(
child: FloatingLayer(
builder: (context, bounds) => [window('terminal', 200)],
),
),
],
),
),
),
);
const overlap = Offset(250, 200);
await tester.tapAt(overlap);
expect(hits.last, 'terminal');
await tester.tapAt(const Offset(120, 200));
await tester.pump();
await tester.tapAt(overlap);
expect(hits.last, 'chat');
await tester.tapAt(const Offset(380, 200));
await tester.pump();
await tester.tapAt(overlap);
expect(hits.last, 'terminal');
focus.requestFocus();
await tester.pump();
await tester.pump();
await tester.tapAt(overlap);
expect(hits.last, 'chat');
// Space between windows passes through to the page.
await tester.tapAt(const Offset(700, 500));
expect(behind, 1);
});
}