WelcomePage class

WelcomePage is a StatefulWidget that provides a welcome screen where users can enter details for an event, including event display name, token (secret), event ID, and event link. It includes options to validate input, handle socket connection, and provide feedback using alerts.

Main Parameters:

  • WelcomePageOptions options: Configures callbacks and behavior, including showing alerts, connecting to a socket, and updating state for the event information.
    • showAlert: Displays messages to the user, especially for errors and connection feedback.
    • updateIsLoadingModalVisible: Toggles a loading indicator during requests.
    • connectSocket: Establishes a socket connection using the provided options.
    • updateSocket, updateValidated, updateApiUserName, updateApiToken, updateLink, updateRoomName, updateMember: Callbacks for updating state in the parent widget.

Key Functions:

  • _handleConfirm: Validates the user input fields before initiating a connection request. If all inputs are valid, it calls _checkLimitsAndMakeRequest to handle the request.
  • _checkLimitsAndMakeRequest: Manages the connection request, checking for rate limits and attempting a socket connection if permitted. On successful connection, it updates the state, while unsuccessful attempts trigger an alert message.
  • _launchURL: Opens a specified URL in the browser, e.g., to obtain an event token.

Example Usage:

WelcomePage(
  options: WelcomePageOptions(
    showAlert: (message, type, duration) => print("Alert: $message"),
    updateIsLoadingModalVisible: (isVisible) => print("Loading: $isVisible"),
    connectSocket: myConnectSocketFunction,
    updateSocket: (socket) => print("Socket Updated"),
    updateValidated: (isValid) => print("Validated: $isValid"),
    updateApiUserName: (userName) => print("API UserName: $userName"),
    updateApiToken: (token) => print("API Token: $token"),
    updateLink: (link) => print("Link: $link"),
    updateRoomName: (roomName) => print("Room Name: $roomName"),
    updateMember: (member) => print("Member: $member"),
  ),
);

UI Elements:

  • Input Fields: Includes text fields for "Display Name," "Event Token," "Event ID," and "Event Link."
  • Confirm Button: Validates input and attempts a connection if details are valid.
  • Helper Links and QR Code Scanner: Additional options to obtain event details, including a link to get an event token from the mediasfu.com website.

Helper Functions:

  • _validateAlphanumeric: Checks if a string contains only alphanumeric characters.
  • requestPermissionCamera: Placeholder for camera permissions (e.g., for QR code scanning).

Note:

This implementation depends on an external showAlert function to notify users and relies on the connectSocket function to establish a socket connection.

Inheritance

Constructors

WelcomePage({Key? key, required WelcomePageOptions options})
const

Properties

hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
options WelcomePageOptions
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → _WelcomePageState
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited