From 8609e4e16972a32f3c272cf19dbf740ad4275e18 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Tue, 21 Apr 2020 18:20:24 +0200 Subject: [PATCH] Can interrupt local streaming --- lib/ui/screens/call_screen.dart | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/lib/ui/screens/call_screen.dart b/lib/ui/screens/call_screen.dart index a19a894..3adbd53 100644 --- a/lib/ui/screens/call_screen.dart +++ b/lib/ui/screens/call_screen.dart @@ -20,6 +20,8 @@ import 'package:flutter_webrtc/webrtc.dart'; /// /// @author Pierre Hubert +enum _PopupMenuOption { STOP_STREAMING } + class CallScreen extends StatefulWidget { final int convID; @@ -345,6 +347,15 @@ class _CallScreenState extends SafeState { }); } + /// Handles menu selection + void _handleSelectedMenuOption(_PopupMenuOption option) { + switch (option) { + case _PopupMenuOption.STOP_STREAMING: + _stopStreaming(); + break; + } + } + @override Widget build(BuildContext context) { return Scaffold( @@ -473,6 +484,20 @@ class _CallScreenState extends SafeState { : Icons.videocam_off), onPressed: () => _toggleStreaming(true), ), + + // Interrupt local streaming + Expanded( + child: PopupMenuButton<_PopupMenuOption>( + itemBuilder: (c) => [ + // Interrupt streaming + PopupMenuItem( + child: Text(tr("Stop streaming")), + value: _PopupMenuOption.STOP_STREAMING) + ], + icon: Icon(Icons.menu), + onSelected: (d) => _handleSelectedMenuOption(d), + ), + ) ], ), );