mirror of
				https://gitlab.com/comunic/comunicmobile
				synced 2025-11-04 04:04:18 +00:00 
			
		
		
		
	Remove Navigator references from conversations pages
This commit is contained in:
		@@ -1,7 +1,9 @@
 | 
				
			|||||||
import 'package:comunic/helpers/conversations_helper.dart';
 | 
					import 'package:comunic/helpers/conversations_helper.dart';
 | 
				
			||||||
import 'package:comunic/models/conversation.dart';
 | 
					import 'package:comunic/models/conversation.dart';
 | 
				
			||||||
 | 
					import 'package:comunic/ui/routes/home_route.dart';
 | 
				
			||||||
import 'package:comunic/ui/routes/update_conversation_route.dart';
 | 
					import 'package:comunic/ui/routes/update_conversation_route.dart';
 | 
				
			||||||
import 'package:comunic/ui/screens/conversation_screen.dart';
 | 
					import 'package:comunic/ui/screens/conversation_screen.dart';
 | 
				
			||||||
 | 
					import 'package:comunic/ui/widgets/comunic_back_button_widget.dart';
 | 
				
			||||||
import 'package:comunic/utils/intl_utils.dart';
 | 
					import 'package:comunic/utils/intl_utils.dart';
 | 
				
			||||||
import 'package:comunic/utils/ui_utils.dart';
 | 
					import 'package:comunic/utils/ui_utils.dart';
 | 
				
			||||||
import 'package:flutter/material.dart';
 | 
					import 'package:flutter/material.dart';
 | 
				
			||||||
