mirror of
				https://gitlab.com/comunic/comunicmobile
				synced 2025-11-04 04:04:18 +00:00 
			
		
		
		
	Auto-hide conversations list when a conversation is selected
This commit is contained in:
		@@ -32,7 +32,7 @@ mixin MainController implements State<MainRoute> {
 | 
				
			|||||||
  void push(Widget w, {bool hideNavBar});
 | 
					  void push(Widget w, {bool hideNavBar});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /// Open a conversation
 | 
					  /// Open a conversation
 | 
				
			||||||
  void openConversation(int convID);
 | 
					  void openConversation(int convID, {fullScreen: false});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /// Start a call for a given conversation
 | 
					  /// Start a call for a given conversation
 | 
				
			||||||
  void startCall(int convID);
 | 
					  void startCall(int convID);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -52,8 +52,6 @@ class CurrPage {
 | 
				
			|||||||
      "\n}";
 | 
					      "\n}";
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/// Private implementation of HomeController
 | 
					/// Private implementation of HomeController
 | 
				
			||||||
class _MainRouteState extends State<MainRoute> implements MainController {
 | 
					class _MainRouteState extends State<MainRoute> implements MainController {
 | 
				
			||||||
  CurrPage get _currTab => history.last;
 | 
					  CurrPage get _currTab => history.last;
 | 
				
			||||||
@@ -252,7 +250,7 @@ class _MainRouteState extends State<MainRoute> implements MainController {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  @override
 | 
					  @override
 | 
				
			||||||
  void openConversation(int convID) {
 | 
					  void openConversation(int convID, {fullScreen: false}) {
 | 
				
			||||||
    _pushPage(CurrPage(
 | 
					    _pushPage(CurrPage(
 | 
				
			||||||
      BarCallbackActions.OPEN_CONVERSATION,
 | 
					      BarCallbackActions.OPEN_CONVERSATION,
 | 
				
			||||||
      args: {"convID": convID},
 | 
					      args: {"convID": convID},
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -19,9 +19,13 @@ import 'package:flutter/material.dart';
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
class ConversationsListScreen extends StatefulWidget {
 | 
					class ConversationsListScreen extends StatefulWidget {
 | 
				
			||||||
  final bool useSmallFAB;
 | 
					  final bool useSmallFAB;
 | 
				
			||||||
 | 
					  final Function() onOpen;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const ConversationsListScreen({Key key, this.useSmallFAB = false})
 | 
					  const ConversationsListScreen({
 | 
				
			||||||
      : assert(useSmallFAB != null),
 | 
					    Key key,
 | 
				
			||||||
 | 
					    this.useSmallFAB = false,
 | 
				
			||||||
 | 
					    this.onOpen,
 | 
				
			||||||
 | 
					  })  : assert(useSmallFAB != null),
 | 
				
			||||||
        super(key: key);
 | 
					        super(key: key);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  @override
 | 
					  @override
 | 
				
			||||||
@@ -107,6 +111,7 @@ class _ConversationScreenState extends SafeState<ConversationsListScreen> {
 | 
				
			|||||||
  /// Open a conversation
 | 
					  /// Open a conversation
 | 
				
			||||||
  void _openConversation(int conversationId) {
 | 
					  void _openConversation(int conversationId) {
 | 
				
			||||||
    MainController.of(context).openConversation(conversationId);
 | 
					    MainController.of(context).openConversation(conversationId);
 | 
				
			||||||
 | 
					    if (widget.onOpen != null) widget.onOpen();
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /// Create a new conversation
 | 
					  /// Create a new conversation
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -38,6 +38,9 @@ class _OpenConversationButtonState extends State<OpenConversationButton> {
 | 
				
			|||||||
      width: 300,
 | 
					      width: 300,
 | 
				
			||||||
      height: 500,
 | 
					      height: 500,
 | 
				
			||||||
      child: Card(
 | 
					      child: Card(
 | 
				
			||||||
        child: ConversationsListScreen(useSmallFAB: true),
 | 
					        child: ConversationsListScreen(
 | 
				
			||||||
 | 
					          useSmallFAB: true,
 | 
				
			||||||
 | 
					          onOpen: () => _setShowConversationsList(false),
 | 
				
			||||||
 | 
					        ),
 | 
				
			||||||
      ));
 | 
					      ));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user