From 9aea0e7837ae0ea3d417f3d2afd8554cd71f123d Mon Sep 17 00:00:00 2001
From: Matthias Nott <mnott@mnsoft.org>
Date: Wed, 25 Mar 2026 15:27:00 +0100
Subject: [PATCH] feat: show connection status detail in app bar during connect
---
lib/screens/chat_screen.dart | 26 +++++++++++++++++++++++---
1 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/lib/screens/chat_screen.dart b/lib/screens/chat_screen.dart
index 2e1155a..f3c13f8 100644
--- a/lib/screens/chat_screen.dart
+++ b/lib/screens/chat_screen.dart
@@ -160,6 +160,14 @@
_ws!.onStatusChanged = (status) {
if (mounted) {
ref.read(wsStatusProvider.notifier).state = status;
+ if (status == ConnectionStatus.connected) {
+ ref.read(connectionDetailProvider.notifier).state = '';
+ }
+ }
+ };
+ _ws!.onStatusDetail = (detail) {
+ if (mounted) {
+ ref.read(connectionDetailProvider.notifier).state = detail;
}
};
_ws!.onMessage = _handleMessage;
@@ -1301,6 +1309,7 @@
final messages = ref.watch(messagesProvider);
final wsStatus = ref.watch(wsStatusProvider);
final isTyping = ref.watch(isTypingProvider);
+ final connectionDetail = ref.watch(connectionDetailProvider);
final sessions = ref.watch(sessionsProvider);
final activeSession = ref.watch(activeSessionProvider);
final unreadCounts = ref.watch(unreadCountsProvider);
@@ -1319,9 +1328,20 @@
_scaffoldKey.currentState?.openDrawer();
},
),
- title: Text(
- activeSession?.name ?? 'PAILot',
- style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w600),
+ title: Column(
+ crossAxisAlignment: CrossAxisAlignment.center,
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Text(
+ activeSession?.name ?? 'PAILot',
+ style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w600),
+ ),
+ if (connectionDetail.isNotEmpty && wsStatus != ConnectionStatus.connected)
+ Text(
+ connectionDetail,
+ style: TextStyle(fontSize: 11, color: Colors.grey.shade400),
+ ),
+ ],
),
actions: [
StatusDot(status: wsStatus),
--
Gitblit v1.3.1