RequestsModal class

RequestsModal displays a modal window containing a list of requests and provides search and filter functionality. The modal allows users to accept or reject each request using real-time actions through a socket connection.

Parameters:

  • options (RequestsModalOptions): A configuration object with properties:
    • isRequestsModalVisible (bool): Controls modal visibility.
    • onRequestClose (VoidCallback): Closes the modal.
    • requestCounter (int): Count of active requests, displayed in the header.
    • onRequestFilterChange (Function): Updates the filter query for the request list.
    • requestList (List): List of current requests to display.
    • onRequestItemPress (RespondToRequestsType): Callback for handling request item actions.
    • updateRequestList (Function): Updates the list of requests.
    • roomName (String): Name of the room associated with the requests.
    • socket (io.Socket): Socket instance for emitting responses.
    • backgroundColor (Color): Background color of the modal.
    • position (String): Controls the modal position on the screen (e.g., 'topRight').
    • parameters (RequestsModalParameters): Additional parameters.
    • renderRequestComponent (RenderRequestComponentType): Function to render each request item.

Example:

RequestsModal(
  options: RequestsModalOptions(
    isRequestsModalVisible: true,
    onRequestClose: () => print('Modal closed'),
    requestCounter: 5,
    onRequestFilterChange: (query) => print('Filtering requests with: $query'),
    requestList: [Request(id: '1', name: 'John', icon: 'fa-microphone')],
    updateRequestList: (newList) => setState(() => requests = newList),
    roomName: 'MainRoom',
    socket: socket,
    position: 'topRight',
    parameters: {},
  ),
);

Workflow:

  1. Visibility: The isRequestsModalVisible controls whether the modal is shown.
  2. Filtering: Text input filters requests via onRequestFilterChange.
  3. Request List: Each request is rendered using renderRequestComponent, which supports custom UI.
Inheritance

Constructors

RequestsModal({Key? key, required RequestsModalOptions 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 RequestsModalOptions
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

build(BuildContext context) Widget
Describes the part of the user interface represented by this widget.
override
createElement() StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
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