1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-10-23 06:53:23 +00:00

Can toggle menubars

This commit is contained in:
Pierre HUBERT 2020-04-22 18:55:29 +02:00
parent d083728251
commit a74600ce4b

View File

@ -49,6 +49,12 @@ class _CallScreenState extends SafeState<CallScreen> {
final _renderers = Map<int, RTCVideoRenderer>();
MediaStream _localStream;
var _isLocalStreamVisible = true;
var _hideMenuBars = false;
bool get _canHideMenuBar =>
_hideMenuBars &&
_canMakeVideoCall &&
_renderers.keys.where((f) => f != userID()).length > 0;
bool get _canMakeVideoCall =>
_conversation.callCapabilities == CallCapabilities.VIDEO;
@ -262,6 +268,13 @@ class _CallScreenState extends SafeState<CallScreen> {
}
}
/// Toggle menubar visibility
void _toggleMenuBarsVisibility() {
setState(() {
_hideMenuBars = !_hideMenuBars;
});
}
/// Toggle local video streaming
Future<void> _toggleStreaming(bool isVideo) async {
if (isVideo && !_canMakeVideoCall) {
@ -408,16 +421,22 @@ class _CallScreenState extends SafeState<CallScreen> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
return GestureDetector(
onDoubleTap: () => _toggleMenuBarsVisibility(),
child: Scaffold(
appBar: _canHideMenuBar
? null
: AppBar(
leading: IconButton(
icon: Icon(Icons.arrow_back),
onPressed: () => _leaveCall(),
),
title:
_convName == null ? CircularProgressIndicator() : Text(_convName),
title: _convName == null
? CircularProgressIndicator()
: Text(_convName),
),
body: _buildBody(),
),
);
}
@ -437,9 +456,9 @@ class _CallScreenState extends SafeState<CallScreen> {
return Column(
children: <Widget>[
_buildMembersArea(),
_canHideMenuBar ? Container() : _buildMembersArea(),
_buildVideosArea(),
_buildFooterArea()
_canHideMenuBar ? Container() : _buildFooterArea()
],
);
}
@ -482,7 +501,8 @@ class _CallScreenState extends SafeState<CallScreen> {
? _buildLocalVideo()
: Container(),
],
));
),
);
}
Widget _buildMemberVideo(int peerID) {