Skip to main content
The Stac DropdownMenu allows you to build a Flutter DropdownMenu widget using JSON. To know more about the DropdownMenu widget in Flutter, refer to the official documentation.

Properties

PropertyTypeDescription
dropdownMenuEntriesList<StacDropdownMenuEntries>The entries to display in the dropdown menu.
initialSelectiondynamicThe initial selection value.
enabledboolWhether the dropdown menu is enabled. Defaults to true.
labelStacWidgetThe label to display for the dropdown menu.
leadingIconStacWidgetThe icon to display at the start of the dropdown menu.
trailingIconStacWidgetThe icon to display at the end of the dropdown menu.
hintTextStringThe hint text to display when no selection is made.
errorTextStringThe error text to display when there is an error.
widthdoubleThe width of the dropdown menu.
menuHeightdoubleThe height of the dropdown menu.
inputDecorationThemeStacInputDecorationThemeThe theme to use for the input decoration.
textStyleStacTextStyleThe text style to use for the dropdown menu.
enableFilterboolWhether to enable filtering. Defaults to true.
enableSearchboolWhether to enable search. Defaults to true.
requestFocusOnTapboolWhether to request focus on tap. Defaults to true.
The Stac DropdownMenuEntry allows you to build a Flutter DropdownMenuEntry widget using JSON. To know more about the DropdownMenuEntry widget in Flutter, refer to the official documentation.

Properties

PropertyTypeDescription
valuedynamicThe value associated with this entry.
labelStringThe label to display for this entry.
enabledboolWhether this entry is enabled. Defaults to true.
leadingIconStacWidgetThe icon to display at the start of this entry.
trailingIconStacWidgetThe icon to display at the end of this entry.
styleStacButtonStyleThe style to use for this entry.

Example

StacDropdownMenu(
  label: StacText(data: 'Select an option'),
  hintText: 'Please select',
  width: 200,
  dropdownMenuEntries: [
    StacDropdownMenuEntry(
      value: 'option1',
      label: 'Option 1',
      leadingIcon: StacIcon(icon: 'home'),
    ),
    StacDropdownMenuEntry(
      value: 'option2',
      label: 'Option 2',
      leadingIcon: StacIcon(icon: 'settings'),
    ),
    StacDropdownMenuEntry(
      value: 'option3',
      label: 'Option 3',
      leadingIcon: StacIcon(icon: 'favorite'),
    ),
  ],
)