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

Start to show call window

This commit is contained in:
Pierre HUBERT 2020-05-10 13:46:45 +02:00
parent 63a8e61e80
commit b40308c9e4
2 changed files with 47 additions and 4 deletions

View File

@ -0,0 +1,32 @@
import 'package:comunic/ui/screens/call_screen.dart';
import 'package:flutter/material.dart';
/// Call window widget
///
/// @author Pierre HUBERT
class CallWindowWidget extends StatefulWidget {
final int convID;
const CallWindowWidget({
Key key,
this.convID,
}) : assert(convID != null),
super(key: key);
@override
_CallWindowWidgetState createState() => _CallWindowWidgetState();
}
class _CallWindowWidgetState extends State<CallWindowWidget> {
@override
Widget build(BuildContext context) {
return Positioned(
width: 500,
height: 200,
right: 10,
top: 10,
child: Card(child: CallScreen(convID: widget.convID)),
);
}
}

View File

@ -1,5 +1,4 @@
import 'package:comunic/utils/intl_utils.dart';
import 'package:comunic/utils/ui_utils.dart';
import 'package:comunic/ui/widgets/tablet_mode/calls/call_window_widget.dart';
import 'package:flutter/material.dart';
/// Tablets mode calls area
@ -14,13 +13,25 @@ class CallsArea extends StatefulWidget {
}
class CallsAreaState extends State<CallsArea> {
final _openCalls = Map<int, Key>();
@override
Widget build(BuildContext context) {
return Stack();
return Stack(
children: _openCalls
.map((convID, key) =>
MapEntry(convID, CallWindowWidget(key: key, convID: convID)))
.values
.toList(),
);
}
/// Open a new call
void openCall(int convID) {
showSimpleSnack(context, tr("Open call $convID"));
if (!_openCalls.containsKey(convID)) {
setState(() {
_openCalls[convID] = UniqueKey();
});
}
}
}