0

I'm trying to implement the new Material 3 DropdownMenu in my application to replace the old DropdownButton, but I can't seem to find where to add the error and helper texts.

Back in the DropdownButtonFormField, they would go inside the decoration parameter. Example:

decoration: InputDecoration(
 labelText: 'labelText',
 errorText: 'errorMessage',
 helperText: 'helperText',
),

I could find the style parameters for both helper and error texts in the DropdownMenu, but not the parameter for the text itself.

Am I missing something or this widget does not support those parameters?

This was my DropdownButton before:

DropdownButtonFormField<MyItem>(
      value: _selectedItem,
      decoration: const InputDecoration(
        labelText: 'Salutation',
        errorText: 'errorMessage',
        helperText: 'helperText',
        border: OutlineInputBorder(),
      ),
      onChanged: _onChanged,
      items: items.map((MyItem item) {
        return DropdownMenuItem<MyItem>(
          value: item,
          child: Text(item.title),
        );
      }).toList(),
    );

The expected result with the DropdownMenu is a similar, but with the lowered position of the items menu and the integrated search feature it has. Those were the main reasons for the change.

1 Answers1

0

For anyone needing this in the future, I opened an issue in the Flutter repository and they replied that the parameters are missing and will potentially be added.

Here is the link for the issue.