MessagesModal class

MessagesModal displays a modal interface for managing direct and group messages within an event. It provides separate tabs for viewing and sending direct or group messages, configurable based on the event type.

Parameters:

  • MessagesModalOptions options: Configuration for the modal, including:
    • isMessagesModalVisible: Whether the modal is visible.
    • onMessagesClose: Callback to close the modal.
    • onSendMessagePress: Function to handle sending a message.
    • messages: List of Message objects to display.
    • position: Modal position on the screen (e.g., 'topRight').
    • backgroundColor: Modal background color.
    • activeTabBackgroundColor: Background color for the active tab.
    • eventType, member, islevel: Event and user role information for filtering messages.
    • coHost, coHostResponsibility: Co-host settings and responsibilities.
    • directMessageDetails: Participant details for direct messages.
    • updateStartDirectMessage and updateDirectMessageDetails: Functions to manage direct messaging state.
    • socket: Socket instance for real-time updates.
    • showAlert: Optional callback for displaying alerts.

Key Functions:

  • _populateMessages: Populates lists for directMessages and groupMessages based on event type, user roles, and responsibilities.
  • _buildTabContent: Displays content in the active tab, showing either direct or group messages depending on the selected tab.
  • _handleSendButton: Validates and sends messages, clearing the input and updating the reply state as needed.

Example Usage:

MessagesModal(
  options: MessagesModalOptions(
    isMessagesModalVisible: true,
    onMessagesClose: () => print("Modal closed"),
    messages: messageList,
    eventType: EventType.chat,
    member: 'user123',
    islevel: '1',
    coHostResponsibility: [CoHostResponsibility(name: 'chat', value: true)],
    coHost: 'host123',
    startDirectMessage: false,
    directMessageDetails: null,
    updateStartDirectMessage: (value) => print("Direct message started: $value"),
    updateDirectMessageDetails: (participant) => print("Direct message to: ${participant?.name}"),
    roomName: 'MainRoom',
    socket: socketInstance,
    chatSetting: 'enabled',
    showAlert: (options) => print("Alert: ${options.message}"),
  ),
);
  • Header with Tabs: Contains tabs for switching between direct and group messaging, shown only in webinar or conference mode.
  • Tab Content: Displays a list of messages and input field, with different messages shown based on active tab.

Dependencies:

  • socket_io_client for real-time message handling.
  • MessagePanel component to display and manage messages within each tab.

This modal is particularly useful in events or group settings, where real-time messaging and role-based message visibility are important.

Inheritance

Constructors

MessagesModal({Key? key, required MessagesModalOptions 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 MessagesModalOptions
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() → _MessagesModalState
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