1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-12-24 11:58:51 +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> {
double _left, _top;
var _fullScreen = false;
final _callScreenKey = GlobalKey();
@override
void didChangeDependencies() {
super.didChangeDependencies();
@ -40,6 +44,8 @@ class _CallWindowWidgetState extends State<CallWindowWidget> {
@override
Widget build(BuildContext context) {
if (_fullScreen) return _buildScreen();
return Positioned(
width: _WindowSize.width,
height: _WindowSize.height,
@ -47,24 +53,7 @@ class _CallWindowWidgetState extends State<CallWindowWidget> {
top: _top,
child: Draggable(
child: Card(
child: CallScreen(
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,
),
child: _buildScreen(),
),
feedback: Container(
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
void _moveEnd(DraggableDetails details) {
// Determine the limits of containing stack
@ -101,4 +119,6 @@ class _CallWindowWidgetState extends State<CallWindowWidget> {
setState(() {});
}
void _toggleFullScreen() => setState(() => _fullScreen = !_fullScreen);
}