Label machine provenance and choose server before chat harness

This commit is contained in:
2026-11-08 16:46:23 +00:00
parent 3fbfb85ace
commit 4c57c50a0f
18 changed files with 466 additions and 21 deletions
+27
View File
@@ -0,0 +1,27 @@
import 'package:flutter/widgets.dart';
import '../../features/settings/server_connections.dart';
/// The machine owning this mounted app. A profile rename rebuilds consumers;
/// changing machines creates a new gateway and app instead.
class ServerContext extends InheritedNotifier<ServerConnections> {
const ServerContext({
super.key,
required ServerConnections connections,
required this.serverId,
required super.child,
}) : super(notifier: connections);
final String? serverId;
static ServerContext? maybeOf(BuildContext context) =>
context.dependOnInheritedWidgetOfExactType<ServerContext>();
String? get name {
for (final server in notifier!.catalog.servers) {
if (server.id == serverId) return server.name;
}
return null;
}
static String metadata(BuildContext context, String detail) =>
[?maybeOf(context)?.name, if (detail.isNotEmpty) detail].join(' · ');
}