Skip to content

DropdownMenu filtering is broken (after selecting an item, it reverts to a different value) #174609

@Hixie

Description

@Hixie

Steps to reproduce

  1. Run the code sample below (it works in dartpad).
  2. Click the text field.
  3. Type "a".
  4. Select the third option, "Dragonfruit".

Expected results

It should say "Dragonfruit".

Actual results

It says "Cherry"!

Code sample

import 'package:flutter/material.dart';

void main() {
  runApp(const DropdownMenuExample());
}

final List<DropdownMenuEntry<String>> entries = [
  DropdownMenuEntry<String>(value: 'Apple', label: 'Apple'),
  DropdownMenuEntry<String>(value: 'Banana', label: 'Banana'),
  DropdownMenuEntry<String>(value: 'Cherry', label: 'Cherry'),
  DropdownMenuEntry<String>(value: 'Dragonfruit', label: 'Dragonfruit'),
];

class DropdownMenuExample extends StatefulWidget {
  const DropdownMenuExample({super.key});

  @override
  State<DropdownMenuExample> createState() => _DropdownMenuExampleState();
}

class _DropdownMenuExampleState extends State<DropdownMenuExample> {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Material(
        child: DropdownMenu<String>(
          enableFilter: true,
          onSelected: (String? icon) {
            setState(() { });
          },
          dropdownMenuEntries: entries.toList(),
        ),
      ),
    );
  }
}

This regressed in #162062.

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work listc: regressionIt was better in the past than it is nowf: material designflutter/packages/flutter/material repository.found in release: 3.35Found to occur in 3.35found in release: 3.36Found to occur in 3.36frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionteam-designOwned by Design Languages teamtriaged-designTriaged by Design Languages teamworkaround availableThere is a workaround available to overcome the issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions