Skip to main content
CometChatOutgoingCall manages the outgoing call process. It displays recipient information (avatar, name) and call status, and automatically transitions to the ongoing call screen when the receiver accepts.

Where It Fits

CometChatOutgoingCall is typically launched automatically by CometChatCallButtons when a call is initiated. It can also be launched manually for custom call flows.

Quick Start

Automatic (via CallButtons)

When using CometChatCallButtons, the outgoing call screen is launched automatically when the user taps a call button. No manual integration needed.

Manual Launch

For custom call flows:
Navigator.push(context, MaterialPageRoute(
  builder: (context) => CometChatOutgoingCall(
    user: user,
    call: callObject,
  ),
));
import 'package:cometchat_chat_uikit/cometchat_calls_uikit.dart';
import 'package:flutter/material.dart';

class OutgoingCallExample extends StatefulWidget {
  const OutgoingCallExample({super.key});

  @override
  State<OutgoingCallExample> createState() => _OutgoingCallExampleState();
}

class _OutgoingCallExampleState extends State<OutgoingCallExample> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: SafeArea(
        child: CometChatOutgoingCall(
          user: user,
          call: callObject,
        ),
      ),
    );
  }
}
Prerequisites: CometChat SDK initialized, enableCalls = true set in UIKitSettings. See Call Features for setup.

Actions and Events

Callback Methods

onCancelled

Fires when the user cancels the outgoing call. Override to customize cancel behavior.
CometChatOutgoingCall(
  user: user,
  call: callObject,
  onCancelled: (BuildContext context, Call call) {
    // Custom cancel logic
  },
)

onError

Fires on internal errors.
CometChatOutgoingCall(
  user: user,
  call: callObject,
  onError: (e) {
    debugPrint("Error: ${e.message}");
  },
)

Global Events

The component emits events via CometChatCallEvents:
EventDescription
ccCallAcceptedTriggers when the outgoing call is accepted
ccCallRejectedTriggers when the outgoing call is rejected
class _YourScreenState extends State<YourScreen> with CometChatCallEventListener {
  @override
  void initState() {
    super.initState();
    CometChatCallEvents.addCallEventsListener("unique_listener_ID", this);
  }

  @override
  void dispose() {
    super.dispose();
    CometChatCallEvents.removeCallEventsListener("unique_listener_ID");
  }

  @override
  void ccCallAccepted(Call call) {
    debugPrint("Call accepted: ${call.sessionId}");
  }

  @override
  void ccCallRejected(Call call) {
    debugPrint("Call rejected: ${call.sessionId}");
  }

  @override
  Widget build(BuildContext context) {
    return const Placeholder();
  }
}

Functionality

PropertyTypeDefaultDescription
userUser?nullRecipient user object
callCallrequiredCall object with session details
callSettingsBuilderCallSettingsBuilder?nullConfigure call settings
heightdouble?nullWidget height
widthdouble?nullWidget width
declineButtonIconWidget?nullCustom decline/cancel button icon
declineButtonTextString?nullCustom decline button text
disableSoundForCallsbool?falseDisable outgoing call sound
customSoundForCallsString?nullCustom sound asset path
Example — custom decline text and disabled sound:
CometChatOutgoingCall(
  user: user,
  call: callObject,
  disableSoundForCalls: true,
  declineButtonText: "Cancel Call",
)
Image Image

Custom View Slots

Avatar View

Replace the recipient’s avatar.
CometChatOutgoingCall(
  user: user,
  call: callObject,
  avatarView: (context, call) {
    return CircleAvatar(
      radius: 50,
      backgroundImage: NetworkImage(user?.avatar ?? ""),
    );
  },
)

Title View

Replace the recipient’s name / call status text.
CometChatOutgoingCall(
  user: user,
  call: callObject,
  titleView: (context, call) {
    return Text(
      call.receiver?.name ?? "Unknown",
      style: TextStyle(fontSize: 22, fontWeight: FontWeight.bold, color: Colors.white),
    );
  },
)

Subtitle View

Replace the subtitle (e.g., “Calling…”).
CometChatOutgoingCall(
  user: user,
  call: callObject,
  subtitleView: (context, call) {
    return Text(
      "Ringing...",
      style: TextStyle(fontSize: 14, color: Colors.white70),
    );
  },
)

Cancelled View

Replace the cancel/end call button.
CometChatOutgoingCall(
  user: user,
  call: callObject,
  cancelledView: (context, call) {
    return ElevatedButton.icon(
      onPressed: () {
        // Cancel call
      },
      icon: Icon(Icons.call_end),
      label: Text("End Call"),
      style: ElevatedButton.styleFrom(backgroundColor: Colors.red),
    );
  },
)

Style

CometChatOutgoingCall(
  user: user,
  call: callObject,
  outgoingCallStyle: CometChatOutgoingCallStyle(
    avatarStyle: CometChatAvatarStyle(
      backgroundColor: Color(0xFFFBAA75),
      borderRadius: BorderRadius.circular(8),
    ),
    declineButtonColor: Color(0xFFF44649),
    declineButtonBorderRadius: BorderRadius.circular(12),
  ),
)

Style Properties

PropertyDescription
avatarStyleRecipient avatar appearance
declineButtonColorCancel button background color
declineButtonBorderRadiusCancel button corner radius
backgroundColorScreen background color

Key V6 Differences

AspectV5V6
SubtitleStatic String?Dynamic subtitleView: Widget? Function(BuildContext, Call)?
Decline callbackonDeclineRenamed to onCancelled
Decline iconURL-based String?Widget-based declineButtonIcon: Widget?
State managementGetX controllerBLoC (OutgoingCallBloc)
Removedtheme, avatarStyle, cardStyle, buttonStyle, ongoingCallConfigurationIntegrated into main style

Next Steps

Incoming Call

Handle incoming calls

Call Buttons

Add voice and video call buttons

Call Features

Complete calling setup

Component Styling

Detailed styling reference