diff --git a/lib/ui/routes/conversation_route.dart b/lib/ui/routes/conversation_route.dart index 7df640c..7c5f4a7 100644 --- a/lib/ui/routes/conversation_route.dart +++ b/lib/ui/routes/conversation_route.dart @@ -102,6 +102,17 @@ class _ConversationRouteState extends State { _conversationName == null ? tr("Loading") : _conversationName, ), actions: [ + // Start call (if possible) + _conversation == null || + _conversation.callCapabilities == CallCapabilities.NONE + ? Container() + : IconButton( + icon: Icon(Icons.phone), + onPressed: () => MainController.of(context) + .startCall(widget.conversationID), + ), + + // Edit conversation settings IconButton( icon: Icon(Icons.settings), onPressed: _openSettings, diff --git a/lib/ui/routes/main_route.dart b/lib/ui/routes/main_route.dart index 01fba81..9f88725 100644 --- a/lib/ui/routes/main_route.dart +++ b/lib/ui/routes/main_route.dart @@ -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/screens/call_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/group_screen.dart'; @@ -75,6 +76,9 @@ abstract class MainController extends State { /// Open a conversation void openConversation(int convID); + + /// Start a call for a given conversation + void startCall(int convID); } /// Private implementation of HomeController @@ -287,4 +291,9 @@ class _MainRouteState extends MainController { hideNavBar: true, )); } + + @override + void startCall(int convID) { + push(CallScreen(convID: convID), hideNavBar: true); + } } diff --git a/lib/ui/screens/call_screen.dart b/lib/ui/screens/call_screen.dart new file mode 100644 index 0000000..b3866ac --- /dev/null +++ b/lib/ui/screens/call_screen.dart @@ -0,0 +1,24 @@ +import 'package:flutter/material.dart'; + +/// Call screen +/// +/// @author Pierre Hubert + +class CallScreen extends StatefulWidget { + final int convID; + + const CallScreen({Key key, @required this.convID}) + : assert(convID != null), + assert(convID > 0), + super(key: key); + + @override + _CallScreenState createState() => _CallScreenState(); +} + +class _CallScreenState extends State { + @override + Widget build(BuildContext context) { + return Container(); + } +}