Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

fix(web): a resource's actions keep a gap above the picker's edge

Dev jacobd2d1830b1d17
diff --git a/desktop/lib/widgets/swarm_resource_preview.dart b/desktop/lib/widgets/swarm_resource_preview.dart
index bdc6e7c3c..29486dd4a 100644
--- a/desktop/lib/widgets/swarm_resource_preview.dart
+++ b/desktop/lib/widgets/swarm_resource_preview.dart
@@ -1761,6 +1761,7 @@ class _SwarmResourcePreviewState extends State<SwarmResourcePreview> {
grid.AppTheme.palette.value,
terminalThemeStore.value,
);
+ final showsHints = KeyHints.visibleOf(context);
final actions = [
if (desktop || !_isManagement)
Padding(
@@ -1768,11 +1769,13 @@ class _SwarmResourcePreviewState extends State<SwarmResourcePreview> {
cell.width * 2,
cell.height,
cell.width * 2,
- 0,
+ // The hints line is the gap under the buttons; without it
+ // they would sit on the panel's edge.
+ showsHints ? 0 : cell.height,
),
child: _actionButtons(),
),
- if (KeyHints.visibleOf(context)) _controlHints(),
+ if (showsHints) _controlHints(),
];
return LayoutBuilder(
builder: (context, constraints) => Column(
diff --git a/desktop/test/web/web_picker_test.dart b/desktop/test/web/web_picker_test.dart
index 3b12eb395..97059c3e7 100644
--- a/desktop/test/web/web_picker_test.dart
+++ b/desktop/test/web/web_picker_test.dart
@@ -83,6 +83,25 @@ void main() {
app.dispose();
});
+ testWidgets('a resource\'s actions keep a gap above the panel\'s edge', (
+ tester,
+ ) async {
+ final app = await _mount(tester);
+ await _tap(tester, 'search-category-Machines');
+ // Key hints are hidden here, and they were the only space under the row.
+ expect(find.byKey(const ValueKey('resource-control-hints')), findsNothing);
+ final actions = tester.getRect(
+ find.byKey(const ValueKey('swarm-search-resource-actions')),
+ );
+ final panel = tester.getRect(
+ find.byKey(const ValueKey('swarm-search-results')),
+ );
+ expect(panel.bottom - actions.bottom, greaterThanOrEqualTo(12));
+ expect(tester.takeException(), isNull);
+ await tester.pumpWidget(const SizedBox.shrink());
+ app.dispose();
+ });
+
testWidgets('the close button dismisses the picker', (tester) async {
final app = await _mount(tester);
await _tap(tester, 'search-close');