Fix overlay: Directionality widget + startListening state guard
- Wrap overlay Stack with Directionality (required above MaterialApp) - Guard startListening() for IncomingData/StaleData states to prevent overlay dismissal when status reloads on app resume Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -76,7 +76,15 @@ class ChatRequest extends _$ChatRequest {
|
||||
ChatRequestData build() => const ChatRequestIdleData();
|
||||
|
||||
Future<void> startListening() async {
|
||||
if (state is ChatRequestAcceptingData || state is ChatRequestAcceptedData) return;
|
||||
// Don't reset state if showing a request, stale message, or actively accepting
|
||||
if (state is ChatRequestIncomingData ||
|
||||
state is ChatRequestStaleData ||
|
||||
state is ChatRequestAcceptingData ||
|
||||
state is ChatRequestAcceptedData) {
|
||||
// Still reconnect WebSocket if needed, but don't change state
|
||||
if (_channel == null) await _connectWebSocket();
|
||||
return;
|
||||
}
|
||||
_closeWebSocket();
|
||||
state = const ChatRequestListeningData();
|
||||
await _connectWebSocket();
|
||||
|
||||
@@ -79,7 +79,9 @@ class _ChatRequestOverlayState extends ConsumerState<ChatRequestOverlay>
|
||||
}
|
||||
});
|
||||
|
||||
return Stack(
|
||||
return Directionality(
|
||||
textDirection: TextDirection.ltr,
|
||||
child: Stack(
|
||||
children: [
|
||||
widget.child,
|
||||
if (_visible) ...[
|
||||
@@ -108,6 +110,7 @@ class _ChatRequestOverlayState extends ConsumerState<ChatRequestOverlay>
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user