diff --git a/lib/ui/routes/main_route/main_route.dart b/lib/ui/routes/main_route/main_route.dart index a7df0e9..044dacc 100644 --- a/lib/ui/routes/main_route/main_route.dart +++ b/lib/ui/routes/main_route/main_route.dart @@ -37,7 +37,7 @@ abstract class MainController extends State { /// /// 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 { 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}); diff --git a/lib/ui/routes/main_route/smartphone_route.dart b/lib/ui/routes/main_route/smartphone_route.dart index 4807925..b0ac16d 100644 --- a/lib/ui/routes/main_route/smartphone_route.dart +++ b/lib/ui/routes/main_route/smartphone_route.dart @@ -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}, diff --git a/lib/ui/routes/main_route/tablet_route.dart b/lib/ui/routes/main_route/tablet_route.dart index a2e939b..136cc55 100644 --- a/lib/ui/routes/main_route/tablet_route.dart +++ b/lib/ui/routes/main_route/tablet_route.dart @@ -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 } diff --git a/lib/ui/screens/conversations_list_screen.dart b/lib/ui/screens/conversations_list_screen.dart index 4fb812d..a76a347 100644 --- a/lib/ui/screens/conversations_list_screen.dart +++ b/lib/ui/screens/conversations_list_screen.dart @@ -116,7 +116,9 @@ class _ConversationScreenState extends SafeState { /// 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