style property

TextStyle? style
final

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

This sample shows a DropdownButton with a dropdown button text style that is different than its menu items.

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

@override
Widget build(BuildContext context) {
  return Container(
    alignment: Alignment.center,
    color: Colors.blue,
    child: DropdownButton<String>(
      value: dropdownValue,
      style: TextStyle(color: Colors.blue),
    ),
  );
}

{@end-tool}

Defaults to the TextTheme.titleMedium value of the current ThemeData.textTheme of the current Theme.

Implementation

final TextStyle? style;