refactor: conditionalize profile fields, update chat navigation transitions, and fix provider state management during widget lifecycle
This commit is contained in:
@@ -90,16 +90,12 @@ class _ChatScreenState extends ConsumerState<ChatScreen>
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
@override
|
||||
void deactivate() {
|
||||
// Clear active conversation while ref is still valid (before dispose)
|
||||
ref.read(messagingProvider.notifier).setActiveConversation(null);
|
||||
super.deactivate();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
// Defer provider modification to avoid "modify during build" error
|
||||
final notifier = ref.read(messagingProvider.notifier);
|
||||
Future.microtask(() => notifier.setActiveConversation(null));
|
||||
|
||||
WidgetsBinding.instance.removeObserver(this);
|
||||
_connectionSub?.cancel();
|
||||
// Stop typing and leave room before disposing
|
||||
|
||||
Reference in New Issue
Block a user