Connect saved machines concurrently in the chat workspace
This commit is contained in:
@@ -22,6 +22,26 @@ class ServerContext extends InheritedNotifier<ServerConnections> {
|
||||
return null;
|
||||
}
|
||||
|
||||
static String? nameFor(BuildContext context, String id) {
|
||||
final scope = maybeOf(context);
|
||||
for (final machine
|
||||
in scope?.notifier?.catalog.servers ?? const <dynamic>[]) {
|
||||
if (machine.id == id) return machine.name as String;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static Widget forServer(BuildContext context, String id, Widget child) {
|
||||
final scope = maybeOf(context);
|
||||
return scope == null || id.isEmpty
|
||||
? child
|
||||
: ServerContext(
|
||||
connections: scope.notifier!,
|
||||
serverId: id,
|
||||
child: child,
|
||||
);
|
||||
}
|
||||
|
||||
static String metadata(BuildContext context, String detail) =>
|
||||
[?maybeOf(context)?.name, if (detail.isNotEmpty) detail].join(' · ');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user