Skip to main content

Single Select

The CometChatSingleSelect component is a customizable Single Select component that allows you to choose one option from a list of box-structured options.

While this design allows an intuitive interaction similar to radio buttons, its unique box-style presentation provides a distinctive user experience. If only two options are provided, they are displayed side-by-side. For more than two options, they are displayed vertically.

Attributes

PropertiesTypeDescription
themeCometChatThemeused to configure a customs theme for this widget.
decorationDecorationused to set decoration for the container.
optionBackgroundColorused to set the background of non selected options.
selectedOptionBackgroundColorused to set the background of selected options.
optionTextStyleTextStyleused to set text style for non selected options.
selectedOptionsTextStyleTextStyleused to set text style for selected options.
onChangedList<OptionElement>callback called when any option is selected.
optionsColorused to set options.
selectedValueStringused to set predefined set value.

Usage

CometChatSingleSelect(
options: [
OptionElement(value: "m", label: "Male"),
OptionElement(value: "f", label: "Female")
],
selectedOptionBackground: Colors.black,
onChanged: (String value) {
// TODO("Not yet implemented")
},
)