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