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(mobile): keep edge swipe from leaving the machine pager

tony7e4940fdf4c1
diff --git a/mobile/lib/phone/machine_swipe.dart b/mobile/lib/phone/machine_swipe.dart
index 633fa1f2a..e048c6a9b 100644
--- a/mobile/lib/phone/machine_swipe.dart
+++ b/mobile/lib/phone/machine_swipe.dart
@@ -113,10 +113,12 @@ class _MachineSwipeHostState extends State<MachineSwipeHost> {
}
return PageView.builder(
controller: controller,
- // The lists below scroll vertically, so the horizontal axis is free. The one gesture still
- // competing for it is the route's own edge-swipe back, which wins at the left margin because
- // it is registered above this in the tree — deliberately kept: that is how a page goes back on
- // iOS, and the page slides out the way it came in.
+ // The lists below scroll vertically, so the horizontal axis is free — and here it is the
+ // pager's ALONE. The route's own edge-swipe back used to compete for it and win at the left
+ // margin, being registered above this in the tree: a drag started near the edge to reach the
+ // previous MACHINE left the screen instead. The route is pushed without that gesture now (see
+ // `phoneRoute`'s `swipeToGoBack`), so going back is the header's back band, or Android's back
+ // button.
physics: const PageScrollPhysics(),
// No count is what makes it endless: the builder answers for any page, and the modulo below
// wraps it back onto the list. A one-machine list keeps its single page instead — see
diff --git a/mobile/lib/phone/phone_navigation.dart b/mobile/lib/phone/phone_navigation.dart
index 6f80e6a3d..062247012 100644
--- a/mobile/lib/phone/phone_navigation.dart
+++ b/mobile/lib/phone/phone_navigation.dart
@@ -25,11 +25,14 @@ Route<void> phoneRoute(WidgetBuilder builder, {bool swipeToGoBack = true}) =>
/// button and predictive-back (which go through `popDisposition`), and a page popping itself — the
/// terminal page does exactly that when its pane disappears.
///
-/// Used by the agent pager, where the horizontal drag belongs to the pager. The edge swipe and the
-/// PageView were competing for the same axis: the route's detector sits ABOVE the pager in the tree
-/// and wins at the left margin, so a swipe started near the edge to reach the previous AGENT left
-/// the screen instead. Only the header now goes back, which is what the whole band across the top is
-/// widened for.
+/// Used by both pagers — agents and machines — where the horizontal drag belongs to the pager. The
+/// edge swipe and the PageView were competing for the same axis: the route's detector sits ABOVE the
+/// pager in the tree and wins at the left margin, so a swipe started near the edge to reach the
+/// PREVIOUS entry left the screen instead. Only the header now goes back, which is what the whole
+/// band across the top is widened for.
+///
+/// A machine opened on its own keeps the gesture: there is no pager under it competing for the axis,
+/// and it is a plain pushed page like any other.
class _NoSwipeBackRoute<T> extends CupertinoPageRoute<T> {
_NoSwipeBackRoute({required super.builder});
@@ -62,6 +65,9 @@ void openMachine(
machineId: machineId,
neighbours: swipeNeighbours,
),
+ // The horizontal axis belongs to the pager here — see [_NoSwipeBackRoute]. The way out is
+ // the header's back band, and on Android the back button as well.
+ swipeToGoBack: false,
),
);
return;