1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-22 12:59:21 +00:00

Ready to implement call system

This commit is contained in:
Pierre HUBERT 2020-05-09 19:45:07 +02:00
parent 44f417a0f2
commit 642820127c
3 changed files with 44 additions and 5 deletions

View File

@ -1,5 +1,6 @@
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/calls/calls_area.dart';
import 'package:comunic/ui/widgets/tablet_mode/conversations/conversations_area_widget.dart';
import 'package:comunic/ui/widgets/tablet_mode/current_user_panel.dart';
import 'package:comunic/ui/widgets/tablet_mode/global_search_field.dart';
@ -20,6 +21,7 @@ class TabletRoute extends StatefulWidget implements MainRoute {
class _TabletRouteState extends MainController {
final _conversationsKey = GlobalKey<ConversationsAreaWidgetState>();
final _callsKey = GlobalKey<CallsAreaState>();
@override
Widget build(BuildContext context) {
@ -38,7 +40,8 @@ class _TabletRouteState extends MainController {
right: 0,
bottom: 0,
child: ConversationsAreaWidget(key: _conversationsKey),
)
),
CallsArea(key: _callsKey),
],
);
@ -101,9 +104,7 @@ class _TabletRouteState extends MainController {
}
@override
void startCall(int convID) {
// TODO: implement startCall
}
void startCall(int convID) => _callsKey.currentState.openCall(convID);
@override
void doPopPage() {

View File

@ -0,0 +1,26 @@
import 'package:comunic/utils/intl_utils.dart';
import 'package:comunic/utils/ui_utils.dart';
import 'package:flutter/material.dart';
/// Tablets mode calls area
///
/// @author Pierre Hubert
class CallsArea extends StatefulWidget {
const CallsArea({Key key}) : super(key: key);
@override
CallsAreaState createState() => CallsAreaState();
}
class CallsAreaState extends State<CallsArea> {
@override
Widget build(BuildContext context) {
return Stack();
}
/// Open a new call
void openCall(int convID) {
showSimpleSnack(context, tr("Open call $convID"));
}
}

View File

@ -2,6 +2,7 @@ import 'package:comunic/helpers/conversations_helper.dart';
import 'package:comunic/helpers/events_helper.dart';
import 'package:comunic/models/conversation.dart';
import 'package:comunic/ui/dialogs/screen_dialog.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_members_screen.dart';
import 'package:comunic/ui/screens/conversation_screen.dart';
@ -16,7 +17,7 @@ import 'package:flutter/material.dart';
///
/// @author Pierre Hubert
enum _Actions { OPEN_MEMBERS, OPEN_SETTINGS }
enum _Actions { START_CALL, OPEN_MEMBERS, OPEN_SETTINGS }
class ConversationWindow extends StatefulWidget {
final int convID;
@ -127,6 +128,13 @@ class _ConversationWindowState extends SafeState<ConversationWindow> {
action: <Widget>[
PopupMenuButton<_Actions>(
itemBuilder: (c) => [
// Start a new call
PopupMenuItem(
child: Text(tr("Start call")),
value: _Actions.START_CALL,
enabled: _conversation.callCapabilities != CallCapabilities.NONE,
),
// Show the list of members
PopupMenuItem(
child: Text(tr("Members")),
@ -151,6 +159,10 @@ class _ConversationWindowState extends SafeState<ConversationWindow> {
void _menuCallback(_Actions value) {
switch (value) {
case _Actions.START_CALL:
MainController.of(context).startCall(_convID);
break;
case _Actions.OPEN_MEMBERS:
_openMembersList();
break;