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