1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-22 21:09:21 +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, mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[ children: <Widget>[
// Toggle audio button // Toggle audio button
Expanded( _FooterButton(
child: IconButton(
icon: Icon(isStreamingAudio && !isAudioMuted
? Icons.mic
: Icons.mic_off),
onPressed: () => _toggleStreaming(false), onPressed: () => _toggleStreaming(false),
), icon: Icon(
isStreamingAudio && !isAudioMuted ? Icons.mic : Icons.mic_off),
), ),
// Hang up call // Hang up call
Expanded( _FooterButton(
child: IconButton(
icon: Icon(Icons.phone, color: Colors.red), icon: Icon(Icons.phone, color: Colors.red),
onPressed: () => _leaveCall(), onPressed: () => _leaveCall(),
), ),
),
// Toggle video button // Toggle video button
Expanded( _FooterButton(
child: IconButton(
icon: Icon(isStreamingVideo && !isVideoMuted icon: Icon(isStreamingVideo && !isVideoMuted
? Icons.videocam ? Icons.videocam
: Icons.videocam_off), : Icons.videocam_off),
onPressed: () => _toggleStreaming(true), 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(),
),
);
}
}