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(store): a Safari-style toolbar, and a quieter top to Discover (#187)

Dee735471a14d84
diff --git a/desktop/lib/store/store_category.dart b/desktop/lib/store/store_category.dart
index d0ca791bc..88f5cbf81 100644
--- a/desktop/lib/store/store_category.dart
+++ b/desktop/lib/store/store_category.dart
@@ -87,7 +87,7 @@ class _StoreCategoryState extends State<StoreCategory> {
final padding = box.maxWidth < 680 ? 20.0 : 36.0;
return SingleChildScrollView(
key: ValueKey('store-catalog:$name'),
- padding: EdgeInsets.fromLTRB(padding, 12, padding, 40),
+ padding: EdgeInsets.fromLTRB(padding, 32, padding, 40),
child: Center(
child: ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 1440),
diff --git a/desktop/lib/store/store_discover.dart b/desktop/lib/store/store_discover.dart
index 737b2a979..c1a5976f0 100644
--- a/desktop/lib/store/store_discover.dart
+++ b/desktop/lib/store/store_discover.dart
@@ -76,37 +76,23 @@ class StoreDiscover extends StatelessWidget {
final padding = box.maxWidth < 680 ? 20.0 : 36.0;
return SingleChildScrollView(
key: const PageStorageKey('store-discover-scroll'),
- padding: EdgeInsets.fromLTRB(padding, 12, padding, 40),
+ padding: EdgeInsets.fromLTRB(padding, 32, padding, 40),
child: Center(
child: ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 1440),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
- Column(
+ Text(
+ 'Follow your curiosity.',
key: const ValueKey('store-curiosity-hero'),
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- 'Follow your curiosity.',
- style: TextStyle(
- fontSize: 34,
- height: 1.15,
- letterSpacing: -1.1,
- fontWeight: FontWeight.w700,
- color: grid.AppPalette.textPrimary,
- ),
- ),
- const SizedBox(height: 8),
- Text(
- 'Start with code. Build across disciplines.',
- style: TextStyle(
- fontSize: 15,
- height: 1.4,
- color: grid.AppPalette.textSecondary,
- ),
- ),
- ],
+ style: TextStyle(
+ fontSize: 34,
+ height: 1.15,
+ letterSpacing: -1.1,
+ fontWeight: FontWeight.w700,
+ color: grid.AppPalette.textPrimary,
+ ),
),
if (features.isNotEmpty) ...[
const SizedBox(height: 24),
@@ -150,7 +136,7 @@ class StoreDiscover extends StatelessWidget {
if (engines.isNotEmpty) ...[
const SizedBox(height: 24),
StoreExploreHeading(
- title: 'Your starting point: code.',
+ title: 'Start with code.',
action: 'All coding agents',
onAction: onEngines,
),
@@ -208,7 +194,9 @@ class StoreDiscover extends StatelessWidget {
onOpen: onOpen,
),
const SizedBox(height: 32),
- const StoreExploreHeading(title: 'Explore disciplines'),
+ const StoreExploreHeading(
+ title: 'Build across disciplines.',
+ ),
const SizedBox(height: 16),
LayoutBuilder(
builder: (context, constraints) {
diff --git a/desktop/lib/store/store_screen.dart b/desktop/lib/store/store_screen.dart
index bc590f762..ecd4d10cb 100644
--- a/desktop/lib/store/store_screen.dart
+++ b/desktop/lib/store/store_screen.dart
@@ -435,15 +435,6 @@ class _StoreTabState extends State<StoreTab> {
final category = selected != null
? storeCategoryFor(selected)
: (_shelf is _Category ? (_shelf as _Category).name : null);
- final location =
- selected?.name ??
- switch (_shelf) {
- _Discover() => 'Discover',
- _Category(:final name) => name,
- _Search() => 'Search results',
- _All() => 'All harnesses',
- _Viewers() => 'Viewers',
- };
return Row(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
@@ -477,12 +468,6 @@ class _StoreTabState extends State<StoreTab> {
onClear: _clearSearch,
onBack: _canGoBack ? _goBack : null,
onForward: _place.forward.isEmpty ? null : _goForward,
- onDiscover: () => _show(const _Discover()),
- location: location,
- category: selected != null ? category : null,
- onCategory: category == null
- ? null
- : () => _show(_Category(category)),
),
Expanded(
child: PageStorage(
diff --git a/desktop/lib/store/store_search.dart b/desktop/lib/store/store_search.dart
index fff865df2..8d94b8b22 100644
--- a/desktop/lib/store/store_search.dart
+++ b/desktop/lib/store/store_search.dart
@@ -1,11 +1,23 @@
+import 'dart:async';
+import 'dart:math' as math;
+
import 'package:flutter/material.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';
+import 'package:url_launcher/url_launcher.dart';
import '../shared/theme/app_theme.dart' as grid;
import '../shared/widgets/app_icon_button.dart';
import '../shortcuts/app_keymap.dart';
-/// Search and orientation stay in view while the destination scrolls below.
+/// Where "Create harness" goes: the ten-minute guide to a first DSH.
+const kCreateHarnessGuide =
+ 'https://github.com/autonomous-ai/openharness#your-first-dsh-in-ten-minutes';
+
+/// The Store's toolbar, laid out like Safari's: history on the left, a compact
+/// search field centred on the pane, and the way to make your own on the right.
+///
+/// No breadcrumb: the rail already says which shelf is open, and every page
+/// under it carries its own title.
class StoreSearch extends StatelessWidget {
const StoreSearch({
super.key,
@@ -16,10 +28,6 @@ class StoreSearch extends StatelessWidget {
required this.onClear,
required this.onBack,
required this.onForward,
- required this.onDiscover,
- required this.location,
- this.category,
- this.onCategory,
});
final TextEditingController controller;
@@ -29,175 +37,310 @@ class StoreSearch extends StatelessWidget {
final VoidCallback onClear;
final VoidCallback? onBack;
final VoidCallback? onForward;
- final VoidCallback onDiscover;
- final String location;
- final String? category;
- final VoidCallback? onCategory;
@override
Widget build(BuildContext context) => LayoutBuilder(
builder: (context, box) {
final padding = box.maxWidth < 680 ? 20.0 : 36.0;
- final border = OutlineInputBorder(
- borderRadius: BorderRadius.circular(16),
- borderSide: BorderSide(color: grid.AppPalette.divider),
+ // A control's height, grown with the text so a scaled label still has air.
+ final height = math.max(
+ grid.AppControl.height,
+ MediaQuery.textScalerOf(context).scale(13) + 18,
);
- final searchHint = effectiveCommandHint(context, 'terminal.find');
return Container(
key: const ValueKey('store-search-header'),
color: grid.AppPalette.windowBg,
- padding: EdgeInsets.fromLTRB(padding, 18, padding, 4),
+ padding: EdgeInsets.fromLTRB(padding, 14, padding, 6),
child: Center(
child: ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 1440),
- child: Column(
- mainAxisSize: MainAxisSize.min,
- children: [
- TextField(
- key: const ValueKey('store-search'),
- controller: controller,
- focusNode: focusNode,
- autofocus: autofocus,
- onChanged: onChanged,
- textInputAction: TextInputAction.search,
- style: TextStyle(
- fontSize: 16,
- color: grid.AppPalette.textPrimary,
+ child: SizedBox(
+ height: height,
+ child: CustomMultiChildLayout(
+ delegate: _ToolbarLayout(),
+ children: [
+ LayoutId(
+ id: _Slot.history,
+ child: _History(onBack: onBack, onForward: onForward),
),
- decoration: InputDecoration(
- hintText: 'Search harnesses, tools, or ideas…',
- hintStyle: TextStyle(
- fontSize: 16,
- color: grid.AppPalette.textSecondary,
- ),
- filled: true,
- fillColor: grid.AppSurface.recess,
- isDense: true,
- contentPadding: const EdgeInsets.symmetric(
- horizontal: 18,
- vertical: 18,
- ),
- border: border,
- enabledBorder: border,
- focusedBorder: border.copyWith(
- borderSide: BorderSide(
- color: grid.AppPalette.accentOnSurface,
- width: 1.5,
- ),
+ LayoutId(
+ id: _Slot.search,
+ child: _Field(
+ controller: controller,
+ focusNode: focusNode,
+ onChanged: onChanged,
+ autofocus: autofocus,
+ onClear: onClear,
),
- prefixIcon: Icon(
- LucideIcons.search300,
- size: 22,
- color: grid.AppPalette.textSecondary,
+ ),
+ LayoutId(
+ id: _Slot.create,
+ child: _CreateHarness(
+ height: height,
+ labelled: box.maxWidth >= 520,
),
- prefixIconConstraints: const BoxConstraints(minWidth: 56),
- suffixIcon: controller.text.isNotEmpty
- ? Padding(
- padding: const EdgeInsets.only(right: 12),
- child: AppIconButton(
- icon: LucideIcons.x300,
- tooltip: 'Clear search',
- onPressed: onClear,
- ),
- )
- : box.maxWidth > 650 && searchHint != null
- ? Padding(
- padding: const EdgeInsets.only(right: 18),
- child: Center(
- widthFactor: 1,
- child: Text(
- searchHint,
- style: TextStyle(
- fontSize: 12,
- color: grid.AppPalette.textFaint,
- ),
- ),
- ),
- )
- : null,
),
+ ],
+ ),
+ ),
+ ),
+ ),
+ );
+ },
+ );
+}
+
+enum _Slot { history, search, create }
+
+/// Centres the field on the whole pane, the way Safari centres its address
+/// field on the window, rather than in whatever the two ends leave between
+/// them — they are different widths, so the gap between them is off-centre.
+/// When the pane is too narrow for that, the field takes the gap instead.
+class _ToolbarLayout extends MultiChildLayoutDelegate {
+ static const _gap = 12.0;
+ static const _widest = 560.0;
+ static const _narrowest = 240.0;
+
+ @override
+ void performLayout(Size size) {
+ final loose = BoxConstraints.loose(size);
+ final history = layoutChild(_Slot.history, loose);
+ final create = layoutChild(_Slot.create, loose);
+ final side = math.max(history.width, create.width) + _gap;
+ var width = math.min(_widest, size.width - 2 * side);
+ var left = (size.width - width) / 2;
+ if (width < _narrowest) {
+ left = history.width + _gap;
+ width = size.width - history.width - create.width - 2 * _gap;
+ }
+ layoutChild(
+ _Slot.search,
+ BoxConstraints.tight(Size(math.max(0, width), size.height)),
+ );
+ positionChild(_Slot.history, Offset(0, (size.height - history.height) / 2));
+ positionChild(_Slot.search, Offset(left, 0));
+ positionChild(
+ _Slot.create,
+ Offset(size.width - create.width, (size.height - create.height) / 2),
+ );
+ }
+
+ @override
+ bool shouldRelayout(_ToolbarLayout oldDelegate) => false;
+}
+
+/// Back and forward in one capsule, split by a hairline, as Safari draws them.
+class _History extends StatelessWidget {
+ const _History({required this.onBack, required this.onForward});
+
+ final VoidCallback? onBack;
+ final VoidCallback? onForward;
+
+ @override
+ Widget build(BuildContext context) {
+ final back = effectiveCommandHint(context, 'navigation.back');
+ final forward = effectiveCommandHint(context, 'navigation.forward');
+ return Container(
+ height: grid.AppControl.height,
+ padding: const EdgeInsets.symmetric(horizontal: 4),
+ decoration: BoxDecoration(
+ color: grid.AppSurface.recess,
+ border: Border.all(color: grid.AppPalette.divider),
+ borderRadius: BorderRadius.circular(grid.AppControl.radius),
+ ),
+ child: Row(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ AppIconButton(
+ key: const ValueKey('store-back'),
+ icon: LucideIcons.chevronLeft300,
+ tooltip: back == null ? 'Back' : 'Back $back',
+ onPressed: onBack,
+ size: 17,
+ ),
+ Container(
+ width: 1,
+ height: 14,
+ margin: const EdgeInsets.symmetric(horizontal: 3),
+ color: grid.AppPalette.divider,
+ ),
+ AppIconButton(
+ key: const ValueKey('store-nav-forward'),
+ icon: LucideIcons.chevronRight300,
+ tooltip: forward == null ? 'Forward' : 'Forward $forward',
+ onPressed: onForward,
+ size: 17,
+ ),
+ ],
+ ),
+ );
+ }
+}
+
+class _Field extends StatelessWidget {
+ const _Field({
+ required this.controller,
+ required this.focusNode,
+ required this.onChanged,
+ required this.autofocus,
+ required this.onClear,
+ });
+
+ final TextEditingController controller;
+ final FocusNode focusNode;
+ final ValueChanged<String> onChanged;
+ final bool autofocus;
+ final VoidCallback onClear;
+
+ @override
+ Widget build(BuildContext context) {
+ final shortcut = effectiveCommandHint(context, 'terminal.find');
+ return ListenableBuilder(
+ listenable: Listenable.merge([focusNode, controller]),
+ builder: (context, _) => LayoutBuilder(
+ builder: (context, box) => MouseRegion(
+ cursor: SystemMouseCursors.text,
+ child: GestureDetector(
+ // The icon and the padding are part of the field: a click there
+ // puts the caret in it, as it would in Safari's.
+ onTap: focusNode.requestFocus,
+ child: AnimatedContainer(
+ key: const ValueKey('store-search-field'),
+ duration: grid.AppMotion.hover,
+ curve: grid.AppMotion.curve,
+ padding: const EdgeInsets.only(left: 11, right: 6),
+ decoration: BoxDecoration(
+ color: grid.AppSurface.recess,
+ border: Border.all(
+ color: focusNode.hasFocus
+ ? grid.AppPalette.accentOnSurface
+ : grid.AppPalette.divider,
),
- const SizedBox(height: 8),
- Row(
- children: [
- TextButton.icon(
- key: const ValueKey('store-back'),
- onPressed: onBack,
- icon: const Icon(LucideIcons.arrowLeft300, size: 16),
- label: const Text('Back'),
- style: TextButton.styleFrom(
- foregroundColor: grid.AppPalette.textSecondary,
- padding: const EdgeInsets.symmetric(horizontal: 8),
- minimumSize: const Size(0, 34),
- ),
- ),
- AppIconButton(
- key: const ValueKey('store-nav-forward'),
- icon: LucideIcons.arrowRight300,
- tooltip: 'Forward',
- onPressed: onForward,
- size: 16,
- ),
- Container(
- height: 16,
- width: 1,
- margin: const EdgeInsets.symmetric(horizontal: 12),
- color: grid.AppPalette.divider,
- ),
- if (location != 'Discover') ...[
- TextButton(
- key: const ValueKey('store-breadcrumb-discover'),
- onPressed: onDiscover,
- style: TextButton.styleFrom(
- foregroundColor: grid.AppPalette.textSecondary,
- padding: const EdgeInsets.symmetric(horizontal: 4),
- minimumSize: const Size(0, 34),
- ),
- child: const Text('Discover'),
- ),
- Icon(
- LucideIcons.chevronRight300,
- size: 13,
- color: grid.AppPalette.textFaint,
+ borderRadius: BorderRadius.circular(grid.AppControl.radius),
+ ),
+ // Focus is a ring outside the field, as Safari draws it, not a
+ // thicker border: that would nudge the text on every focus.
+ foregroundDecoration: BoxDecoration(
+ border: Border.all(
+ color: focusNode.hasFocus
+ ? grid.AppPalette.accentOnSurface.withValues(alpha: 0.35)
+ : Colors.transparent,
+ width: 2.5,
+ strokeAlign: BorderSide.strokeAlignOutside,
+ ),
+ borderRadius: BorderRadius.circular(grid.AppControl.radius),
+ ),
+ child: Row(
+ children: [
+ Icon(
+ LucideIcons.search300,
+ size: 15,
+ color: grid.AppPalette.textSecondary,
+ ),
+ const SizedBox(width: 8),
+ Expanded(
+ child: TextField(
+ key: const ValueKey('store-search'),
+ controller: controller,
+ focusNode: focusNode,
+ autofocus: autofocus,
+ onChanged: onChanged,
+ textInputAction: TextInputAction.search,
+ textAlignVertical: TextAlignVertical.center,
+ style: TextStyle(
+ fontSize: 13,
+ color: grid.AppPalette.textPrimary,
),
- ],
- if (category != null && box.maxWidth > 650) ...[
- TextButton(
- key: const ValueKey('store-breadcrumb-category'),
- onPressed: onCategory,
- style: TextButton.styleFrom(
- foregroundColor: grid.AppPalette.textSecondary,
- padding: const EdgeInsets.symmetric(horizontal: 4),
- minimumSize: const Size(0, 34),
+ // Bare: the outline around it is this field's border,
+ // so none of the theme's own may draw inside it.
+ decoration: InputDecoration(
+ hintText: 'Search harnesses',
+ hintStyle: TextStyle(
+ fontSize: 13,
+ color: grid.AppPalette.textSecondary,
),
- child: Text(category!),
- ),
- Icon(
- LucideIcons.chevronRight300,
- size: 13,
- color: grid.AppPalette.textFaint,
+ isCollapsed: true,
+ constraints: const BoxConstraints(),
+ // A desktop's compact density takes 8px off a
+ // collapsed field, and the text hangs out of the
+ // bottom of what is left: 4px low in the outline.
+ visualDensity: VisualDensity.standard,
+ filled: false,
+ contentPadding: EdgeInsets.zero,
+ border: InputBorder.none,
+ enabledBorder: InputBorder.none,
+ focusedBorder: InputBorder.none,
+ disabledBorder: InputBorder.none,
),
- ],
- const SizedBox(width: 6),
- Expanded(
+ ),
+ ),
+ if (controller.text.isNotEmpty)
+ AppIconButton(
+ icon: LucideIcons.x300,
+ tooltip: 'Clear search',
+ onPressed: onClear,
+ )
+ else if (shortcut != null && box.maxWidth > 320)
+ Padding(
+ padding: const EdgeInsets.only(right: 5),
child: Text(
- location,
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
+ shortcut,
style: TextStyle(
fontSize: 12,
- fontWeight: FontWeight.w600,
- color: grid.AppPalette.textPrimary,
+ color: grid.AppPalette.textFaint,
),
),
),
- ],
- ),
- ],
+ ],
+ ),
),
),
),
- );
- },
+ ),
+ );
+ }
+}
+
+/// The toolbar's one filled control, in the ink the app gives a primary
+/// action (Resume Harness, New Harness), so it reads before the chrome around
+/// it. It opens the guide in the browser; the tooltip says so.
+class _CreateHarness extends StatelessWidget {
+ const _CreateHarness({required this.height, required this.labelled});
+
+ final double height;
+
+ /// Too narrow a pane keeps a plus alone, with the words in its tooltip.
+ final bool labelled;
+
+ @override
+ Widget build(BuildContext context) => Tooltip(
+ message: 'Your first harness in ten minutes, on GitHub',
+ child: FilledButton(
+ key: const ValueKey('store-create-harness'),
+ onPressed: () => unawaited(
+ launchUrl(
+ Uri.parse(kCreateHarnessGuide),
+ mode: LaunchMode.externalApplication,
+ ),
+ ),
+ style: FilledButton.styleFrom(
+ minimumSize: Size(height, height),
+ padding: EdgeInsets.symmetric(horizontal: labelled ? 14 : 0),
+ backgroundColor: grid.AppPalette.textPrimary,
+ foregroundColor: grid.AppPalette.windowBg,
+ textStyle: TextStyle(
+ fontFamily: grid.AppFont.sans,
+ fontFamilyFallback: grid.AppFont.sansFallback,
+ fontSize: 13,
+ fontWeight: FontWeight.w600,
+ ),
+ shape: RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(grid.AppControl.radius),
+ ),
+ ),
+ child: labelled
+ ? const Text('Create Harness')
+ : const Icon(LucideIcons.plus300, size: 16),
+ ),
);
}
diff --git a/desktop/test/store_discover_test.dart b/desktop/test/store_discover_test.dart
index a2a7bd8cb..a97d61c8f 100644
--- a/desktop/test/store_discover_test.dart
+++ b/desktop/test/store_discover_test.dart
@@ -514,27 +514,47 @@ void main() {
final search = find.byKey(const ValueKey('store-search'));
final field = tester.widget<TextField>(search);
expect(field.focusNode!.hasFocus, isTrue);
- final initialRect = tester.getRect(search);
- expect(initialRect.width, greaterThan(1000));
+ // The outline, not the TextField: the clear button and the ⌘F hint
+ // trade places inside it as text comes and goes.
+ final outline = find.byKey(const ValueKey('store-search-field'));
+ final initialRect = tester.getRect(outline);
+ // One Safari-shaped row: history left, a compact field centred on the
+ // pane, and the way to build your own on the right.
+ final bar = initialRect;
+ final header = tester.getRect(
+ find.byKey(const ValueKey('store-search-header')),
+ );
+ expect(bar.width, lessThanOrEqualTo(560));
+ expect(bar.center.dx, moreOrLessEquals(header.center.dx, epsilon: 0.5));
+ final back = tester.getRect(find.byKey(const ValueKey('store-back')));
+ final create = tester.getRect(
+ find.byKey(const ValueKey('store-create-harness')),
+ );
+ expect(back.right, lessThan(bar.left));
+ expect(create.left, greaterThan(bar.right));
+ expect(back.center.dy, moreOrLessEquals(bar.center.dy, epsilon: 0.5));
+ expect(create.center.dy, moreOrLessEquals(bar.center.dy, epsilon: 0.5));
+ expect(find.text('Create Harness'), findsOneWidget);
+ expect(find.text('Search harnesses'), findsOneWidget);
await tester.drag(
find.byKey(const PageStorageKey('store-discover-scroll')),
const Offset(0, -700),
);
await tester.pumpAndSettle();
- expect(tester.getRect(search), initialRect);
+ expect(tester.getRect(outline), initialRect);
await _capture(tester, key, 'discover-exploration');
await tester.tap(
find.byKey(const ValueKey('store-shelf-category:Engineering')),
);
await tester.pumpAndSettle();
- expect(tester.getRect(search), initialRect);
+ expect(tester.getRect(outline), initialRect);
await tester.drag(
find.byKey(const ValueKey('store-catalog:Engineering')),
const Offset(0, -550),
);
await tester.pumpAndSettle();
- expect(tester.getRect(search), initialRect);
+ expect(tester.getRect(outline), initialRect);
await tester.enterText(search, 'mounting holes');
await tester.pumpAndSettle();
expect(
@@ -545,7 +565,7 @@ void main() {
find.byKey(const ValueKey('store-card:autonomous/autonomous-circuit')),
findsNothing,
);
- expect(tester.getRect(search), initialRect);
+ expect(tester.getRect(outline), initialRect);
await tester.tap(find.byTooltip('Clear search'));
await tester.pumpAndSettle();
expect(find.byKey(const ValueKey('store-category-hero')), findsOneWidget);
@@ -1141,7 +1161,7 @@ void main() {
find.byKey(const ValueKey('store-category:Engineering')),
findsNothing,
);
- expect(find.text('Your starting point: code.'), findsOneWidget);
+ expect(find.text('Start with code.'), findsOneWidget);
expect(find.byKey(const ValueKey('store-card:codex')), findsOneWidget);
});
diff --git a/desktop/test/store_search_test.dart b/desktop/test/store_search_test.dart
new file mode 100644
index 000000000..78629be26
--- /dev/null
+++ b/desktop/test/store_search_test.dart
@@ -0,0 +1,59 @@
+// The Store's toolbar, laid out as a Mac draws it.
+import 'package:flutter/foundation.dart';
+import 'package:flutter/material.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:harness/shared/theme/app_theme.dart' as grid;
+import 'package:harness/store/store_search.dart';
+
+import 'support/real_fonts.dart';
+
+void main() {
+ setUpAll(loadRealFonts);
+
+ // Widget tests run as Android unless told otherwise, and Android's standard
+ // density hid this: a desktop's compact density took 8px off the collapsed
+ // field and the hint sat 4px under the middle of the outline on a Mac.
+ for (final platform in [TargetPlatform.macOS, TargetPlatform.linux]) {
+ testWidgets(
+ 'the hint sits on the middle of the field on ${platform.name}',
+ (tester) async {
+ debugDefaultTargetPlatformOverride = platform;
+ addTearDown(() => debugDefaultTargetPlatformOverride = null);
+ tester.view.devicePixelRatio = 1;
+ tester.view.physicalSize = const Size(1200, 200);
+ addTearDown(tester.view.reset);
+ final controller = TextEditingController();
+ final focus = FocusNode();
+ addTearDown(controller.dispose);
+ addTearDown(focus.dispose);
+ await tester.pumpWidget(
+ MaterialApp(
+ theme: grid.buildAppTheme(brightness: Brightness.dark),
+ home: Scaffold(
+ body: Column(
+ children: [
+ StoreSearch(
+ controller: controller,
+ focusNode: focus,
+ onChanged: (_) {},
+ autofocus: false,
+ onClear: () {},
+ onBack: null,
+ onForward: null,
+ ),
+ ],
+ ),
+ ),
+ ),
+ );
+ final field = tester.getRect(
+ find.byKey(const ValueKey('store-search-field')),
+ );
+ final hint = tester.getRect(find.text('Search harnesses'));
+ expect(hint.center.dy, moreOrLessEquals(field.center.dy, epsilon: 0.5));
+ expect(find.text('Create Harness'), findsOneWidget);
+ debugDefaultTargetPlatformOverride = null;
+ },
+ );
+ }
+}