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(mobile): drop the floating ⋯ that stood in for the hidden header

bubu-dudu77d98acd66cd
diff --git a/mobile/lib/phone/terminal_chrome_scroll.dart b/mobile/lib/phone/terminal_chrome_scroll.dart
index a9e833cb7..2d0697d58 100644
--- a/mobile/lib/phone/terminal_chrome_scroll.dart
+++ b/mobile/lib/phone/terminal_chrome_scroll.dart
@@ -20,12 +20,9 @@ import 'package:flutter/widgets.dart';
/// every notification the page gets carrying `min=-Infinity max=Infinity`, so
/// there is no zero to be near. Distance is what survives both buffers.
///
-/// ⚠️ **What replaces it is not nothing.** The row's controls fly out of it as
-/// it goes and come to rest as floating buttons down the right edge — see
-/// `terminal_header_floats.dart`. They ride the same value, so there is no
-/// moment where the header has gone and its controls have not arrived. A header
-/// that simply went would have left the page with no way to search or to reach
-/// the actions until somebody scrolled back for it.
+/// ⚠️ **Nothing replaces it.** `⋯` goes with the row and comes back with it;
+/// Search and New agent never lived here, so a hidden header costs nothing but
+/// the actions sheet until the first scroll the other way.
///
/// ⚠️ **The floating mic, Search and New agent are not driven from here and
/// must not be.** They carry what the mic needs somebody to read, which is
diff --git a/mobile/lib/phone/terminal_header.dart b/mobile/lib/phone/terminal_header.dart
index bd86935cb..0aef84f59 100644
--- a/mobile/lib/phone/terminal_header.dart
+++ b/mobile/lib/phone/terminal_header.dart
@@ -26,9 +26,8 @@ import 'status_pill.dart';
/// bottom-right corner with the mic — see `terminal_action_column.dart` — so
/// this row is identity plus `⋯`, and nothing competes with the names for width.
///
-/// ⚠️ **It leaves on a scroll, and `⋯` carries on without it.** The page slides
-/// this row away as the terminal is scrolled forward, and `⋯` flies out of it to
-/// become a floating button at the top-right — see `terminal_header_floats.dart`.
+/// ⚠️ **It leaves on a scroll, and `⋯` leaves with it.** The page slides this
+/// row away as the terminal is scrolled forward; nothing floats in its place.
/// Nothing here knows about that; the row is either laid out or it is not.
class TerminalHeader extends StatelessWidget {
const TerminalHeader({
diff --git a/mobile/lib/phone/terminal_header_floats.dart b/mobile/lib/phone/terminal_header_floats.dart
deleted file mode 100644
index ada75f368..000000000
--- a/mobile/lib/phone/terminal_header_floats.dart
+++ /dev/null
@@ -1,227 +0,0 @@
-import 'dart:ui' show lerpDouble;
-
-import 'package:flutter/material.dart';
-
-import 'package:harness_mobile/shared/theme/app_theme.dart';
-
-/// One of the things the header held, as a floating button.
-class TerminalHeaderChoice {
- const TerminalHeaderChoice({
- required this.icon,
- required this.label,
- required this.onTap,
- });
-
- final IconData icon;
-
- /// For screen readers and the long-press tooltip. The buttons carry no words
- /// of their own — three marks in a column, in the order they sat in the row
- /// they came out of, is what makes them readable.
- final String label;
-
- final VoidCallback onTap;
-}
-
-/// The header's controls, floating down the right edge once the row itself has
-/// scrolled away.
-///
-/// ⚠️ **Three buttons, not one that opens three.** A single button folding the
-/// lot away was tried first: it put the page's only search and its only actions
-/// menu behind a tap and a fan, which is two gestures to reach what had been
-/// one. These stay in the order they had in the header — search, new, actions —
-/// so the column reads as that row stood on its end.
-///
-/// ⚠️ **Each one flies out of its own place in the header.** The row's search
-/// bar, `+` and `⋯` are at known points across the top of the screen, and each
-/// button travels from its own to its place in this column. A set that simply
-/// faded in would say nothing about where the header went, which was the
-/// complaint that produced this file.
-class TerminalHeaderFloats extends StatelessWidget {
- const TerminalHeaderFloats({
- super.key,
- required this.choices,
- required this.progress,
- required this.origins,
- });
-
- final List<TerminalHeaderChoice> choices;
-
- /// 0 the header is in place and these are nowhere, 1 fully arrived.
- final Animation<double> progress;
-
- /// Where each button starts, relative to its resting place in the column.
- ///
- /// ⚠️ Given by the page, not worked out here. The origins are points in the
- /// header's own row, and that row's layout is the page's business — this
- /// widget knows only how to fly something from A to B.
- final List<Offset> origins;
-
- /// A button's diameter, and the gap from one to the next.
- ///
- /// ⚠️ **Smaller than the mic, and that is the right way round.** The mic is
- /// the page's one action and is held through a whole sentence; these are
- /// chrome that scrolling put here, tapped once and rarely. Sizing them to
- /// match made three circles compete with the output they float over.
- ///
- /// ⚠️ 32 is a floor. [touchExtent] is what a finger actually gets — the
- /// circles are drawn small and hit large, so shrinking them further would cost
- /// legibility without buying the terminal anything.
- static const double extent = 32;
- static const double pitch = 40;
-
- /// What the finger may land on, against the [extent] that is drawn.
- ///
- /// ⚠️ **Capped at [pitch], and it must not exceed it.** The targets are drawn
- /// small and hit large, but two that overlap would hand the shared band to
- /// whichever is painted later — the lower button, since the column builds top
- /// down — so a tap aimed just under Search would open New agent. Matching the
- /// pitch is what makes the targets meet exactly and leave no dead glass
- /// between them either.
- static const double touchExtent = pitch;
-
- /// How far the column sits from the screen's top and right edges.
- static const double inset = 10;
-
- /// What a column of [count] buttons is tall.
- static double heightFor(int count) =>
- count == 0 ? 0 : (count - 1) * pitch + extent;
-
- @override
- Widget build(BuildContext context) {
- AppTheme.watch(context);
- return SizedBox(
- width: extent,
- height: heightFor(choices.length),
- child: Stack(
- clipBehavior: Clip.none,
- children: [
- for (final (index, choice) in choices.indexed)
- Positioned(
- top: index * pitch,
- right: 0,
- child: _Float(
- progress: progress,
- // ⚠️ Staggered from the top down, in the order they left the
- // header. Arriving together reads as a menu appearing; one after
- // another reads as the row coming apart.
- delay: index * 0.1,
- origin: index < origins.length ? origins[index] : Offset.zero,
- choice: choice,
- ),
- ),
- ],
- ),
- );
- }
-}
-
-/// One button, travelling from where it sat in the header to where it floats.
-class _Float extends StatelessWidget {
- const _Float({
- required this.progress,
- required this.delay,
- required this.origin,
- required this.choice,
- });
-
- final Animation<double> progress;
-
- /// How far into the run this one starts, 0 to 1.
- final double delay;
-
- /// Where it comes from, relative to where it ends up.
- final Offset origin;
-
- final TerminalHeaderChoice choice;
-
- @override
- Widget build(BuildContext context) {
- AppTheme.watch(context);
- return AnimatedBuilder(
- animation: progress,
- // Built once: what moves is the transform around it.
- child: _Button(choice: choice),
- builder: (context, child) {
- // ⚠️ The stagger comes off the shared VALUE rather than from a timer of
- // its own. One clock keeps the three in step when a scroll reverses
- // part-way through; separate controllers would each be somewhere
- // different when the reverse began, and they would land untidily.
- final t = ((progress.value - delay) / (1 - delay)).clamp(0.0, 1.0);
- if (t == 0) return const SizedBox.shrink();
- return Transform.translate(
- offset: Offset(origin.dx * (1 - t), origin.dy * (1 - t)),
- child: Opacity(
- // ⚠️ Fades in over the FIRST part of the journey only. A button
- // still translucent as it lands looks like it failed to arrive — and
- // the header it came from is fading over the same stretch, so two
- // half-transparent things in one place would read as a smear.
- opacity: (t / 0.6).clamp(0.0, 1.0),
- child: Transform.scale(scale: lerpDouble(0.55, 1, t), child: child),
- ),
- );
- },
- );
- }
-}
-
-class _Button extends StatelessWidget {
- const _Button({required this.choice});
-
- final TerminalHeaderChoice choice;
-
- @override
- Widget build(BuildContext context) {
- AppTheme.watch(context);
- return Semantics(
- button: true,
- label: choice.label,
- child: Tooltip(
- message: choice.label,
- // ⚠️ The target is the OUTER box and the circle is drawn inside it: the
- // visible button is 32pt, which is under what a thumb wants, and an
- // [OverflowBox] is what lets the hit area exceed the slot the column
- // lays out without pushing the circles apart.
- child: GestureDetector(
- behavior: HitTestBehavior.opaque,
- onTap: choice.onTap,
- child: SizedBox.square(
- dimension: TerminalHeaderFloats.extent,
- child: OverflowBox(
- maxWidth: TerminalHeaderFloats.touchExtent,
- maxHeight: TerminalHeaderFloats.touchExtent,
- child: SizedBox.square(
- dimension: TerminalHeaderFloats.touchExtent,
- child: Center(
- child: Container(
- width: TerminalHeaderFloats.extent,
- height: TerminalHeaderFloats.extent,
- decoration: BoxDecoration(
- shape: BoxShape.circle,
- color: AppGlass.surfaceFill,
- border: Border.all(color: AppGlass.lift),
- // ⚠️ A shadow, because these float over streaming output rather
- // than over a surface. Without one the circle's edge disappears
- // wherever a bright line runs under it.
- boxShadow: [
- BoxShadow(
- color: Colors.black.withValues(alpha: 0.3),
- blurRadius: 10,
- offset: const Offset(0, 2),
- ),
- ],
- ),
- child: Icon(
- choice.icon,
- size: 15,
- color: AppPalette.textPrimary,
- ),
- ),
- ),
- ),
- ),
- ),
- ),
- ),
- );
- }
-}
diff --git a/mobile/lib/phone/terminal_page.dart b/mobile/lib/phone/terminal_page.dart
index 887a0fb66..88e6df4e4 100644
--- a/mobile/lib/phone/terminal_page.dart
+++ b/mobile/lib/phone/terminal_page.dart
@@ -7,7 +7,6 @@ import 'package:flutter/services.dart';
import 'package:image_picker/image_picker.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';
-import 'package:harness_mobile/core/models.dart' show Agent;
import 'package:harness_mobile/shared/theme/app_theme.dart';
import 'package:harness_mobile/shared/widgets/app_icon_button.dart';
import 'package:harness_mobile/state/app_state.dart';
@@ -27,7 +26,6 @@ import 'status_pill.dart';
import 'terminal_action_column.dart';
import 'terminal_chrome_scroll.dart';
import 'terminal_header.dart';
-import 'terminal_header_floats.dart';
import 'terminal_input_dock.dart';
import 'terminal_search.dart';
import 'voice_input_controller.dart';
@@ -271,56 +269,6 @@ class _TerminalPageState extends State<TerminalPage>
super.dispose();
}
- /// What the header held, for when the row is not on screen to hold it: `⋯`.
- ///
- /// ⚠️ Built from the same condition as the header's own row, so the float
- /// never offers something the row would have withheld — `⋯` needs an agent
- /// that has loaded. Search and New agent are not here: they float in the
- /// bottom-right corner with the mic whether the header is up or not.
- List<TerminalHeaderChoice> _headerChoices(
- MachineState? machine,
- Agent? agent,
- ) => [
- if (agent != null)
- TerminalHeaderChoice(
- icon: LucideIcons.ellipsis300,
- label: 'Agent actions',
- onTap: () => _showActions(
- machineName: machine?.machine.displayName ?? '',
- agentName: agent.name,
- ),
- ),
- ];
-
- /// Where each floating button starts its flight, relative to where it lands.
- ///
- /// ⚠️ **Worked out from the header's own constants rather than measured.** The
- /// header is being taken apart at exactly the moment these are read, so
- /// constants are the only description of where its controls WERE that
- /// survives the row leaving. The trade is that the origins drift if the
- /// header's layout changes without this changing with it — buttons flying
- /// from slightly the wrong place, never a crash or a missed target.
- List<Offset> _headerOrigins(int count) {
- const inset = TerminalHeaderFloats.inset;
- const pitch = TerminalHeaderFloats.pitch;
- const extent = TerminalHeaderFloats.extent;
- // The trailing actions are [_HeaderAction]s: 24px boxes with 7 either side,
- // the last one's trailing pad dropped, laid from the right edge inwards past
- // the header's own inset.
- const actionPitch = 24 + _HeaderAction.gap * 2;
- const headerMidY = TerminalHeader.topInset + TerminalHeader.rowHeight / 2;
- return [
- for (var i = 0; i < count; i++)
- () {
- final fromRight =
- TerminalHeader.sideInset + actionPitch * (count - 1 - i) + 12;
- const restFromRight = inset + extent / 2;
- final restY = inset + i * pitch + extent / 2;
- return Offset(restFromRight - fromRight, headerMidY - restY);
- }(),
- ];
- }
-
/// Opens the machine's new-agent form.
///
/// Awaited: the form may be backed out of rather than completed, and this page
@@ -773,9 +721,8 @@ class _TerminalPageState extends State<TerminalPage>
// does. The rows under it are the oldest on the screen, and the
// first push of a scroll is what slides it away from them.
//
- // What stands in for it while it is gone is [TerminalHeaderFloats]
- // — the same controls, as floating buttons down the right edge,
- // each one flown out of the place it held in this row.
+ // Nothing stands in for it while it is gone: `⋯` comes back with
+ // the header on the first scroll the other way.
Positioned(
top: 0,
left: 0,
@@ -833,33 +780,6 @@ class _TerminalPageState extends State<TerminalPage>
),
),
),
- // The header's controls, floating down the right edge once
- // the row itself has scrolled away.
- //
- // ⚠️ **Built on the animation, not on a flag the page keeps.**
- // These have to be somewhere on every frame of the slide — they
- // fly out of the header as it goes — so their position is read
- // per frame. A boolean flipped in a callback would put them
- // there in one jump, which is the thing this replaced.
- AnimatedBuilder(
- animation: _chrome.header,
- builder: (context, _) {
- if (_chrome.header.value == 0) {
- return const SizedBox.shrink();
- }
- final choices = _headerChoices(machine, agent);
- if (choices.isEmpty) return const SizedBox.shrink();
- return Positioned(
- top: TerminalHeaderFloats.inset,
- right: TerminalHeaderFloats.inset,
- child: TerminalHeaderFloats(
- choices: choices,
- progress: _chrome.header,
- origins: _headerOrigins(choices.length),
- ),
- );
- },
- ),
// Search, faded up over the whole page. Only built while it is
// on its way in, up, or on its way out — see [_searching].
if (_searching)