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): land in the new agent after creating from a terminal; top-align folder list

bubu-dudu98e7c8635a01
diff --git a/mobile/lib/phone/terminal_page.dart b/mobile/lib/phone/terminal_page.dart
index e1e3495ca..e78127c11 100644
--- a/mobile/lib/phone/terminal_page.dart
+++ b/mobile/lib/phone/terminal_page.dart
@@ -636,11 +636,26 @@ class _TerminalPageState extends State<TerminalPage>
/// Pops after the frame: this runs from inside a build, where popping a route synchronously is
/// not allowed.
+ ///
+ /// ⚠️ **Removes THIS page's route, which is not the same as popping.** `pop` takes whatever is on
+ /// top, and this page is often not on top when its pane goes: the terminal's own `+` opens the
+ /// new-agent form over it, and the agent that form creates is opened as the single pane — closing
+ /// this one. Popping from here then took down the NEW agent's terminal, the page underneath
+ /// surfaced, found its pane gone too and popped again, and the person landed on the list instead
+ /// of in the agent they had just made.
void _leave() {
WidgetsBinding.instance.addPostFrameCallback((_) {
if (!mounted) return;
final navigator = Navigator.of(context);
- if (navigator.canPop()) navigator.pop();
+ final route = ModalRoute.of(context);
+ if (route == null || !navigator.canPop()) return;
+ if (route.isCurrent) {
+ navigator.pop();
+ } else if (route.isActive) {
+ // Underneath something: leave the stack quietly, so back from the page on top goes to
+ // whatever was below this one.
+ navigator.removeRoute(route);
+ }
});
}
diff --git a/mobile/lib/widgets/remote_folder_picker.dart b/mobile/lib/widgets/remote_folder_picker.dart
index 3512f8a8e..61afb5fab 100644
--- a/mobile/lib/widgets/remote_folder_picker.dart
+++ b/mobile/lib/widgets/remote_folder_picker.dart
@@ -429,6 +429,12 @@ class _RemoteFolderPickerDialogState extends State<_RemoteFolderPickerDialog> {
),
)
: ListView.builder(
+ // ⚠️ Zero, not the default. A ListView left to choose pads itself with
+ // the screen's safe-area insets — on a phone the status bar above and
+ // the gesture bar below — even inside this boxed dialog, where neither
+ // is anywhere near it. A home folder with one subfolder then drew that
+ // row halfway down an empty box.
+ padding: EdgeInsets.zero,
controller: _scroll,
itemExtent: _rowHeight,
itemCount: _entries.length,