style property

TextStyle? style
final

The text style to use for text in the combo box button and the combo box menu that appears when you tap the button.

To use a separate text style for selected item when it's displayed within the combo box button, consider using selectedItemBuilder.

This sample shows a ComboBox with a combo box button text style that is different than its menu items.

List<String> options = <String>['One', 'Two', 'Free', 'Four'];
String comboboxValue = 'One';

@override
Widget build(BuildContext context) {
  return Container(
    alignment: AlignmentDirectional.center,
    color: Colors.blue,
    child: ComboBox<String>(
      value: comboboxValue,
      onChanged: (String? newValue) {
        setState(() {
          comboboxValue = newValue!;
        });
      },
      style: TextStyle(color: Colors.blue),
      selectedItemBuilder: (BuildContext context) {
        return options.map((String value) {
          return Text(
            comboboxValue,
            style: TextStyle(color: Colors.white),
          );
        }).toList();
      },
      items: options.map<ComboBoxItem<String>>((String value) {
        return ComboBoxItem<String>(
          value: value,
          child: Text(value),
        );
      }).toList(),
    ),
  );
}

Defaults to the Typography.body value of the closest FluentThemeData

Implementation

final TextStyle? style;