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
pollData
(LMChatConversationViewData
)
The data associated with the poll.isVoteEditing
(bool
)
Indicates whether the poll is in editing mode.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.
Property | Type | Description | Required | Default |
---|---|---|---|---|
pollOptionStyle | LMChatPollOptionStyle? | Style for individual poll options | No | Inherited theme |
submitButtonStyle | LMChatButtonStyle? | Style for the submit button | No | None |
editButtonStyle | LMChatButtonStyle? | Style for the edit button | No | None |
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,
),
),
);