Skip to content

Commit 123671c

Browse files
Maor Meir HajajNash0x7E2
authored andcommitted
Add to StreamOutgoingCallContent optional widget as background
Fixes #573
1 parent 34f2185 commit 123671c

File tree

1 file changed

+25
-4
lines changed

1 file changed

+25
-4
lines changed

packages/stream_video_flutter/lib/src/call_screen/outgoing_call/outgoing_call_content.dart

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ import '../common/calling_participants.dart';
77
import '../common/participant_avatars.dart';
88
import 'outgoing_call_controls.dart';
99

10+
typedef OutgoingCallBackground = Widget Function(
11+
Call call,
12+
CallState callState,
13+
List<UserInfo> participants,
14+
Widget child,
15+
);
16+
1017
/// Represents the Outgoing Call state and UI, when the user is calling
1118
/// other people.
1219
class StreamOutgoingCallContent extends StatefulWidget {
@@ -15,6 +22,7 @@ class StreamOutgoingCallContent extends StatefulWidget {
1522
super.key,
1623
required this.call,
1724
required this.callState,
25+
this.backgroundWidget,
1826
this.onCancelCallTap,
1927
this.onMicrophoneTap,
2028
this.onCameraTap,
@@ -63,6 +71,11 @@ class StreamOutgoingCallContent extends StatefulWidget {
6371
/// Builder used to create a custom widget for participants display names.
6472
final ParticipantsDisplayNameBuilder? participantsDisplayNameBuilder;
6573

74+
/// A widget that is placed behind the outgoing call UI instead of the default
75+
///
76+
/// background. Preferably use a [Stack] widget, like in the default [CallBackground].
77+
final OutgoingCallBackground? backgroundWidget;
78+
6679
@override
6780
State<StreamOutgoingCallContent> createState() =>
6881
_StreamOutgoingCallContentState();
@@ -90,9 +103,7 @@ class _StreamOutgoingCallContentState extends State<StreamOutgoingCallContent> {
90103
final participants =
91104
widget.callState.otherParticipants.map((e) => e.toUserInfo()).toList();
92105

93-
return CallBackground(
94-
participants: participants,
95-
child: Material(
106+
final child = Material(
96107
color: Colors.transparent,
97108
child: Column(
98109
mainAxisAlignment: MainAxisAlignment.center,
@@ -139,7 +150,17 @@ class _StreamOutgoingCallContentState extends State<StreamOutgoingCallContent> {
139150
),
140151
],
141152
),
142-
),
153+
);
154+
155+
return widget.backgroundWidget?.call(
156+
widget.call,
157+
widget.callState,
158+
participants,
159+
child,
160+
) ??
161+
CallBackground(
162+
participants: participants,
163+
child: child,
143164
);
144165
}
145166

0 commit comments

Comments
 (0)