1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-12-25 12:28:50 +00:00

Can create new conversations

This commit is contained in:
Pierre HUBERT 2020-05-09 14:38:58 +02:00
parent 27176531cf
commit c262e40e81
4 changed files with 13 additions and 5 deletions

View File

@ -37,7 +37,7 @@ abstract class MainController extends State<MainRoute> {
///
/// If the current route is not the main route, we pop one page
void popPage() {
if(!ModalRoute.of(context).isCurrent)
if (!ModalRoute.of(context).isCurrent)
Navigator.of(context).pop();
else
doPopPage();
@ -48,7 +48,7 @@ abstract class MainController extends State<MainRoute> {
void doPopPage();
/// Push a new widget
void push(Widget w, {bool hideNavBar});
void push(Widget w, {bool hideNavBar, bool allowAsDialog});
/// Open a conversation
void openConversation(int convID, {fullScreen: false});

View File

@ -243,7 +243,7 @@ class _MainRouteState extends MainController {
}
@override
void push(Widget w, {bool hideNavBar = false}) {
void push(Widget w, {bool hideNavBar = false, bool allowAsDialog}) {
_pushPage(CurrPage(
BarCallbackActions.OPEN_CUSTOM_WIDGET,
args: {"widget": w},

View File

@ -1,3 +1,4 @@
import 'package:comunic/ui/dialogs/screen_dialog.dart';
import 'package:comunic/ui/routes/main_route/main_route.dart';
import 'package:comunic/ui/widgets/tablet_mode/conversations/conversations_area_widget.dart';
import 'package:comunic/ui/widgets/tablet_mode/current_user_panel.dart';
@ -89,7 +90,12 @@ class _TabletRouteState extends MainController {
}
@override
void push(Widget w, {bool hideNavBar}) {
void push(Widget w, {bool hideNavBar, bool allowAsDialog}) {
if (allowAsDialog == true) {
showScreenDialog(context, w);
return;
}
// TODO: implement push
}

View File

@ -116,7 +116,9 @@ class _ConversationScreenState extends SafeState<ConversationsListScreen> {
/// Create a new conversation
void _createConversation() {
MainController.of(context).push(CreateConversationScreen());
MainController.of(context)
.push(CreateConversationScreen(), allowAsDialog: true);
if (widget.onOpen != null) widget.onOpen();
}
/// Handle conversations updated requests