showCallingInvitationListSheet function

void showCallingInvitationListSheet(
  1. BuildContext context, {
  2. required List<ZegoCallUser> waitingSelectUsers,
  3. required void onPressed(
    1. List<ZegoCallUser> selectedUsers
    ),
  4. bool defaultChecked = true,
  5. List<ZegoCallUser> selectedUsers = const [],
  6. List<ZegoCallUser> userSort(
    1. List<ZegoCallUser>
    )?,
  7. bool rootNavigator = false,
  8. ButtonIcon? buttonIcon,
  9. Size? buttonIconSize,
  10. Size? buttonSize,
  11. ZegoAvatarBuilder? avatarBuilder,
  12. Color? userNameColor,
  13. Color? backgroundColor,
  14. String? popUpTitle,
  15. TextStyle? popUpTitleStyle,
  16. Widget? popUpBackIcon,
  17. Widget? inviteButtonIcon,
})

Display a call invitation list pop-up.

Assign members to be invited to waitingSelectUsers, and assign members who are already invited or in a call to selectedUsers.

If you need to default select members to be invited, you can set defaultChecked to true. If sorting is needed, you can set userSort. In the onPressed callback, send a call invitation.

Implementation

void showCallingInvitationListSheet(
  BuildContext context, {
  /// Members waiting to be selected (not in a call, not invited)
  required List<ZegoCallUser> waitingSelectUsers,

  /// Callback after clicking the invite button, initiate invitation here (invite not in call, or invite in call)
  required void Function(List<ZegoCallUser> selectedUsers) onPressed,

  /// Whether to default select waiting members
  bool defaultChecked = true,

  /// Selected members (in a call or invited)
  List<ZegoCallUser> selectedUsers = const [],

  /// Member list sorting
  List<ZegoCallUser> Function(List<ZegoCallUser>)? userSort,
  bool rootNavigator = false,
  ButtonIcon? buttonIcon,
  Size? buttonIconSize,
  Size? buttonSize,
  ZegoAvatarBuilder? avatarBuilder,
  Color? userNameColor,
  Color? backgroundColor,

  /// default is 'Invitees'
  String? popUpTitle,
  TextStyle? popUpTitleStyle,
  Widget? popUpBackIcon,

  /// default is 'Invite'
  Widget? inviteButtonIcon,
}) {
  showModalBottomSheet(
    context: context,
    barrierColor: ZegoUIKitDefaultTheme.viewBarrierColor,
    backgroundColor: backgroundColor ??
        ZegoUIKitDefaultTheme.viewBackgroundColor.withOpacity(0.6),
    shape: const RoundedRectangleBorder(
      borderRadius: BorderRadius.only(
        topLeft: Radius.circular(32.0),
        topRight: Radius.circular(32.0),
      ),
    ),
    isDismissible: true,
    isScrollControlled: true,
    builder: (BuildContext context) {
      return FractionallySizedBox(
        heightFactor: 0.75,
        child: AnimatedPadding(
          padding: MediaQuery.of(context).viewInsets,
          duration: const Duration(milliseconds: 50),
          child: ZegoSendCallingInvitationList(
            waitingSelectUsers: waitingSelectUsers,
            selectedUsers: selectedUsers,
            userSort: userSort,
            onPressed: onPressed,
            buttonIcon: buttonIcon,
            popUpTitle: popUpTitle,
            popUpTitleStyle: popUpTitleStyle,
            buttonIconSize: buttonIconSize,
            buttonSize: buttonSize,
            avatarBuilder: avatarBuilder,
            userNameColor: userNameColor,
            popUpBackIcon: popUpBackIcon,
            inviteButtonIcon: inviteButtonIcon,
            defaultChecked: defaultChecked,
          ),
        ),
      );
    },
  );
}