Skip to main content

LMChatPoll

File location
poll.dart

LMChatPoll is responsible for creating interactive poll UI, which have poll question, options, submit vote button and vote count.

Properties

  1. pollData (LMChatConversationViewData)
    The data associated with the poll.

  2. isVoteEditing (bool)
    Indicates whether the poll is in editing mode.

  3. onOptionSelect (void Function(LMChatPollOptionViewData)?)
    Callback triggered when an option is selected.

Note: These properties are only a subset. More can be found inside the widget class.


Styling

LMChatPollStyle

File location
poll.dart

LMChatPollStyle defines the visual presentation of the poll, including option styles, buttons, and text formatting.

PropertyTypeDescriptionRequiredDefault
pollOptionStyleLMChatPollOptionStyle?Style for individual poll optionsNoInherited theme
submitButtonStyleLMChatButtonStyle?Style for the submit buttonNoNone
editButtonStyleLMChatButtonStyle?Style for the edit buttonNoNone

Note: These properties are only a subset. More can be found inside the style class.


Example Usage

final pollWidget = LMChatPoll(
pollData: conversationData,
isVoteEditing: false,
onOptionSelect: (option) => print('Option selected: ${option.id}'),
style: LMChatPollStyle(
pollOptionStyle: LMChatPollOptionStyle(
borderRadius: BorderRadius.circular(8.0),
),
submitButtonStyle: LMChatButtonStyle(
backgroundColor: Colors.blue,
),
),
);