Skip to main content

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

  1. option (LMChatPollOptionViewData)
    The poll option data to be displayed.

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

  3. 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.

PropertyTypeDescriptionRequiredDefault
pollOptionTextStyleLMChatTextStyle?Text style for the poll optionNoDefault style
pollOptionSelectedCheckColorColor?Color for the selected option checkNoTheme color
votesCountStylesLMChatTextStyle?Text style for the vote countNoInherited

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),
),
),
);