LMChatPollOption
File location
poll_option.dart
LMChatPollOption
renders individual options for a poll in the chat interface. It supports custom callbacks, builders, and styles for option text and icons.
Properties
option
(LMChatPollOptionViewData
)
The poll option data to be displayed.onOptionSelect
(void Function(LMChatPollOptionViewData)?
)
Callback triggered when an option is selected.style
(LMChatPollOptionStyle?
)
Customizes the appearance of the poll option.
Note: These properties are only a subset. More can be found inside the widget class.
Styling
LMChatPollOptionStyle
File location
poll_option.dart
LMChatPollOptionStyle
defines the appearance of individual poll options, including borders, colors, and text styles.
Property | Type | Description | Required | Default |
---|---|---|---|---|
pollOptionTextStyle | LMChatTextStyle? | Text style for the poll option | No | Default style |
pollOptionSelectedCheckColor | Color? | Color for the selected option check | No | Theme color |
votesCountStyles | LMChatTextStyle? | Text style for the vote count | No | Inherited |
Note: These properties are only a subset. More can be found inside the style class.
Example Usage
final pollOption = LMChatPollOption(
option: pollOptionData,
onOptionSelect: (option) => print('Option selected: ${option.text}'),
style: LMChatPollOptionStyle(
pollOptionTextStyle: LMChatTextStyle(
textStyle: TextStyle(fontSize: 16, fontWeight: FontWeight.w400),
),
pollOptionSelectedCheckColor: Colors.green,
votesCountStyles: LMChatTextStyle(
textStyle: TextStyle(fontSize: 12, color: Colors.grey),
),
),
);