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(super-tabs): keep the Machines pill at its natural width before the +

bitcoinbuildere5fe2b312ac8
diff --git a/desktop/lib/super_tabs/machine_status.dart b/desktop/lib/super_tabs/machine_status.dart
index 73942e386..f05ff8df7 100644
--- a/desktop/lib/super_tabs/machine_status.dart
+++ b/desktop/lib/super_tabs/machine_status.dart
@@ -336,11 +336,15 @@ class SuperTabMachinesPill extends StatelessWidget {
child: const SizedBox.square(dimension: 6),
),
const SizedBox(width: 6),
- Text(
- text,
- style: DesktopChrome.metadata().copyWith(
- fontSize: 11,
- fontFeatures: _tabular,
+ Flexible(
+ child: Text(
+ text,
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: DesktopChrome.metadata().copyWith(
+ fontSize: 11,
+ fontFeatures: _tabular,
+ ),
),
),
],
diff --git a/desktop/lib/super_tabs/section_heading.dart b/desktop/lib/super_tabs/section_heading.dart
index b9c422680..f7a40e1d7 100644
--- a/desktop/lib/super_tabs/section_heading.dart
+++ b/desktop/lib/super_tabs/section_heading.dart
@@ -73,14 +73,13 @@ class SuperTabSectionHeading extends StatelessWidget {
),
),
if (trailing != null) ...[
- // A narrow drawer at a large text scale has no room to spare;
- // shrink the pill rather than overflow the row.
- Flexible(
- child: FittedBox(
- fit: BoxFit.scaleDown,
- alignment: Alignment.centerRight,
- child: trailing!,
- ),
+ // A plain (non-flex) child, so it keeps its natural width right
+ // before the add action instead of splitting the row's free
+ // space with the title — only the cap below is new, to keep a
+ // narrow drawer at a large text scale from overflowing.
+ ConstrainedBox(
+ constraints: const BoxConstraints(maxWidth: 150),
+ child: trailing!,
),
const SizedBox(width: 4),
],
diff --git a/desktop/test/super_tab_sidebar_test.dart b/desktop/test/super_tab_sidebar_test.dart
index 0cfe2780f..6226979fd 100644
--- a/desktop/test/super_tab_sidebar_test.dart
+++ b/desktop/test/super_tab_sidebar_test.dart
@@ -4,6 +4,7 @@ import 'package:flutter_test/flutter_test.dart';
import 'package:harness/core/machine_resources.dart';
import 'package:harness/shared/theme/app_icons.dart';
import 'package:harness/shared/theme/app_theme.dart' as grid;
+import 'package:harness/super_tabs/machine_status.dart';
import 'package:harness/super_tabs/machines.dart';
import 'package:harness/super_tabs/project_sidebar.dart';
import 'package:harness/super_tabs/view.dart';
@@ -152,6 +153,65 @@ void main() {
);
}
+ testWidgets(
+ "the Machines heading's + lines up with the Projects heading's +, "
+ 'with the pill flush before it',
+ (tester) async {
+ final app = createApp(connected: true);
+ addTearDown(app.dispose);
+ final server = ConversationServer();
+ server.state['projects'] = [projectFixture('lead', 'web-project', 'lead')];
+ final c = server.controller();
+ await c.refresh();
+ for (final width in [280.0, 420.0]) {
+ await tester.binding.setSurfaceSize(Size(width, 700));
+ await tester.pumpWidget(
+ MaterialApp(
+ theme: grid.buildAppTheme(brightness: Brightness.dark),
+ home: Scaffold(
+ body: SizedBox(
+ width: width,
+ child: ProjectSidebar(
+ controller: c,
+ app: app,
+ onAddAgent: (_) {},
+ needsHuman: (_) => 0,
+ onSelect: (_) {},
+ onNewProject: () {},
+ ),
+ ),
+ ),
+ ),
+ );
+ await tester.pumpAndSettle();
+
+ final projectAdd = tester.getRect(find.byTooltip('New project'));
+ final machinesAdd = tester.getRect(find.byTooltip('Add machine'));
+ expect(
+ machinesAdd.right,
+ closeTo(projectAdd.right, 1),
+ reason: 'at width $width',
+ );
+
+ final pill = tester.getRect(find.byType(SuperTabMachinesPill));
+ expect(
+ pill.right,
+ lessThanOrEqualTo(machinesAdd.left),
+ reason: 'at width $width',
+ );
+ expect(
+ machinesAdd.left - pill.right,
+ lessThan(20),
+ reason: 'the pill sits flush before the +, at width $width',
+ );
+ }
+ await tester.binding.setSurfaceSize(null);
+ await tester.pumpWidget(const SizedBox());
+ await c.flush();
+ c.dispose();
+ },
+ );
+
testWidgets('the left Machines group repaints on a live app change alone', (
tester,
) async {