zego_uikit_signal_plugin 1.0.0 copy "zego_uikit_signal_plugin: ^1.0.0" to clipboard
zego_uikit_signal_plugin: ^1.0.0 copied to clipboard

discontinuedreplaced by: zego_uikit_signaling_plugin
outdated

ZegoUIKitSignalPlugin is a low-code plugin collection that provides the signal related function extensions for ZegoUIKit, which helps you to integarte features easier and faster.

example/lib/main.dart

// Dart imports:
import 'dart:math' as math;

// Flutter imports:
import 'package:flutter/material.dart';

// Package imports:
import 'package:zego_uikit_signal_plugin/zego_uikit_signal_plugin.dart';

/// Note that the userID needs to be globally unique,
final String localUserID = math.Random().nextInt(10000).toString();

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(home: HomePage());
  }
}

class HomePage extends StatefulWidget {
  const HomePage({
    Key? key,
  }) : super(key: key);

  @override
  State<HomePage> createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  TextEditingController inviteeUserIDTextCtrl = TextEditingController();

  @override
  Widget build(BuildContext context) {
    return ZegoUIKitPrebuiltCallWithInvitation(
      appID: /*input your AppID*/,
      appSign: /*input your AppSign*/,
      userID: localUserID,
      userName: "user_$localUserID",
      //  we will ask you for config when we need it, you can customize your app with data
      requireConfig: (ZegoCallInvitationData data) {
        var config = ZegoUIKitPrebuiltCallConfig();
        config.turnOnCameraWhenJoining =
            ZegoInvitationType.videoCall == data.type;
        if (ZegoInvitationType.videoCall == data.type) {
          config.bottomMenuBarConfig.extendButtons = [
            IconButton(color: Colors.white, icon: const Icon(Icons.phone), onPressed:() {}),
            IconButton(color: Colors.white, icon: const Icon(Icons.cookie), onPressed:() {}),
            IconButton(color: Colors.white, icon: const Icon(Icons.speaker), onPressed:() {}),
            IconButton(color: Colors.white, icon: const Icon(Icons.air), onPressed:() {}),
          ];
        }
        return config;
      },
      child: body(context),
    );
  }

  Widget body(BuildContext context) {
    return GestureDetector(
      onTap: () => FocusManager.instance.primaryFocus?.unfocus(),
      child: SafeArea(
        child: Scaffold(
          body: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              Text('Your User ID: $localUserID'),
              Row(
                mainAxisAlignment: MainAxisAlignment.center,
                children: [
                  inviteeUserIDInput(),
                  const SizedBox(width: 5),
                  callButton(false),
                  const SizedBox(width: 5),
                  callButton(true),
                ],
              ),
            ],
          ),
        ),
      ),
    );
  }

  Widget inviteeUserIDInput() => SizedBox(
    width: 200,
    child: TextFormField(
      controller: inviteeUserIDTextCtrl,
      decoration: const InputDecoration(
        isDense: true,
        hintText: "Please Enter Invitee User ID",
        labelText: "Invitee User ID",
      ),
    ),
  );

  Widget callButton(bool isVideoCall) =>
      ValueListenableBuilder<TextEditingValue>(
        valueListenable: inviteeUserIDTextCtrl,
        builder: (context, inviteeUserID, _) {
          return ZegoSendCallInvitationButton(
            isVideoCall: isVideoCall,
            invitees: [
              ZegoUIKitUser(
                id: inviteeUserIDTextCtrl.text,
                name: 'user_${inviteeUserIDTextCtrl.text}',
              )
            ],
            iconSize: const Size(30, 30),
            buttonSize: const Size(40, 40),
          );
        },
      );
}
2
likes
0
pub points
0%
popularity

Publisher

verified publisherzegocloud.com

ZegoUIKitSignalPlugin is a low-code plugin collection that provides the signal related function extensions for ZegoUIKit, which helps you to integarte features easier and faster.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

audioplayers, flutter, flutter_screenutil, flutter_vibrate, statemachine, zego_uikit, zego_uikit_prebuilt_call, zego_zim

More

Packages that depend on zego_uikit_signal_plugin