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.

feat(web): Download app is the footer's filled action when Share is off

Dev jacob891fac4f286f
diff --git a/desktop/lib/screens/swarm_screen.dart b/desktop/lib/screens/swarm_screen.dart
index 9c4af6e36..3de1e0883 100644
--- a/desktop/lib/screens/swarm_screen.dart
+++ b/desktop/lib/screens/swarm_screen.dart
@@ -7081,7 +7081,8 @@ class _SwarmScreenState extends State<SwarmScreen> {
SizedBox(width: cell.width),
ConstrainedBox(
constraints: BoxConstraints(maxWidth: downloadWidth),
- child: const WebDownloadButton(),
+ // One filled action in the bar: Share when it is on.
+ child: WebDownloadButton(prominent: !_showShareButton),
),
],
if (_showShareButton) ...[
diff --git a/desktop/lib/widgets/web_download_button.dart b/desktop/lib/widgets/web_download_button.dart
index f3bbb6113..d50ecede1 100644
--- a/desktop/lib/widgets/web_download_button.dart
+++ b/desktop/lib/widgets/web_download_button.dart
@@ -4,6 +4,7 @@ import 'package:url_launcher/url_launcher.dart';
import '../shared/theme/app_theme.dart' as grid;
import '../shared/theme/workspace_bar_style.dart';
import 'workspace_bar_control.dart';
+import 'workspace_share_button.dart';
/// Opens [uri] in a new browser tab, inside the click that asked for it: a
/// `window.open` made later is outside the user's gesture, which browsers
@@ -14,11 +15,18 @@ Future<bool> openInNewTab(Uri uri) =>
/// The browser's consistent handoff to the existing macOS/Linux download page,
/// in a new tab so the workspace stays open behind it.
class WebDownloadButton extends StatelessWidget {
- const WebDownloadButton({super.key, this.open = openInNewTab});
+ const WebDownloadButton({
+ super.key,
+ this.open = openInNewTab,
+ this.prominent = false,
+ });
/// How the page is opened; tests pass a recorder.
final Future<bool> Function(Uri uri) open;
+ /// True fills it like Share: the bar's one filled action when Share is off.
+ final bool prominent;
+
static final uri = Uri.parse(
'https://www.autonomous.ai/harness-app?page=download',
);
@@ -37,15 +45,22 @@ class WebDownloadButton extends StatelessWidget {
child: WorkspaceBarControl(
label: 'Download app',
onPressed: () => open(uri),
- builder: (context, emphasized) => SizedBox(
- width: widthOf(context),
- height: workspaceBarControlHeight(context),
- child: Center(
- child: Text(
- _text,
- style: workspaceBarTextStyle(
- color: grid.AppPalette.textPrimary,
- emphasized: emphasized,
+ builder: (context, emphasized) => ColoredBox(
+ color: prominent
+ ? WorkspaceShareButton.backgroundFor(true)
+ : Colors.transparent,
+ child: SizedBox(
+ width: widthOf(context),
+ height: workspaceBarControlHeight(context),
+ child: Center(
+ child: Text(
+ _text,
+ style: workspaceBarTextStyle(
+ color: prominent
+ ? WorkspaceShareButton.foregroundFor(true)
+ : grid.AppPalette.textPrimary,
+ emphasized: emphasized,
+ ),
),
),
),
diff --git a/desktop/test/web/web_download_button_test.dart b/desktop/test/web/web_download_button_test.dart
index 10b8dee78..220391e45 100644
--- a/desktop/test/web/web_download_button_test.dart
+++ b/desktop/test/web/web_download_button_test.dart
@@ -4,6 +4,7 @@ library;
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:harness/widgets/web_download_button.dart';
+import 'package:harness/widgets/workspace_share_button.dart';
void main() {
testWidgets('a click opens the download page through the new-tab opener', (
@@ -28,4 +29,31 @@ void main() {
// The default opener is the new-tab one, not a same-tab navigation.
expect(const WebDownloadButton().open, openInNewTab);
});
+
+ testWidgets('prominent fills it like Share; otherwise it stays quiet', (
+ tester,
+ ) async {
+ Color fill() => tester
+ .widget<ColoredBox>(
+ find.descendant(
+ of: find.byType(WebDownloadButton),
+ matching: find.byType(ColoredBox),
+ ),
+ )
+ .color;
+ Color? ink() => tester.widget<Text>(find.text('Download app')).style?.color;
+
+ await tester.pumpWidget(
+ const MaterialApp(home: Center(child: WebDownloadButton())),
+ );
+ expect(fill(), Colors.transparent);
+
+ await tester.pumpWidget(
+ const MaterialApp(
+ home: Center(child: WebDownloadButton(prominent: true)),
+ ),
+ );
+ expect(fill(), WorkspaceShareButton.backgroundFor(true));
+ expect(ink(), WorkspaceShareButton.foregroundFor(true));
+ });
}