App structure: a swipe-in menu shell; pages/, link/, actions/; Settings
The shell (shell.dart): a drawer from the left edge or each page's menu button. Dash, Signals, Captures; Tools (Camera, Link test, Orin power options), the rarely used ones, after pirate-station-aide; Settings (gateway address, dark/bright, build-time theme and landing). Landing view at build time: YUKART_HOME=dash|signals, signals for now. Dash, Signals and Captures stay alive while hidden; Captures has its own navigator, so a run survives switching views. Back goes inside Captures, then to the landing view, then out. The mock banner sits over every page. main.dart is startup only; the old home screen is pages/signals.dart; dialogs and sheets moved to actions/; the protocol client, USB binding and Reading to link/. lib/README.md catalogues it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DDwfd6Ki8UfG4hK6W5YpJz
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
// The free-form mark: stamped into the open recording from anywhere, beside the
|
||||
// checklist's structured ones.
|
||||
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../link/boundary.dart';
|
||||
|
||||
const quickMarks = [
|
||||
'cold start',
|
||||
'engine start',
|
||||
'indicator left',
|
||||
'indicator right',
|
||||
'brake',
|
||||
'headlights',
|
||||
'something odd',
|
||||
];
|
||||
|
||||
Future<void> showMarkSheet(BuildContext context, Boundary b) {
|
||||
final custom = TextEditingController();
|
||||
return showModalBottomSheet(
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
useSafeArea: true,
|
||||
builder: (ctx) {
|
||||
void send(String text) {
|
||||
if (text.trim().isEmpty) return;
|
||||
b.command('mark', {'text': text.trim()});
|
||||
Navigator.pop(ctx);
|
||||
}
|
||||
|
||||
return Padding(
|
||||
// Clear the keyboard when it is up, the navigation bar when it is not.
|
||||
padding: EdgeInsets.fromLTRB(
|
||||
16,
|
||||
16,
|
||||
16,
|
||||
16 +
|
||||
max(
|
||||
MediaQuery.of(ctx).viewInsets.bottom,
|
||||
MediaQuery.of(ctx).viewPadding.bottom,
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Text(
|
||||
'Stamp into the recording',
|
||||
style: Theme.of(ctx).textTheme.titleMedium,
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Wrap(
|
||||
spacing: 8,
|
||||
runSpacing: 8,
|
||||
children: [
|
||||
for (final q in quickMarks)
|
||||
ActionChip(label: Text(q), onPressed: () => send(q)),
|
||||
],
|
||||
),
|
||||
TextField(
|
||||
controller: custom,
|
||||
decoration: const InputDecoration(labelText: 'Other'),
|
||||
onSubmitted: send,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../link/boundary.dart';
|
||||
import '../theme/palette.dart';
|
||||
|
||||
/// Power off or reboot the Orin: one confirmation that is also the choice. Sent once,
|
||||
/// never resent (contracts BOUNDARY.md: the ack cache does not survive the restart).
|
||||
Future<void> orinPowerOptions(BuildContext context, Boundary b) async {
|
||||
final host = b.hello?['host'] ?? 'the Orin';
|
||||
final verb = await showDialog<String>(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: Text('Power options: $host'),
|
||||
content: const Text(
|
||||
'Either way, recording stops and the session is closed cleanly.\n\n'
|
||||
'Power off: the Orin stays off until its power button is pressed.\n'
|
||||
'Reboot: it is back in about a minute; this screen reconnects by itself.',
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: const Text('Cancel'),
|
||||
),
|
||||
OutlinedButton.icon(
|
||||
onPressed: () => Navigator.of(context).pop('reboot'),
|
||||
icon: const Icon(Icons.restart_alt),
|
||||
label: const Text('Reboot'),
|
||||
),
|
||||
FilledButton.icon(
|
||||
style: FilledButton.styleFrom(
|
||||
backgroundColor: AppTheme.of(context).alarm,
|
||||
foregroundColor: AppTheme.of(context)
|
||||
.onFill(AppTheme.of(context).alarm),
|
||||
),
|
||||
onPressed: () => Navigator.of(context).pop('poweroff'),
|
||||
icon: const Icon(Icons.power_settings_new),
|
||||
label: const Text('Power off'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
if (verb == null || !context.mounted) return;
|
||||
final messenger = ScaffoldMessenger.of(context);
|
||||
final id = b.commandOnce(verb, {
|
||||
'confirm': verb,
|
||||
'boot_id': b.hello?['boot_id'],
|
||||
});
|
||||
if (id == null) {
|
||||
messenger.showSnackBar(
|
||||
const SnackBar(content: Text('Not sent: no link to the Orin')),
|
||||
);
|
||||
return;
|
||||
}
|
||||
final ack = await b.ackFor(id);
|
||||
final what = verb == 'reboot' ? 'rebooting' : 'shutting down';
|
||||
messenger.showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(
|
||||
ack == null
|
||||
? 'No reply: the Orin may or may not be $what'
|
||||
: ack.ok
|
||||
? 'Orin: ${ack.detail}'
|
||||
: 'Refused: ${ack.detail}',
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../link/boundary.dart';
|
||||
import '../link/net.dart';
|
||||
|
||||
/// Ask for the gateway's address and reconnect there, binding to the USB link when it is on it.
|
||||
Future<void> editUrl(BuildContext context, Boundary b, UsbLink usb) async {
|
||||
final c = TextEditingController(text: b.url);
|
||||
final url = await showDialog<String>(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
title: const Text('Gateway address'),
|
||||
content: TextField(controller: c, autofocus: true),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(ctx),
|
||||
child: const Text('Cancel'),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(ctx, c.text.trim()),
|
||||
child: const Text('Connect'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
if (url == null || url.isEmpty) return;
|
||||
await usb.bindFor(Uri.parse(url));
|
||||
b.retarget(url);
|
||||
}
|
||||
Reference in New Issue
Block a user