myCustomPreJoinPage function

Widget myCustomPreJoinPage(
  1. {PreJoinPageOptions? options,
  2. required Credentials credentials}
)

A custom pre-join page widget that can be used instead of the default MediaSFU pre-join page.

This widget displays a personalized welcome message and includes a button to proceed to the chat session.

Note: Ensure this widget is passed to MediasfuChatOptions only when you intend to use a custom pre-join page.

Implementation

Widget myCustomPreJoinPage({
  PreJoinPageOptions? options,
  required Credentials credentials,
}) {
  return Scaffold(
    appBar: AppBar(
      title: const Text('Welcome to MediaSFU Chat'),
    ),
    body: Padding(
      padding: const EdgeInsets.all(16.0),
      child: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        children: [
          Text(
            'Hello, ${credentials.apiUserName}!',
            style: const TextStyle(fontSize: 24, fontWeight: FontWeight.bold),
          ),
          const SizedBox(height: 20),
          const Text(
            'Get ready to join your chat session.',
            style: TextStyle(fontSize: 18),
          ),
          const SizedBox(height: 40),
          ElevatedButton(
            onPressed: () {
              // Proceed to the session by updating the validation status
              if (options != null) {
                options.parameters.updateValidated(true);
              }
            },
            child: const Text('Join Now'),
          ),
        ],
      ),
    ),
  );
}