1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2025-06-19 08:15:16 +00:00

Use custom app bar for call windows

This commit is contained in:
2020-05-10 15:00:26 +02:00
parent cf9f93dcb3
commit 476f08681b
3 changed files with 53 additions and 15 deletions

View File

@ -32,10 +32,15 @@ class CallScreen extends StatefulWidget {
/// This settings should be always true except for the small call window...
final bool floatingButtons;
/// Use custom application bar. This function takes as parameter a nullable
/// String which is the title of the conversation
final PreferredSizeWidget Function(String) buildCustomAppBar;
const CallScreen({
Key key,
@required this.convID,
this.floatingButtons = true,
this.buildCustomAppBar,
}) : assert(convID != null),
assert(convID > 0),
assert(floatingButtons != null),
@ -453,22 +458,26 @@ class _CallScreenState extends SafeState<CallScreen> {
return GestureDetector(
onDoubleTap: () => _toggleMenuBarsVisibility(),
child: Scaffold(
appBar: _canHideMenuBar
? null
: AppBar(
leading: IconButton(
icon: Icon(Icons.arrow_back),
onPressed: () => _leaveCall(),
),
title: _convName == null
? CircularProgressIndicator()
: Text(_convName),
),
appBar: _canHideMenuBar ? null : _buildAppBar(),
body: _buildBody(),
),
);
}
/// Build application bar
PreferredSizeWidget _buildAppBar() {
if (widget.buildCustomAppBar != null)
return widget.buildCustomAppBar(_convName);
return AppBar(
leading: IconButton(
icon: Icon(Icons.arrow_back),
onPressed: () => _leaveCall(),
),
title: _convName == null ? CircularProgressIndicator() : Text(_convName),
);
}
/// Build widget body
Widget _buildBody() {
// Handle errors