mirror of
https://gitlab.com/comunic/comunicmobile
synced 2025-06-19 08:15:16 +00:00
Prepare Tablet mode integration
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
import 'package:comunic/helpers/conversations_helper.dart';
|
||||
import 'package:comunic/models/conversation.dart';
|
||||
import 'package:comunic/ui/routes/main_route.dart';
|
||||
import 'package:comunic/ui/routes/main_route/main_route.dart';
|
||||
import 'package:comunic/ui/routes/update_conversation_route.dart';
|
||||
import 'package:comunic/ui/screens/conversation_screen.dart';
|
||||
import 'package:comunic/ui/widgets/comunic_back_button_widget.dart';
|
||||
|
39
lib/ui/routes/main_route/main_route.dart
Normal file
39
lib/ui/routes/main_route/main_route.dart
Normal file
@ -0,0 +1,39 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// Abstract main application route
|
||||
///
|
||||
/// This mixin contains methods available in all display modes
|
||||
///
|
||||
/// @author Pierre Hubert
|
||||
|
||||
mixin MainRoute implements StatefulWidget {}
|
||||
|
||||
/// Public interface of home controller
|
||||
mixin MainController implements State<MainRoute> {
|
||||
/// Get current instance of Home controller
|
||||
static MainController of(BuildContext context) =>
|
||||
context.findAncestorStateOfType<MainController>();
|
||||
|
||||
/// Open user page
|
||||
void openUserPage(int userID);
|
||||
|
||||
void openUserAccessDeniedPage(int userID);
|
||||
|
||||
/// Open a specific group page specified by its [groupID]
|
||||
void openGroup(int groupID);
|
||||
|
||||
/// Display the list of friends of a user
|
||||
void openUserFriendsList(int userID);
|
||||
|
||||
/// Pop current page. Last page can not be popped
|
||||
void popPage();
|
||||
|
||||
/// Push a new widget
|
||||
void push(Widget w, {bool hideNavBar});
|
||||
|
||||
/// Open a conversation
|
||||
void openConversation(int convID);
|
||||
|
||||
/// Start a call for a given conversation
|
||||
void startCall(int convID);
|
||||
}
|
@ -2,6 +2,7 @@ import 'package:comunic/helpers/account_helper.dart';
|
||||
import 'package:comunic/ui/routes/account_settings/account_settings_route.dart';
|
||||
import 'package:comunic/ui/routes/app_settings_route.dart';
|
||||
import 'package:comunic/ui/routes/conversation_route.dart';
|
||||
import 'package:comunic/ui/routes/main_route/main_route.dart';
|
||||
import 'package:comunic/ui/screens/call_screen.dart';
|
||||
import 'package:comunic/ui/screens/conversations_list_screen.dart';
|
||||
import 'package:comunic/ui/screens/friends_list_screen.dart';
|
||||
@ -19,13 +20,13 @@ import 'package:comunic/utils/intl_utils.dart';
|
||||
import 'package:comunic/utils/ui_utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'login_route.dart';
|
||||
import '../login_route.dart';
|
||||
|
||||
/// Main route of the application
|
||||
///
|
||||
/// @author Pierre HUBERT
|
||||
|
||||
class MainRoute extends StatefulWidget {
|
||||
class SmartphoneMainRoute extends StatefulWidget implements MainRoute {
|
||||
@override
|
||||
State<StatefulWidget> createState() => _MainRouteState();
|
||||
}
|
||||
@ -51,38 +52,10 @@ class CurrPage {
|
||||
"\n}";
|
||||
}
|
||||
|
||||
/// Public interface of home controller
|
||||
abstract class MainController extends State<MainRoute> {
|
||||
/// Get current instance of Home controller
|
||||
static MainController of(BuildContext context) =>
|
||||
context.findAncestorStateOfType<MainController>();
|
||||
|
||||
/// Open user page
|
||||
void openUserPage(int userID);
|
||||
|
||||
void openUserAccessDeniedPage(int userID);
|
||||
|
||||
/// Open a specific group page specified by its [groupID]
|
||||
void openGroup(int groupID);
|
||||
|
||||
/// Display the list of friends of a user
|
||||
void openUserFriendsList(int userID);
|
||||
|
||||
/// Pop current page. Last page can not be popped
|
||||
void popPage();
|
||||
|
||||
/// Push a new widget
|
||||
void push(Widget w, {bool hideNavBar});
|
||||
|
||||
/// Open a conversation
|
||||
void openConversation(int convID);
|
||||
|
||||
/// Start a call for a given conversation
|
||||
void startCall(int convID);
|
||||
}
|
||||
|
||||
/// Private implementation of HomeController
|
||||
class _MainRouteState extends MainController {
|
||||
class _MainRouteState extends State<MainRoute> implements MainController {
|
||||
CurrPage get _currTab => history.last;
|
||||
List<CurrPage> history = List();
|
||||
|
Reference in New Issue
Block a user