1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2025-02-16 21:52:38 +00:00

Can toggle fullscreen on calls

This commit is contained in:
Pierre HUBERT 2020-05-10 15:21:01 +02:00
parent 6bdaf83563
commit a53ae381dc

View File

@ -29,6 +29,10 @@ class CallWindowWidget extends StatefulWidget {
class _CallWindowWidgetState extends State<CallWindowWidget> { class _CallWindowWidgetState extends State<CallWindowWidget> {
double _left, _top; double _left, _top;
var _fullScreen = false;
final _callScreenKey = GlobalKey();
@override @override
void didChangeDependencies() { void didChangeDependencies() {
super.didChangeDependencies(); super.didChangeDependencies();
@ -40,6 +44,8 @@ class _CallWindowWidgetState extends State<CallWindowWidget> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
if (_fullScreen) return _buildScreen();
return Positioned( return Positioned(
width: _WindowSize.width, width: _WindowSize.width,
height: _WindowSize.height, height: _WindowSize.height,
@ -47,24 +53,7 @@ class _CallWindowWidgetState extends State<CallWindowWidget> {
top: _top, top: _top,
child: Draggable( child: Draggable(
child: Card( child: Card(
child: CallScreen( child: _buildScreen(),
buildCustomAppBar: (convName) => AppBarWrapper(
height: 30,
appBar: AppBar(
backgroundColor: Colors.black,
title: Text(convName == null ? tr("Loading...") : convName),
actions: <Widget>[
IconButton(
iconSize: 16,
icon: Icon(Icons.close),
onPressed: widget.onClose,
)
],
)),
convID: widget.convID,
floatingButtons: false,
onClose: widget.onClose,
),
), ),
feedback: Container( feedback: Container(
width: _WindowSize.width, width: _WindowSize.width,
@ -76,6 +65,35 @@ class _CallWindowWidgetState extends State<CallWindowWidget> {
); );
} }
Widget _buildScreen() => CallScreen(
key: _callScreenKey,
buildCustomAppBar: (convName) => AppBarWrapper(
height: 30,
appBar: AppBar(
backgroundColor: Colors.black,
title: Text(convName == null ? tr("Loading...") : convName),
actions: <Widget>[
// Go full screen
IconButton(
iconSize: 16,
icon: Icon(
_fullScreen ? Icons.fullscreen_exit : Icons.fullscreen),
onPressed: _toggleFullScreen,
),
// Close call
IconButton(
iconSize: 16,
icon: Icon(Icons.close),
onPressed: widget.onClose,
)
],
)),
convID: widget.convID,
floatingButtons: _fullScreen,
onClose: widget.onClose,
);
/// Compute new window position /// Compute new window position
void _moveEnd(DraggableDetails details) { void _moveEnd(DraggableDetails details) {
// Determine the limits of containing stack // Determine the limits of containing stack
@ -101,4 +119,6 @@ class _CallWindowWidgetState extends State<CallWindowWidget> {
setState(() {}); setState(() {});
} }
void _toggleFullScreen() => setState(() => _fullScreen = !_fullScreen);
} }