mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-22 12:59:21 +00:00
Can toggle menubars
This commit is contained in:
parent
d083728251
commit
a74600ce4b
@ -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(
|
||||
leading: IconButton(
|
||||
icon: Icon(Icons.arrow_back),
|
||||
onPressed: () => _leaveCall(),
|
||||
),
|
||||
title:
|
||||
_convName == null ? CircularProgressIndicator() : Text(_convName),
|
||||
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),
|
||||
),
|
||||
body: _buildBody(),
|
||||
),
|
||||
body: _buildBody(),
|
||||
);
|
||||
}
|
||||
|
||||
@ -437,9 +456,9 @@ class _CallScreenState extends SafeState<CallScreen> {
|
||||
|
||||
return Column(
|
||||
children: <Widget>[
|
||||
_buildMembersArea(),
|
||||
_canHideMenuBar ? Container() : _buildMembersArea(),
|
||||
_buildVideosArea(),
|
||||
_buildFooterArea()
|
||||
_canHideMenuBar ? Container() : _buildFooterArea()
|
||||
],
|
||||
);
|
||||
}
|
||||
@ -466,23 +485,24 @@ class _CallScreenState extends SafeState<CallScreen> {
|
||||
/// Videos area
|
||||
Widget _buildVideosArea() {
|
||||
return Expanded(
|
||||
child: Stack(
|
||||
fit: StackFit.expand,
|
||||
children: [
|
||||
// Remove peers videos
|
||||
Column(
|
||||
children: _membersList.readyPeers
|
||||
.where((f) => _renderers.containsKey(f.userID))
|
||||
.map((f) => _buildMemberVideo(f.userID))
|
||||
.toList(),
|
||||
),
|
||||
child: Stack(
|
||||
fit: StackFit.expand,
|
||||
children: [
|
||||
// Remove peers videos
|
||||
Column(
|
||||
children: _membersList.readyPeers
|
||||
.where((f) => _renderers.containsKey(f.userID))
|
||||
.map((f) => _buildMemberVideo(f.userID))
|
||||
.toList(),
|
||||
),
|
||||
|
||||
// Local peer video
|
||||
isStreamingVideo && _isLocalStreamVisible
|
||||
? _buildLocalVideo()
|
||||
: Container(),
|
||||
],
|
||||
));
|
||||
// Local peer video
|
||||
isStreamingVideo && _isLocalStreamVisible
|
||||
? _buildLocalVideo()
|
||||
: Container(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildMemberVideo(int peerID) {
|
||||
|
Loading…
Reference in New Issue
Block a user