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): add back button to Computers and device pages

tonydc36238b7c57
diff --git a/mobile/lib/phone/device_detail_page.dart b/mobile/lib/phone/device_detail_page.dart
index 265fba675..bd690d55b 100644
--- a/mobile/lib/phone/device_detail_page.dart
+++ b/mobile/lib/phone/device_detail_page.dart
@@ -89,88 +89,111 @@ class _DeviceDetailPageState extends State<DeviceDetailPage> {
final lastSeen = widget.lastSeen;
final now = DateTime.now();
final fp = _row.fingerprint;
+ final canPop = Navigator.of(context).canPop();
return Scaffold(
backgroundColor: tty.ground,
body: SafeArea(
bottom: false,
- child: ListView(
- padding: EdgeInsets.fromLTRB(
- Tty.origin,
- 12,
- Tty.origin,
- MediaQuery.paddingOf(context).bottom + 24,
- ),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
- TtyText(_name, size: TtySize.title, weight: FontWeight.w600),
- const SizedBox(height: 12),
- SettingsGroup(
- children: [
- SettingsRow(
- title: 'Kind',
- value: isMachine ? 'Computer' : 'App',
+ // Always pushed — from Your devices, the new-device banner or its notification — so it
+ // carries the way back as Your devices does: above the title, outside the list.
+ if (canPop)
+ Align(
+ alignment: Alignment.centerLeft,
+ child: TtyBackButton(
+ onPressed: () => Navigator.of(context).maybePop(),
),
- SettingsRow(
- title: 'Added',
- value: fullDateTime(
- DateTime.fromMillisecondsSinceEpoch(member.addedAt),
- ),
+ ),
+ Expanded(
+ child: ListView(
+ padding: EdgeInsets.fromLTRB(
+ Tty.origin,
+ canPop ? 8 : 12,
+ Tty.origin,
+ MediaQuery.paddingOf(context).bottom + 24,
),
- if (lastSeen != null)
- SettingsRow(
- title: 'Last active',
- value: relativeAgo(
- DateTime.fromMillisecondsSinceEpoch(lastSeen),
- now,
- ),
+ children: [
+ TtyText(_name, size: TtySize.title, weight: FontWeight.w600),
+ const SizedBox(height: 12),
+ SettingsGroup(
+ children: [
+ SettingsRow(
+ title: 'Kind',
+ value: isMachine ? 'Computer' : 'App',
+ ),
+ SettingsRow(
+ title: 'Added',
+ value: fullDateTime(
+ DateTime.fromMillisecondsSinceEpoch(member.addedAt),
+ ),
+ ),
+ if (lastSeen != null)
+ SettingsRow(
+ title: 'Last active',
+ value: relativeAgo(
+ DateTime.fromMillisecondsSinceEpoch(lastSeen),
+ now,
+ ),
+ ),
+ if (isMachine && member.machineId.isNotEmpty)
+ SettingsRow(
+ title: 'Machine',
+ value: member.machineId.substring(
+ 0,
+ member.machineId.length < 8
+ ? member.machineId.length
+ : 8,
+ ),
+ ),
+ ],
),
- if (isMachine && member.machineId.isNotEmpty)
- SettingsRow(
- title: 'Machine',
- value: member.machineId.substring(
- 0,
- member.machineId.length < 8 ? member.machineId.length : 8,
+ if (fp.isNotEmpty) ...[
+ const SizedBox(height: 16),
+ FingerprintBlock(
+ fp,
+ large: true,
+ copyKey: const Key('device-detail-copy'),
),
- ),
- ],
- ),
- if (fp.isNotEmpty) ...[
- const SizedBox(height: 16),
- FingerprintBlock(
- fp,
- large: true,
- copyKey: const Key('device-detail-copy'),
- ),
- const SizedBox(height: 8),
- // Wraps: the explanation is a sentence, not a terminal line.
- Text(
- fingerprintHowToCompare(computer: isMachine),
- style: tty.style(color: tty.dim),
- ),
- ],
- if (_error case final error?) ...[
- const SizedBox(height: 12),
- TtyText(error, color: tty.red),
- ],
- if (widget.isNew || !_row.self) ...[
- const SizedBox(height: 16),
- SettingsGroup(
- children: [
- if (widget.isNew)
- SettingsRow(
- key: const Key('device-detail-mine'),
- title: 'It’s mine',
- onTap: _removing ? null : _mine,
+ const SizedBox(height: 8),
+ // Wraps: the explanation is a sentence, not a terminal line.
+ Text(
+ fingerprintHowToCompare(computer: isMachine),
+ style: tty.style(color: tty.dim),
),
- if (!_row.self)
- SettingsRow(
- key: const Key('device-detail-remove'),
- title: _removing ? 'Removing…' : 'Remove this device',
- destructive: true,
- onTap: _removing ? null : () => unawaited(_remove()),
+ ],
+ if (_error case final error?) ...[
+ const SizedBox(height: 12),
+ TtyText(error, color: tty.red),
+ ],
+ if (widget.isNew || !_row.self) ...[
+ const SizedBox(height: 16),
+ SettingsGroup(
+ children: [
+ if (widget.isNew)
+ SettingsRow(
+ key: const Key('device-detail-mine'),
+ title: 'It’s mine',
+ onTap: _removing ? null : _mine,
+ ),
+ if (!_row.self)
+ SettingsRow(
+ key: const Key('device-detail-remove'),
+ title: _removing
+ ? 'Removing…'
+ : 'Remove this device',
+ destructive: true,
+ onTap: _removing
+ ? null
+ : () => unawaited(_remove()),
+ ),
+ ],
),
+ ],
],
),
- ],
+ ),
],
),
),
diff --git a/mobile/lib/phone/devices_page.dart b/mobile/lib/phone/devices_page.dart
index afa25d069..c207c9d0f 100644
--- a/mobile/lib/phone/devices_page.dart
+++ b/mobile/lib/phone/devices_page.dart
@@ -169,110 +169,134 @@ class _DevicesPageState extends State<DevicesPage> {
final frozen =
listing != null &&
(listing.frozen != null || listing.frozenPeers.isNotEmpty);
+ final canPop = Navigator.of(context).canPop();
return Scaffold(
backgroundColor: tty.ground,
body: SafeArea(
bottom: false,
- child: ListView(
- padding: EdgeInsets.fromLTRB(
- Tty.origin,
- 12,
- Tty.origin,
- MediaQuery.paddingOf(context).bottom + 24,
- ),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
- const TtyText(
- 'Your devices',
- size: TtySize.title,
- weight: FontWeight.w600,
- ),
- const SizedBox(height: 8),
- TtyText(
- 'Every computer and app signed in to your account. Each reaches your machines '
- 'end to end encrypted. Remove one you do not recognise.',
- color: tty.dim,
- ),
- if (frozen) ...[
- const SizedBox(height: 12),
- SettingsGroup(
- children: [
- SettingsRow(
- title: 'The device list froze',
- detail: listing.frozen != null
- ? 'Harness served a list that does not match what this phone verified. '
- 'No device is added until you review it.'
- : 'Frozen on ${listing.frozenPeers.join(', ')}. Review it on that computer.',
- destructive: true,
- onTap: listing.frozen != null
- ? () => unawaited(_trustAgain())
- : null,
- value: listing.frozen != null ? 'Review' : null,
- ),
- ],
+ // Always pushed — from Settings, the new-device banner or its notification — so it
+ // carries the way back as Settings does: above the title, and outside the list, so a
+ // long list scrolled down keeps it.
+ if (canPop)
+ Align(
+ alignment: Alignment.centerLeft,
+ child: TtyBackButton(
+ onPressed: () => Navigator.of(context).maybePop(),
+ ),
),
- ],
- if (_error case final error?) ...[
- const SizedBox(height: 12),
- TtyText(error, color: tty.red),
- ],
- if (listing != null && _unused(listing).isNotEmpty) ...[
- const SizedBox(height: 12),
- SettingsGroup(
+ Expanded(
+ child: ListView(
+ padding: EdgeInsets.fromLTRB(
+ Tty.origin,
+ canPop ? 8 : 12,
+ Tty.origin,
+ MediaQuery.paddingOf(context).bottom + 24,
+ ),
children: [
- SettingsRow(
- key: const Key('account-devices-unused'),
- title:
- '${_unused(listing).length} app${_unused(listing).length == 1 ? '' : 's'} not used in 90 days',
- detail: 'Most likely a browser whose data was cleared.',
- value: _removingUnused ? 'Removing…' : 'Remove',
- destructive: true,
- onTap: _removingUnused
- ? null
- : () => unawaited(_removeUnused(_unused(listing))),
+ const TtyText(
+ 'Your devices',
+ size: TtySize.title,
+ weight: FontWeight.w600,
),
- ],
- ),
- ],
- const SizedBox(height: 12),
- if (listing == null)
- const SizedBox.shrink()
- else ...[
- if (selfRow(listing.members) case final self?) ...[
- SettingsGroup(
- children: [
- _ThisDeviceCard(
- key: const Key('account-device-this'),
- row: self,
+ const SizedBox(height: 8),
+ // Wraps: the explanation is a sentence, not a terminal line — a [TtyText] clipped
+ // it at the screen's edge.
+ Text(
+ 'Every computer and app signed in to your account. Each reaches your machines '
+ 'end to end encrypted. Remove one you do not recognise.',
+ style: tty.style(color: tty.dim),
+ ),
+ if (frozen) ...[
+ const SizedBox(height: 12),
+ SettingsGroup(
+ children: [
+ SettingsRow(
+ title: 'The device list froze',
+ detail: listing.frozen != null
+ ? 'Harness served a list that does not match what this phone verified. '
+ 'No device is added until you review it.'
+ : 'Frozen on ${listing.frozenPeers.join(', ')}. Review it on that computer.',
+ destructive: true,
+ onTap: listing.frozen != null
+ ? () => unawaited(_trustAgain())
+ : null,
+ value: listing.frozen != null ? 'Review' : null,
+ ),
+ ],
),
],
- ),
- const SizedBox(height: 12),
- ],
- SettingsGroup(
- children: [
- for (final row in orderDeviceRows(
- listing.members,
- _seen,
- _newPubs,
- ))
- SettingsRow(
- key: ValueKey('account-device-${row.member.pub}'),
- title: row.member.label.trim().isEmpty
- ? 'Unnamed device'
- : row.member.label,
- detail: deviceDetailLine(
- row,
- _seen[row.member.pub],
- DateTime.now(),
- sameName: sharedNames(listing.members)
- .contains(row.member.label.trim()),
+ if (_error case final error?) ...[
+ const SizedBox(height: 12),
+ TtyText(error, color: tty.red),
+ ],
+ if (listing != null && _unused(listing).isNotEmpty) ...[
+ const SizedBox(height: 12),
+ SettingsGroup(
+ children: [
+ SettingsRow(
+ key: const Key('account-devices-unused'),
+ title:
+ '${_unused(listing).length} app${_unused(listing).length == 1 ? '' : 's'} not used in 90 days',
+ detail:
+ 'Most likely a browser whose data was cleared.',
+ value: _removingUnused ? 'Removing…' : 'Remove',
+ destructive: true,
+ onTap: _removingUnused
+ ? null
+ : () =>
+ unawaited(_removeUnused(_unused(listing))),
+ ),
+ ],
+ ),
+ ],
+ const SizedBox(height: 12),
+ if (listing == null)
+ const SizedBox.shrink()
+ else ...[
+ if (selfRow(listing.members) case final self?) ...[
+ SettingsGroup(
+ children: [
+ _ThisDeviceCard(
+ key: const Key('account-device-this'),
+ row: self,
+ ),
+ ],
),
- value: _newPubs.contains(row.member.pub) ? 'New' : null,
- onTap: () => _open(row),
+ const SizedBox(height: 12),
+ ],
+ SettingsGroup(
+ children: [
+ for (final row in orderDeviceRows(
+ listing.members,
+ _seen,
+ _newPubs,
+ ))
+ SettingsRow(
+ key: ValueKey('account-device-${row.member.pub}'),
+ title: row.member.label.trim().isEmpty
+ ? 'Unnamed device'
+ : row.member.label,
+ detail: deviceDetailLine(
+ row,
+ _seen[row.member.pub],
+ DateTime.now(),
+ sameName: sharedNames(listing.members)
+ .contains(row.member.label.trim()),
+ ),
+ value: _newPubs.contains(row.member.pub)
+ ? 'New'
+ : null,
+ onTap: () => _open(row),
+ ),
+ ],
),
+ ],
],
),
- ],
+ ),
],
),
),
diff --git a/mobile/lib/phone/machines_tab.dart b/mobile/lib/phone/machines_tab.dart
index cb47f042a..7d19d76b2 100644
--- a/mobile/lib/phone/machines_tab.dart
+++ b/mobile/lib/phone/machines_tab.dart
@@ -31,8 +31,8 @@ class MachinesTab extends StatelessWidget {
final AppNotifier notifier;
- /// The tab's big title. Off when this is PUSHED — from the terminal's `⋯` sheet — where it needs
- /// the back chevron that a large header does not draw.
+ /// The tab's big title. Off when this is PUSHED — from Settings — where it draws the back chevron
+ /// above its title instead, as Settings itself does.
final bool large;
@override
@@ -48,10 +48,17 @@ class MachinesTab extends StatelessWidget {
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
+ if (!large)
+ Align(
+ alignment: Alignment.centerLeft,
+ child: TtyBackButton(
+ onPressed: () => Navigator.of(context).maybePop(),
+ ),
+ ),
Padding(
- padding: const EdgeInsets.fromLTRB(
+ padding: EdgeInsets.fromLTRB(
Tty.origin,
- 12,
+ large ? 12 : 8,
Tty.origin,
4,
),