mirror of
				https://gitlab.com/comunic/comunicmobile
				synced 2025-11-03 19:54:12 +00:00 
			
		
		
		
	Identify conversation windows with keys
This commit is contained in:
		@@ -16,13 +16,13 @@ class ConversationsAreaWidget extends StatefulWidget {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
class ConversationsAreaWidgetState extends State<ConversationsAreaWidget> {
 | 
			
		||||
  final _openConversations = Set<int>();
 | 
			
		||||
  final _openConversations = Map<int, UniqueKey>();
 | 
			
		||||
 | 
			
		||||
  @override
 | 
			
		||||
  Widget build(BuildContext context) {
 | 
			
		||||
    return Row(
 | 
			
		||||
      crossAxisAlignment: CrossAxisAlignment.end,
 | 
			
		||||
      children: _openConversations.map(_conversationWindow).toList()
 | 
			
		||||
      children: _openConversations.map(_conversationWindow).values.toList()
 | 
			
		||||
        ..add(_buildOpenButton()),
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
@@ -32,11 +32,17 @@ class ConversationsAreaWidgetState extends State<ConversationsAreaWidget> {
 | 
			
		||||
 | 
			
		||||
  /// Open a new conversation
 | 
			
		||||
  void openConversations(int convID) {
 | 
			
		||||
    setState(() => _openConversations.add(convID));
 | 
			
		||||
    if (!_openConversations.containsKey(convID))
 | 
			
		||||
      setState(() => _openConversations[convID] = UniqueKey());
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  Widget _conversationWindow(int convID) => ConversationWindow(
 | 
			
		||||
        convID: convID,
 | 
			
		||||
        onClose: () => setState(() => _openConversations.remove(convID)),
 | 
			
		||||
  MapEntry<int, Widget> _conversationWindow(int convID, UniqueKey key) =>
 | 
			
		||||
      MapEntry(
 | 
			
		||||
        convID,
 | 
			
		||||
        ConversationWindow(
 | 
			
		||||
          key: key,
 | 
			
		||||
          convID: convID,
 | 
			
		||||
          onClose: () => setState(() => _openConversations.remove(convID)),
 | 
			
		||||
        ),
 | 
			
		||||
      );
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user