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.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
feat(mobile): restyle phone confirm dialog on app dialog veil
tony019f94e3c93e
diff --git a/mobile/lib/phone/agents_page.dart b/mobile/lib/phone/agents_page.dartindex 74f57d4c8..069af540f 100644--- a/mobile/lib/phone/agents_page.dart+++ b/mobile/lib/phone/agents_page.dart@@ -153,6 +153,7 @@ class AgentsPage extends StatelessWidget {final name = machine.machine.displayName;final confirmed = await confirmPhoneAction(context,+ icon: LucideIcons.unlink300,title: 'Unlink $name?',message:'This phone will need $name\'s password again to open its harnesses. 'diff --git a/mobile/lib/phone/delete_agent.dart b/mobile/lib/phone/delete_agent.dartindex 7a27efc53..58e36f683 100644--- a/mobile/lib/phone/delete_agent.dart+++ b/mobile/lib/phone/delete_agent.dart@@ -1,4 +1,5 @@import 'package:flutter/material.dart';+import 'package:lucide_icons_flutter/lucide_icons.dart';import 'package:harness_mobile/state/app_state.dart';@@ -28,9 +29,19 @@ Future<void> confirmDeleteAgent(String agentId,String agentName,) async {+ // Where it runs, under the title — "machine · folder", the line the rename dialog carries — read+ // off the notifier as it stands now. An agent already gone from the list names the machine alone.+ final machine = notifier.stateOf(machineId);+ final agent = machine?.agents.where((a) => a.id == agentId).firstOrNull;final confirmed = await confirmPhoneAction(context,+ // The Stop row's own icon — see [confirmPhoneAction].+ icon: LucideIcons.trash2300,title: 'Stop $agentName?',+ detail: [+ ?machine?.machine.displayName,+ ?agent?.project?.folder,+ ].where((part) => part.isNotEmpty).join(' · '),// ⚠️ **The desktop's own sentence, word for word**, because it is the same// `agent_delete` on the wire (`AppNotifier.deleteAgent`, and desktop's// `widgets/delete_agent_dialog.dart`) — and the two used to describe itdiff --git a/mobile/lib/phone/phone_sheet.dart b/mobile/lib/phone/phone_sheet.dartindex 8b0dea657..99ad921cb 100644--- a/mobile/lib/phone/phone_sheet.dart+++ b/mobile/lib/phone/phone_sheet.dart@@ -5,7 +5,12 @@ import 'package:lucide_icons_flutter/lucide_icons.dart';import 'package:harness_mobile/shared/theme/app_theme.dart';import 'package:harness_mobile/shared/widgets/app_dialog.dart'- show kDialogVeilBlur, kSheetVeilOpacity;+ show+ appDialogButtonStyle,+ kDialogControlRadius,+ kDialogVeilBlur,+ kSheetVeilOpacity,+ showAppDialog;import 'settings_row.dart';@@ -448,39 +453,170 @@ class _SheetRow extends StatelessWidget {}}-/// A yes/no question before something that cannot be undone — deleting an agent, unlinking a-/// machine. Returns true only if the destructive button was the one pressed.+/// A yes/no question before something that cannot be undone — stopping a harness, unlinking a+/// machine. Returns true only if the destructive button was the one pressed; Cancel, a tap on the+/// veil and Escape all answer no.+///+/// Laid out as the rename dialog is (`widgets/rename_agent_dialog.dart`) and on the same veil —+/// [showAppDialog]'s blur under its tint — so the app's dialogs read as one set: a heading row with+/// a mark, the sentence, then Cancel and the act side by side at a thumb's size.+///+/// [icon] is the mark, on a red tile: pass the icon of the row that asked, so the question visibly+/// continues the tap that opened it. [detail], when given, goes under the title — where the thing+/// lives, so two of the same name on two machines cannot be confused at the one step that ends one.Future<bool> confirmPhoneAction(BuildContext context, {required String title,required String message,required String confirmLabel,+ IconData icon = LucideIcons.triangleAlert300,+ String? detail,}) async {- final confirmed = await showDialog<bool>(+ final confirmed = await showAppDialog<bool>(context: context,- useRootNavigator: true,- builder: (dialogContext) => AlertDialog(- backgroundColor: AppPalette.panelBg,- title: Text(- title,- style: TextStyle(color: AppPalette.textPrimary, fontSize: 18),- ),- content: Text(- message,- style: TextStyle(color: AppPalette.textSecondary, fontSize: 14),- ),- actions: [- TextButton(- onPressed: () => Navigator.of(dialogContext).pop(false),- child: const Text('Cancel'),- ),- FilledButton(- style: FilledButton.styleFrom(backgroundColor: AppPalette.dangerFill),- onPressed: () => Navigator.of(dialogContext).pop(true),- child: Text(confirmLabel),- ),- ],+ builder: (_) => _ConfirmDialog(+ title: title,+ message: message,+ confirmLabel: confirmLabel,+ icon: icon,+ detail: detail,),);return confirmed ?? false;}++/// [confirmPhoneAction]'s card.+class _ConfirmDialog extends StatelessWidget {+ const _ConfirmDialog({+ required this.title,+ required this.message,+ required this.confirmLabel,+ required this.icon,+ required this.detail,+ });++ final String title;+ final String message;+ final String confirmLabel;+ final IconData icon;+ final String? detail;++ @override+ Widget build(BuildContext context) {+ AppTheme.watch(context);+ // The red tuned as ink on a dark surface, for the mark. [AppPalette.dangerFill] is darkened to+ // carry white lettering, so it stays on the button — the one place that has any.+ final danger = Theme.of(context).colorScheme.error;+ final detail = this.detail;+ return Dialog(+ // 16 from a phone's edges, as the rename dialog: the sentence gets the width, up to the 360+ // the card stops at on anything wider.+ insetPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 24),+ child: Semantics(+ scopesRoute: true,+ namesRoute: true,+ explicitChildNodes: true,+ label: title,+ child: ConstrainedBox(+ constraints: const BoxConstraints(maxWidth: 360),+ child: Padding(+ padding: const EdgeInsets.all(20),+ child: Column(+ mainAxisSize: MainAxisSize.min,+ crossAxisAlignment: CrossAxisAlignment.stretch,+ children: [+ Row(+ children: [+ Container(+ width: 40,+ height: 40,+ decoration: BoxDecoration(+ color: danger.withValues(alpha: 0.14),+ borderRadius: BorderRadius.circular(+ kDialogControlRadius,+ ),+ border: Border.all(+ color: danger.withValues(alpha: 0.24),+ ),+ ),+ child: Icon(icon, size: 20, color: danger),+ ),+ const SizedBox(width: 14),+ Expanded(+ child: Column(+ mainAxisSize: MainAxisSize.min,+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ // Never cut short: the name in it is what the question is about.+ Text(+ title,+ style: TextStyle(+ color: AppPalette.textPrimary,+ fontSize: 17,+ fontWeight: AppFont.semibold,+ height: 1.3,+ ),+ ),+ if (detail != null && detail.isNotEmpty) ...[+ const SizedBox(height: 2),+ Text(+ detail,+ maxLines: 1,+ overflow: TextOverflow.ellipsis,+ style: TextStyle(+ color: AppPalette.textSecondary,+ fontSize: 13,+ ),+ ),+ ],+ ],+ ),+ ),+ ],+ ),+ const SizedBox(height: 16),+ Text(+ message,+ style: TextStyle(+ color: AppPalette.textSecondary,+ fontSize: 15,+ height: 1.45,+ ),+ ),+ const SizedBox(height: 22),+ Row(+ children: [+ // A neutral well, not accent text, for the reason the rename dialog's Cancel+ // is one: blue lettering on this card is 3.0:1, and a way out does not need+ // the accent to be found.+ Expanded(+ child: FilledButton(+ style: appDialogButtonStyle(+ background: AppSurface.recess,+ foreground: AppPalette.textPrimary,+ ),+ onPressed: () => Navigator.of(context).pop(false),+ child: const Text('Cancel'),+ ),+ ),+ const SizedBox(width: 10),+ Expanded(+ child: FilledButton(+ style: appDialogButtonStyle(+ background: AppPalette.dangerFill,+ foreground: Colors.white,+ ),+ onPressed: () => Navigator.of(context).pop(true),+ child: Text(confirmLabel),+ ),+ ),+ ],+ ),+ ],+ ),+ ),+ ),+ ),+ );+ }+}diff --git a/mobile/lib/shared/widgets/app_dialog.dart b/mobile/lib/shared/widgets/app_dialog.dartindex 17ae811da..00a42abbc 100644--- a/mobile/lib/shared/widgets/app_dialog.dart+++ b/mobile/lib/shared/widgets/app_dialog.dart@@ -18,6 +18,8 @@ import 'dart:ui' show ImageFilter;import 'package:flutter/material.dart';import 'package:flutter/services.dart';+import '../theme/app_theme.dart' show AppFont;+/// How far the app blurs what sits behind a dialog.////// ⚠️ Bounded on purpose. A terminal is high-contrast text on a dark ground,@@ -41,6 +43,44 @@ const Color kDialogVeilTint = Color(0xE6000000);/// same veil.const double kSheetVeilOpacity = 0.64;+/// The corner of a dialog's controls — its field and the buttons under it —+/// so the two read as one set.+const double kDialogControlRadius = 12;++/// A dialog's action button at a thumb's size: 46 tall, 16pt, on+/// [kDialogControlRadius].+///+/// One pair of measures for every dialog laid out as a card with its actions+/// side by side along the bottom — the rename dialog, the phone's+/// confirmations — so none of them sizes its own.+///+/// Built on the app's filled button, so everything this leaves unsaid — the+/// shrink-wrapped tap target, the hover overlay — is still the theme's.+ButtonStyle appDialogButtonStyle({+ required Color background,+ required Color foreground,+ Color? disabledBackground,+ Color? disabledForeground,+}) => FilledButton.styleFrom(+ backgroundColor: background,+ foregroundColor: foreground,+ disabledBackgroundColor: disabledBackground,+ disabledForegroundColor: disabledForeground,+ minimumSize: const Size.fromHeight(46),+ padding: const EdgeInsets.symmetric(horizontal: 12),+ shape: RoundedRectangleBorder(+ borderRadius: BorderRadius.circular(kDialogControlRadius),+ ),+ // `ButtonStyle.textStyle` does not inherit the family from the text theme —+ // see `_buttonTextStyle` in the theme — so it is named here too.+ textStyle: TextStyle(+ fontFamily: AppFont.sans,+ fontFamilyFallback: AppFont.sansFallback,+ fontSize: 16,+ fontWeight: AppFont.semibold,+ ),+);+/// The app's dialog barrier: a blur, then a tint, then whatever opened.////// Use it in place of `showDialog` wherever a panel should take the window'sdiff --git a/mobile/lib/widgets/rename_agent_dialog.dart b/mobile/lib/widgets/rename_agent_dialog.dartindex 143ac0e17..897546ef5 100644--- a/mobile/lib/widgets/rename_agent_dialog.dart+++ b/mobile/lib/widgets/rename_agent_dialog.dart@@ -39,8 +39,9 @@ Future<void> showAgentRenameDialog(),);-/// The field's corner. Its focus ring stands 4 outside it, on the same curve.-const double _fieldRadius = 12;+/// The field's corner — the buttons' too. Its focus ring stands 4 outside it,+/// on the same curve.+const double _fieldRadius = kDialogControlRadius;/// ⚠️ A widget that OWNS its controller, not a `StatefulBuilder` over one made/// beside `showDialog`.@@ -370,7 +371,7 @@ class _RenameAgentDialogState extends State<_RenameAgentDialog> {children: [Expanded(child: FilledButton(- style: _buttonStyle(+ style: appDialogButtonStyle(background: grid.AppSurface.recess,foreground: grid.AppPalette.textPrimary,),@@ -381,7 +382,7 @@ class _RenameAgentDialogState extends State<_RenameAgentDialog> {const SizedBox(width: 10),Expanded(child: FilledButton(- style: _buttonStyle(+ style: appDialogButtonStyle(background: accent,foreground: Colors.white,// Kept at full colour while it spins: the press was taken, and a@@ -414,35 +415,6 @@ class _RenameAgentDialogState extends State<_RenameAgentDialog> {}}-/// A dialog button at a thumb's size: 46 tall, 16pt, on the field's corner.-///-/// Built on the app's filled button, so everything this leaves unsaid — the-/// shrink-wrapped tap target, the hover overlay — is still the theme's.-ButtonStyle _buttonStyle({- required Color background,- required Color foreground,- Color? disabledBackground,- Color? disabledForeground,-}) => FilledButton.styleFrom(- backgroundColor: background,- foregroundColor: foreground,- disabledBackgroundColor: disabledBackground,- disabledForegroundColor: disabledForeground,- minimumSize: const Size.fromHeight(46),- padding: const EdgeInsets.symmetric(horizontal: 12),- shape: RoundedRectangleBorder(- borderRadius: BorderRadius.circular(_fieldRadius),- ),- // `ButtonStyle.textStyle` does not inherit the family from the text theme —- // see `_buttonTextStyle` in the theme — so it is named here too.- textStyle: TextStyle(- fontFamily: grid.AppFont.sans,- fontFamilyFallback: grid.AppFont.sansFallback,- fontSize: 16,- fontWeight: grid.AppFont.semibold,- ),-);-/// Where an agent runs, for the line under the title: the agent (for its/// engine's mark) and "machine · folder" — the two names every other place/// tells it apart by.