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

Improve buttons bar

This commit is contained in:
Pierre HUBERT 2020-04-23 13:36:30 +02:00
parent 707577f9ac
commit d94b535001

View File

@ -468,8 +468,7 @@ class _CallScreenState extends SafeState<CallScreen> {
return Column( return Column(
children: <Widget>[ children: <Widget>[
_canHideMenuBar ? Container() : _buildMembersArea(), _canHideMenuBar ? Container() : _buildMembersArea(),
_buildVideosArea(), _buildVideosArea()
_canHideMenuBar ? Container() : _buildFooterArea()
], ],
); );
} }
@ -512,6 +511,9 @@ class _CallScreenState extends SafeState<CallScreen> {
isStreamingVideo && _isLocalStreamVisible isStreamingVideo && _isLocalStreamVisible
? _buildLocalVideo() ? _buildLocalVideo()
: Container(), : Container(),
// Buttons bar
_canHideMenuBar ? Container() : _buildFooterArea()
], ],
), ),
); );
@ -527,16 +529,19 @@ class _CallScreenState extends SafeState<CallScreen> {
height: 50, height: 50,
width: 50, width: 50,
right: 10, right: 10,
bottom: 10, bottom: (_canHideMenuBar ? 10 : 80),
); );
} }
/// Footer area /// Footer area
Widget _buildFooterArea() { Widget _buildFooterArea() {
return Material( return Positioned(
color: Colors.black, bottom: 10,
right: 0,
left: 0,
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[ children: <Widget>[
// Show / hide user video button // Show / hide user video button
_FooterButton( _FooterButton(
@ -556,6 +561,7 @@ class _CallScreenState extends SafeState<CallScreen> {
// Hang up call // Hang up call
_FooterButton( _FooterButton(
width: 60,
icon: Icon(Icons.phone, color: Colors.red), icon: Icon(Icons.phone, color: Colors.red),
onPressed: () => _leaveCall(), onPressed: () => _leaveCall(),
), ),
@ -570,8 +576,8 @@ class _CallScreenState extends SafeState<CallScreen> {
), ),
// Interrupt local streaming // Interrupt local streaming
Expanded( PopupMenuButton<_PopupMenuOption>(
child: PopupMenuButton<_PopupMenuOption>( offset: Offset(0, -110),
itemBuilder: (c) => [ itemBuilder: (c) => [
// Switch camera // Switch camera
PopupMenuItem( PopupMenuItem(
@ -584,9 +590,8 @@ class _CallScreenState extends SafeState<CallScreen> {
child: Text(tr("Stop streaming")), child: Text(tr("Stop streaming")),
value: _PopupMenuOption.STOP_STREAMING) value: _PopupMenuOption.STOP_STREAMING)
], ],
icon: Icon(Icons.menu), child: _FooterButton(icon: Icon(Icons.menu), onPressed: null),
onSelected: (d) => _handleSelectedMenuOption(d), onSelected: (d) => _handleSelectedMenuOption(d),
),
) )
], ],
), ),
@ -598,24 +603,31 @@ class _FooterButton extends StatelessWidget {
final Function() onPressed; final Function() onPressed;
final Widget icon; final Widget icon;
final bool visible; final bool visible;
final double width;
const _FooterButton({ const _FooterButton({
Key key, Key key,
@required this.icon, @required this.icon,
@required this.onPressed, @required this.onPressed,
this.visible = true, this.visible = true,
}) : assert(onPressed != null), this.width = 35,
assert(icon != null), }) : assert(icon != null),
assert(visible != null), assert(visible != null),
super(key: key); super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
if (!visible) return Container(); if (!visible) return Container();
return Expanded( return Padding(
child: IconButton( padding: const EdgeInsets.only(left: 8, right: 8),
icon: icon, child: Container(
onPressed: () => onPressed(), width: width,
child: FloatingActionButton(
child: icon,
foregroundColor: Colors.white,
onPressed: onPressed == null ? null : () => onPressed(),
backgroundColor: Colors.black,
),
), ),
); );
} }