1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-12-26 04:48:51 +00:00

Create Footer button widget

This commit is contained in:
Pierre HUBERT 2020-04-21 18:08:01 +02:00
parent de1dceae9b
commit 6a9e0e36c1

View File

@ -436,34 +436,50 @@ class _CallScreenState extends SafeState<CallScreen> {
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
// Toggle audio button
Expanded(
child: IconButton(
icon: Icon(isStreamingAudio && !isAudioMuted
? Icons.mic
: Icons.mic_off),
onPressed: () => _toggleStreaming(false),
),
_FooterButton(
onPressed: () => _toggleStreaming(false),
icon: Icon(
isStreamingAudio && !isAudioMuted ? Icons.mic : Icons.mic_off),
),
// Hang up call
Expanded(
child: IconButton(
icon: Icon(Icons.phone, color: Colors.red),
onPressed: () => _leaveCall(),
),
_FooterButton(
icon: Icon(Icons.phone, color: Colors.red),
onPressed: () => _leaveCall(),
),
// Toggle video button
Expanded(
child: IconButton(
icon: Icon(isStreamingVideo && !isVideoMuted
? Icons.videocam
: Icons.videocam_off),
onPressed: () => _toggleStreaming(true),
),
_FooterButton(
icon: Icon(isStreamingVideo && !isVideoMuted
? Icons.videocam
: Icons.videocam_off),
onPressed: () => _toggleStreaming(true),
),
],
),
);
}
}
class _FooterButton extends StatelessWidget {
final Function() onPressed;
final Widget icon;
const _FooterButton({
Key key,
@required this.onPressed,
@required this.icon,
}) : assert(onPressed != null),
assert(icon != null),
super(key: key);
@override
Widget build(BuildContext context) {
return Expanded(
child: IconButton(
icon: icon,
onPressed: () => onPressed(),
),
);
}
}