SocritsCallUI class
Zero-glue call orchestration for the Socrits UIKit — the ZEGO
ZegoUIKitPrebuiltCallInvitationService equivalent.
Wire it up ONCE after you connect, and incoming calls automatically ring (prebuilt UI), navigate to the call screen on accept, and tear down on hang-up / decline / timeout. Starting a call is one method (or the SocritsCallButton widget).
Everything visual is customised through SocritsCallConfig — theme, ringtone, avatars, overlays, which buttons show, and full-screen overrides.
final nav = GlobalKey<NavigatorState>();
MaterialApp(navigatorKey: nav, home: ...);
final socrits = Socrits(baseUrl: 'https://api.socrits.com');
await socrits.connect(userToken: myUserToken); // or sessionEndpoint
SocritsCallUI.instance.attach(
client: socrits, navigatorKey: nav, selfName: 'Alice',
config: SocritsCallConfig(
theme: const SocritsCallTheme(accent: Color(0xFFCC529F)),
ringtone: const SocritsRingtone.asset('assets/ring.mp3'),
avatarUrlResolver: (uid) => directory[uid]?.photo,
),
);
// start a call from anywhere (avatarUrl is optional):
SocritsCallUI.instance.call(userId: 'bob', displayName: 'Bob',
avatarUrl: bob.photo, mode: CallMode.video);
// …or drop a button: SocritsCallButton(inviteeUserId: 'bob', inviteeName: 'Bob')
Properties
- config → SocritsCallConfig
-
The active customisation config.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- inCall → bool
-
Whether a ring or call is currently on screen.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
attach(
{required Socrits client, String selfName = 'You', SocritsCallConfig? config, Color accent = const Color(0xFF7C5CFC), bool enableOfflinePush = true}) → void -
Wire the client's call lifecycle into the prebuilt UI. Call once, after
Socrits.connect, with the same
navigatorKeyyou gave yourMaterialApp. -
call(
{required String userId, String? displayName, String? avatarUrl, CallMode mode = CallMode.video, Map< String, dynamic> ? data, String? room}) → Future<void> -
Place a call — shows the outgoing ring UI, then connects when answered.
avatarUrl(optional) is shown on the ring/call screens and forwarded to the callee (in the calldata) so their ring shows your photo too.room(optional) joins a room id of your own instead of a generated one — see Socrits.invite. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- instance → SocritsCallUI
-
Shared instance — attach once, use everywhere.
final