@@ -44,7 +46,6 @@ class _ConversationRouteState extends State<ConversationRoute> {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    if (_conversation == null) return setError(true);
 | 
					    if (_conversation == null) return setError(true);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
    final conversationName =
 | 
					    final conversationName =
 | 
				
			||||||
        await ConversationsHelper.getConversationNameAsync(_conversation);
 | 
					        await ConversationsHelper.getConversationNameAsync(_conversation);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -58,11 +59,11 @@ class _ConversationRouteState extends State<ConversationRoute> {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  void _openSettings() {
 | 
					  void _openSettings() {
 | 
				
			||||||
    Navigator.of(context).push(MaterialPageRoute(builder: (b) {
 | 
					    HomeController.of(context).push(
 | 
				
			||||||
      return UpdateConversationRoute(
 | 
					        UpdateConversationRoute(
 | 
				
			||||||
          conversationID: widget.conversationID,
 | 
					          conversationID: widget.conversationID,
 | 
				
			||||||
      );
 | 
					        ),
 | 
				
			||||||
    }));
 | 
					        hideNavBar: true);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  Widget _buildRouteBody() {
 | 
					  Widget _buildRouteBody() {
 | 
				
			||||||
@@ -95,6 +96,7 @@ class _ConversationRouteState extends State<ConversationRoute> {
 | 
				
			|||||||
  Widget build(BuildContext context) {
 | 
					  Widget build(BuildContext context) {
 | 
				
			||||||
    return Scaffold(
 | 
					    return Scaffold(
 | 
				
			||||||
      appBar: AppBar(
 | 
					      appBar: AppBar(
 | 
				
			||||||
 | 
					        leading: ComunicBackButton(),
 | 
				
			||||||
        title: Text(
 | 
					        title: Text(
 | 
				
			||||||
          _conversationName == null ? tr("Loading") : _conversationName,
 | 
					          _conversationName == null ? tr("Loading") : _conversationName,
 | 
				
			||||||
        ),
 | 
					        ),
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,6 @@
 | 
				
			|||||||
import 'package:comunic/helpers/account_helper.dart';
 | 
					import 'package:comunic/helpers/account_helper.dart';
 | 
				
			||||||
import 'package:comunic/ui/routes/app_settings_route.dart';
 | 
					import 'package:comunic/ui/routes/app_settings_route.dart';
 | 
				
			||||||
 | 
					import 'package:comunic/ui/routes/conversation_route.dart';
 | 
				
			||||||
import 'package:comunic/ui/screens/conversations_list_screen.dart';
 | 
					import 'package:comunic/ui/screens/conversations_list_screen.dart';
 | 
				
			||||||
import 'package:comunic/ui/screens/friends_list_screen.dart';
 | 
					import 'package:comunic/ui/screens/friends_list_screen.dart';
 | 
				
			||||||
import 'package:comunic/ui/screens/group_screen.dart';
 | 
					import 'package:comunic/ui/screens/group_screen.dart';
 | 
				
			||||||
@@ -29,8 +30,14 @@ class HomeRoute extends StatefulWidget {
 | 
				
			|||||||
class CurrPage {
 | 
					class CurrPage {
 | 
				
			||||||
  final BarCallbackActions action;
 | 
					  final BarCallbackActions action;
 | 
				
			||||||
  final Map<String, dynamic> args;
 | 
					  final Map<String, dynamic> args;
 | 
				
			||||||
 | 
					  final bool hideNavBar;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const CurrPage(this.action, {this.args}) : assert(action != null);
 | 
					  const CurrPage(
 | 
				
			||||||
 | 
					    this.action, {
 | 
				
			||||||
 | 
					    this.args,
 | 
				
			||||||
 | 
					    this.hideNavBar = false,
 | 
				
			||||||
 | 
					  })  : assert(action != null),
 | 
				
			||||||
 | 
					        assert(hideNavBar != null);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  @override
 | 
					  @override
 | 
				
			||||||
  String toString() =>
 | 
					  String toString() =>
 | 
				
			||||||
@@ -60,6 +67,12 @@ abstract class HomeController extends State<HomeRoute> {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  /// Pop current page. Last page can not be popped
 | 
					  /// Pop current page. Last page can not be popped
 | 
				
			||||||
  void popPage();
 | 
					  void popPage();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  /// Push a new widget
 | 
				
			||||||
 | 
					  void push(Widget w, {bool hideNavBar});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  /// Open a conversation
 | 
				
			||||||
 | 
					  void openConversation(int convID);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/// Private implementation of HomeController
 | 
					/// Private implementation of HomeController
 | 
				
			||||||
@@ -129,6 +142,9 @@ class _HomeRouteState extends HomeController {
 | 
				
			|||||||
  /// Build the body of the application
 | 
					  /// Build the body of the application
 | 
				
			||||||
  Widget _buildBody(BuildContext context) {
 | 
					  Widget _buildBody(BuildContext context) {
 | 
				
			||||||
    switch (_currTab.action) {
 | 
					    switch (_currTab.action) {
 | 
				
			||||||
 | 
					      case BarCallbackActions.OPEN_CUSTOM_WIDGET:
 | 
				
			||||||
 | 
					        return _currTab.args["widget"];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      case BarCallbackActions.OPEN_NOTIFICATIONS:
 | 
					      case BarCallbackActions.OPEN_NOTIFICATIONS:
 | 
				
			||||||
        return NotificationsScreen();
 | 
					        return NotificationsScreen();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -158,6 +174,11 @@ class _HomeRouteState extends HomeController {
 | 
				
			|||||||
          userID: _currTab.args["userID"],
 | 
					          userID: _currTab.args["userID"],
 | 
				
			||||||
        );
 | 
					        );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      case BarCallbackActions.OPEN_CONVERSATION:
 | 
				
			||||||
 | 
					        return ConversationRoute(
 | 
				
			||||||
 | 
					          conversationID: _currTab.args["convID"],
 | 
				
			||||||
 | 
					        );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      default:
 | 
					      default:
 | 
				
			||||||
        throw "Invalid tab : " + _currTab.toString();
 | 
					        throw "Invalid tab : " + _currTab.toString();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -172,7 +193,9 @@ class _HomeRouteState extends HomeController {
 | 
				
			|||||||
        child: WillPopScope(
 | 
					        child: WillPopScope(
 | 
				
			||||||
          onWillPop: _willPop,
 | 
					          onWillPop: _willPop,
 | 
				
			||||||
          child: Scaffold(
 | 
					          child: Scaffold(
 | 
				
			||||||
            appBar: ComunicAppBar(
 | 
					            appBar: _currTab.hideNavBar
 | 
				
			||||||
 | 
					                ? null
 | 
				
			||||||
 | 
					                : ComunicAppBar(
 | 
				
			||||||
                    onTap: _onTap,
 | 
					                    onTap: _onTap,
 | 
				
			||||||
                    selectedAction: _currTab.action,
 | 
					                    selectedAction: _currTab.action,
 | 
				
			||||||
                  ),
 | 
					                  ),
 | 
				
			||||||
@@ -232,4 +255,22 @@ class _HomeRouteState extends HomeController {
 | 
				
			|||||||
    _pushPage(CurrPage(BarCallbackActions.OPEN_USER_FRIENDS_LIST,
 | 
					    _pushPage(CurrPage(BarCallbackActions.OPEN_USER_FRIENDS_LIST,
 | 
				
			||||||
        args: {"userID": userID}));
 | 
					        args: {"userID": userID}));
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  @override
 | 
				
			||||||
 | 
					  void push(Widget w, {bool hideNavBar = false}) {
 | 
				
			||||||
 | 
					    _pushPage(CurrPage(
 | 
				
			||||||
 | 
					      BarCallbackActions.OPEN_CUSTOM_WIDGET,
 | 
				
			||||||
 | 
					      args: {"widget": w},
 | 
				
			||||||
 | 
					      hideNavBar: hideNavBar,
 | 
				
			||||||
 | 
					    ));
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  @override
 | 
				
			||||||
 | 
					  void openConversation(int convID) {
 | 
				
			||||||
 | 
					    _pushPage(CurrPage(
 | 
				
			||||||
 | 
					      BarCallbackActions.OPEN_CONVERSATION,
 | 
				
			||||||
 | 
					      args: {"convID": convID},
 | 
				
			||||||
 | 
					      hideNavBar: true,
 | 
				
			||||||
 | 
					    ));
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,6 +3,7 @@ import 'package:comunic/helpers/users_helper.dart';
 | 
				
			|||||||
import 'package:comunic/lists/users_list.dart';
 | 
					import 'package:comunic/lists/users_list.dart';
 | 
				
			||||||
import 'package:comunic/models/conversation.dart';
 | 
					import 'package:comunic/models/conversation.dart';
 | 
				
			||||||
import 'package:comunic/ui/screens/update_conversation_screen.dart';
 | 
					import 'package:comunic/ui/screens/update_conversation_screen.dart';
 | 
				
			||||||
 | 
					import 'package:comunic/ui/widgets/comunic_back_button_widget.dart';
 | 
				
			||||||
import 'package:comunic/utils/intl_utils.dart';
 | 
					import 'package:comunic/utils/intl_utils.dart';
 | 
				
			||||||
import 'package:comunic/utils/ui_utils.dart';
 | 
					import 'package:comunic/utils/ui_utils.dart';
 | 
				
			||||||
import 'package:flutter/material.dart';
 | 
					import 'package:flutter/material.dart';
 | 
				
			||||||
@@ -83,6 +84,7 @@ class _UpdateConversationRoute extends State<UpdateConversationRoute> {
 | 
				
			|||||||
  Widget build(BuildContext context) {
 | 
					  Widget build(BuildContext context) {
 | 
				
			||||||
    return Scaffold(
 | 
					    return Scaffold(
 | 
				
			||||||
      appBar: AppBar(
 | 
					      appBar: AppBar(
 | 
				
			||||||
 | 
					        leading: ComunicBackButton(),
 | 
				
			||||||
        title: Text(tr("Update a conversation")),
 | 
					        title: Text(tr("Update a conversation")),
 | 
				
			||||||
      ),
 | 
					      ),
 | 
				
			||||||
      body: _buildBody(),
 | 
					      body: _buildBody(),
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,9 +3,9 @@ import 'package:comunic/helpers/conversations_helper.dart';
 | 
				
			|||||||
import 'package:comunic/helpers/users_helper.dart';
 | 
					import 'package:comunic/helpers/users_helper.dart';
 | 
				
			||||||
import 'package:comunic/lists/conversations_list.dart';
 | 
					import 'package:comunic/lists/conversations_list.dart';
 | 
				
			||||||
import 'package:comunic/models/conversation.dart';
 | 
					import 'package:comunic/models/conversation.dart';
 | 
				
			||||||
import 'package:comunic/ui/routes/conversation_route.dart';
 | 
					import 'package:comunic/ui/routes/home_route.dart';
 | 
				
			||||||
import 'package:comunic/ui/routes/create_conversation_route.dart';
 | 
					 | 
				
			||||||
import 'package:comunic/ui/routes/update_conversation_route.dart';
 | 
					import 'package:comunic/ui/routes/update_conversation_route.dart';
 | 
				
			||||||
 | 
					import 'package:comunic/ui/screens/create_conversation_screen.dart';
 | 
				
			||||||
import 'package:comunic/ui/tiles/conversation_tile.dart';
 | 
					import 'package:comunic/ui/tiles/conversation_tile.dart';
 | 
				
			||||||
import 'package:comunic/utils/intl_utils.dart';
 | 
					import 'package:comunic/utils/intl_utils.dart';
 | 
				
			||||||
import 'package:comunic/utils/ui_utils.dart';
 | 
					import 'package:comunic/utils/ui_utils.dart';
 | 
				
			||||||
@@ -94,28 +94,21 @@ class _ConversationScreenState extends State<ConversationsListScreen> {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /// Open a conversation
 | 
					  /// Open a conversation
 | 
				
			||||||
  void _openConversation(BuildContext context, int conversationId) {
 | 
					  void _openConversation(int conversationId) {
 | 
				
			||||||
    Navigator.of(context).push(MaterialPageRoute(builder: (c) {
 | 
					    HomeController.of(context).openConversation(conversationId);
 | 
				
			||||||
      return ConversationRoute(
 | 
					 | 
				
			||||||
        conversationID: conversationId,
 | 
					 | 
				
			||||||
      );
 | 
					 | 
				
			||||||
    }));
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /// Create a new conversation
 | 
					  /// Create a new conversation
 | 
				
			||||||
  void _createConversation(BuildContext context) {
 | 
					  void _createConversation() {
 | 
				
			||||||
    Navigator.of(context)
 | 
					    HomeController.of(context).push(CreateConversationScreen());
 | 
				
			||||||
        .push(MaterialPageRoute(builder: (c) => CreateConversationRoute()));
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /// Handle conversations updated requests
 | 
					  /// Handle conversations updated requests
 | 
				
			||||||
  void _updateConversation(Conversation conversation) {
 | 
					  void _updateConversation(Conversation conversation) {
 | 
				
			||||||
    Navigator.of(context).push(
 | 
					    HomeController.of(context).push(
 | 
				
			||||||
      MaterialPageRoute(
 | 
					      UpdateConversationRoute(
 | 
				
			||||||
        builder: (c) => UpdateConversationRoute(
 | 
					 | 
				
			||||||
        conversationID: conversation.id,
 | 
					        conversationID: conversation.id,
 | 
				
			||||||
      ),
 | 
					      ),
 | 
				
			||||||
      ),
 | 
					 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -181,7 +174,7 @@ class _ConversationScreenState extends State<ConversationsListScreen> {
 | 
				
			|||||||
                      conversation: _list.elementAt(index),
 | 
					                      conversation: _list.elementAt(index),
 | 
				
			||||||
                      usersList: _list.users,
 | 
					                      usersList: _list.users,
 | 
				
			||||||
                      onOpen: (c) {
 | 
					                      onOpen: (c) {
 | 
				
			||||||
                        _openConversation(context, c.id);
 | 
					                        _openConversation(c.id);
 | 
				
			||||||
                      },
 | 
					                      },
 | 
				
			||||||
                      onRequestUpdate: _updateConversation,
 | 
					                      onRequestUpdate: _updateConversation,
 | 
				
			||||||
                      onRequestDelete: _requestDeleteConversation,
 | 
					                      onRequestDelete: _requestDeleteConversation,
 | 
				
			||||||
@@ -199,7 +192,7 @@ class _ConversationScreenState extends State<ConversationsListScreen> {
 | 
				
			|||||||
          right: 20.0,
 | 
					          right: 20.0,
 | 
				
			||||||
          bottom: 20.0,
 | 
					          bottom: 20.0,
 | 
				
			||||||
          child: FloatingActionButton(
 | 
					          child: FloatingActionButton(
 | 
				
			||||||
            onPressed: () => _createConversation(context),
 | 
					            onPressed: () => _createConversation(),
 | 
				
			||||||
            child: Icon(Icons.add),
 | 
					            child: Icon(Icons.add),
 | 
				
			||||||
          ),
 | 
					          ),
 | 
				
			||||||
        ),
 | 
					        ),
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,5 @@
 | 
				
			|||||||
import 'package:comunic/ui/screens/update_conversation_screen.dart';
 | 
					import 'package:comunic/ui/screens/update_conversation_screen.dart';
 | 
				
			||||||
 | 
					import 'package:comunic/ui/widgets/comunic_back_button_widget.dart';
 | 
				
			||||||
import 'package:comunic/utils/intl_utils.dart';
 | 
					import 'package:comunic/utils/intl_utils.dart';
 | 
				
			||||||
import 'package:flutter/material.dart';
 | 
					import 'package:flutter/material.dart';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -6,14 +7,14 @@ import 'package:flutter/material.dart';
 | 
				
			|||||||
///
 | 
					///
 | 
				
			||||||
/// @author Pierre HUBERT
 | 
					/// @author Pierre HUBERT
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class CreateConversationRoute extends StatelessWidget {
 | 
					class CreateConversationScreen extends StatelessWidget {
 | 
				
			||||||
  @override
 | 
					  @override
 | 
				
			||||||
  Widget build(BuildContext context) {
 | 
					  Widget build(BuildContext context) {
 | 
				
			||||||
    return Scaffold(
 | 
					    return Scaffold(
 | 
				
			||||||
      appBar: AppBar(
 | 
					      appBar: AppBar(
 | 
				
			||||||
 | 
					        leading: ComunicBackButton(),
 | 
				
			||||||
        title: Text(tr("Create a conversation")),
 | 
					        title: Text(tr("Create a conversation")),
 | 
				
			||||||
      ),
 | 
					      ),
 | 
				
			||||||
 | 
					 | 
				
			||||||
      body: UpdateConversationScreen(),
 | 
					      body: UpdateConversationScreen(),
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
@@ -1,7 +1,7 @@
 | 
				
			|||||||
import 'package:comunic/helpers/conversations_helper.dart';
 | 
					import 'package:comunic/helpers/conversations_helper.dart';
 | 
				
			||||||
import 'package:comunic/lists/users_list.dart';
 | 
					import 'package:comunic/lists/users_list.dart';
 | 
				
			||||||
import 'package:comunic/models/conversation.dart';
 | 
					import 'package:comunic/models/conversation.dart';
 | 
				
			||||||
import 'package:comunic/ui/routes/conversation_route.dart';
 | 
					import 'package:comunic/ui/routes/home_route.dart';
 | 
				
			||||||
import 'package:comunic/ui/tiles/simple_user_tile.dart';
 | 
					import 'package:comunic/ui/tiles/simple_user_tile.dart';
 | 
				
			||||||
import 'package:comunic/ui/widgets/pick_user_widget.dart';
 | 
					import 'package:comunic/ui/widgets/pick_user_widget.dart';
 | 
				
			||||||
import 'package:comunic/utils/intl_utils.dart';
 | 
					import 'package:comunic/utils/intl_utils.dart';
 | 
				
			||||||
@@ -158,7 +158,8 @@ class _UpdateConversationScreen extends State<UpdateConversationScreen> {
 | 
				
			|||||||
    if (isUpdating)
 | 
					    if (isUpdating)
 | 
				
			||||||
      error = !(await ConversationsHelper().updateConversation(settings));
 | 
					      error = !(await ConversationsHelper().updateConversation(settings));
 | 
				
			||||||
    else {
 | 
					    else {
 | 
				
			||||||
      conversationID = await ConversationsHelper().createConversation(settings);
 | 
					      conversationID =
 | 
				
			||||||
 | 
					          await ConversationsHelper().createConversation(settings);
 | 
				
			||||||
      if (conversationID < 1) error = true;
 | 
					      if (conversationID < 1) error = true;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -172,9 +173,9 @@ class _UpdateConversationScreen extends State<UpdateConversationScreen> {
 | 
				
			|||||||
      ));
 | 
					      ));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Open the conversation
 | 
					    // Open the conversation
 | 
				
			||||||
    Navigator.of(context).pushReplacement(MaterialPageRoute(
 | 
					
 | 
				
			||||||
        builder: (c) => ConversationRoute(
 | 
					    HomeController.of(context).popPage();
 | 
				
			||||||
              conversationID: conversationID,
 | 
					    if (!isUpdating)
 | 
				
			||||||
            )));
 | 
					      HomeController.of(context).openConversation(conversationID);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										11
									
								
								lib/ui/widgets/comunic_back_button_widget.dart
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								lib/ui/widgets/comunic_back_button_widget.dart
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,11 @@
 | 
				
			|||||||
 | 
					import 'package:comunic/utils/navigation_utils.dart';
 | 
				
			||||||
 | 
					import 'package:flutter/material.dart';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class ComunicBackButton extends StatelessWidget {
 | 
				
			||||||
 | 
					  @override
 | 
				
			||||||
 | 
					  Widget build(BuildContext context) {
 | 
				
			||||||
 | 
					    return BackButton(
 | 
				
			||||||
 | 
					      onPressed: () => popPage(context),
 | 
				
			||||||
 | 
					    );
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -10,6 +10,7 @@ typedef OnSelectMenuAction = void Function(BarCallbackActions);
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/// Callback actions
 | 
					/// Callback actions
 | 
				
			||||||
enum BarCallbackActions {
 | 
					enum BarCallbackActions {
 | 
				
			||||||
 | 
					  OPEN_CUSTOM_WIDGET,
 | 
				
			||||||
  OPEN_NOTIFICATIONS,
 | 
					  OPEN_NOTIFICATIONS,
 | 
				
			||||||
  OPEN_CONVERSATIONS,
 | 
					  OPEN_CONVERSATIONS,
 | 
				
			||||||
  OPEN_NEWEST_POSTS,
 | 
					  OPEN_NEWEST_POSTS,
 | 
				
			||||||
@@ -22,6 +23,7 @@ enum BarCallbackActions {
 | 
				
			|||||||
  OPEN_APP_SETTINGS,
 | 
					  OPEN_APP_SETTINGS,
 | 
				
			||||||
  OPEN_USER_FRIENDS_LIST,
 | 
					  OPEN_USER_FRIENDS_LIST,
 | 
				
			||||||
  OPEN_ABOUT_DIALOG,
 | 
					  OPEN_ABOUT_DIALOG,
 | 
				
			||||||
 | 
					  OPEN_CONVERSATION,
 | 
				
			||||||
  NONE,
 | 
					  NONE,
 | 
				
			||||||
  ACTION_LOGOUT
 | 
					  ACTION_LOGOUT
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,5 @@
 | 
				
			|||||||
import 'package:comunic/helpers/conversations_helper.dart';
 | 
					import 'package:comunic/helpers/conversations_helper.dart';
 | 
				
			||||||
import 'package:comunic/ui/routes/conversation_route.dart';
 | 
					import 'package:comunic/ui/routes/home_route.dart';
 | 
				
			||||||
import 'package:comunic/utils/intl_utils.dart';
 | 
					import 'package:comunic/utils/intl_utils.dart';
 | 
				
			||||||
import 'package:comunic/utils/ui_utils.dart';
 | 
					import 'package:comunic/utils/ui_utils.dart';
 | 
				
			||||||
import 'package:flutter/material.dart';
 | 
					import 'package:flutter/material.dart';
 | 
				
			||||||
@@ -18,13 +18,7 @@ Future<bool> openPrivateConversation(BuildContext context, int userID) async {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Open the conversation
 | 
					  // Open the conversation
 | 
				
			||||||
  Navigator.of(context).push(
 | 
					  HomeController.of(context).openConversation(convID);
 | 
				
			||||||
    MaterialPageRoute(
 | 
					 | 
				
			||||||
      builder: (c) => ConversationRoute(
 | 
					 | 
				
			||||||
            conversationID: convID,
 | 
					 | 
				
			||||||
          ),
 | 
					 | 
				
			||||||
    ),
 | 
					 | 
				
			||||||
  );
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Success
 | 
					  // Success
 | 
				
			||||||
  return true;
 | 
					  return true;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -10,6 +10,11 @@ import 'package:meta/meta.dart';
 | 
				
			|||||||
///
 | 
					///
 | 
				
			||||||
/// @author Pierre HUBERT
 | 
					/// @author Pierre HUBERT
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/// Pop a page
 | 
				
			||||||
 | 
					void popPage(BuildContext context) {
 | 
				
			||||||
 | 
					  HomeController.of(context).popPage();
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/// Open the page of a user
 | 
					/// Open the page of a user
 | 
				
			||||||
void openUserPage({@required int userID, @required BuildContext context}) {
 | 
					void openUserPage({@required int userID, @required BuildContext context}) {
 | 
				
			||||||
  assert(userID != null);
 | 
					  assert(userID != null);
 | 
				
			||||||
@@ -20,8 +25,7 @@ void openUserPage({@required int userID, @required BuildContext context}) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/// Open a post in full screen
 | 
					/// Open a post in full screen
 | 
				
			||||||
void openPostFullScreen(int postID, BuildContext context) {
 | 
					void openPostFullScreen(int postID, BuildContext context) {
 | 
				
			||||||
  Navigator.of(context)
 | 
					  HomeController.of(context).push(SinglePostRoute(postID: postID));
 | 
				
			||||||
      .push(MaterialPageRoute(builder: (c) => SinglePostRoute(postID: postID)));
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/// Open a virtual directory
 | 
					/// Open a virtual directory
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user