Skip to main content

Overview

The CometChatCallButtons widget provides users with the ability to make calls, access call-related functionalities, and control call settings.

Usage

Integration

import 'package:cometchat_chat_uikit/cometchat_calls_uikit.dart';
import 'package:flutter/material.dart';

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

  @override
  State<CallButtonsExample> createState() => _CallButtonsExampleState();
}

class _CallButtonsExampleState extends State<CallButtonsExample> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: SafeArea(
        child: Center(child: CometChatCallButtons()),
      ),
    );
  }
}

Actions

onError
CometChatCallButtons(
  onError: (e) {
    // Handle error
  },
)

Events

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) {
    // Handle call accepted
  }

  @override
  void ccCallRejected(Call call) {
    // Handle call rejected
  }
}

Customization

Style

CometChatCallButtons(
  callButtonsStyle: CometChatCallButtonsStyle(
    voiceCallIconColor: Color(0xFF6852D6),
    videoCallIconColor: Color(0xFF6852D6),
    voiceCallButtonColor: Color(0xFFEDEAFA),
    videoCallButtonColor: Color(0xFFEDEAFA),
    voiceCallButtonBorderRadius: BorderRadius.circular(12.5),
    videoCallButtonBorderRadius: BorderRadius.circular(12.5),
  ),
)

Functionality

PropertyDescriptionCode
UserSet User objectuser: User?
GroupSet Group objectgroup: Group?
CallSettingsBuilderConfigure call settingscallSettingsBuilder: CallSettingsBuilder?
Hide Video CallHide video call buttonhideVideoCallButton: bool?
Hide Voice CallHide voice call buttonhideVoiceCallButton: bool?
Video Call IconCustom video call iconvideoCallIcon: Icon?
Voice Call IconCustom voice call iconvoiceCallIcon: Icon?
Outgoing Call ConfigurationConfigure outgoing calloutgoingCallConfiguration: CometChatOutgoingCallConfiguration?