Repository: flutter
Issue: Widget test issue with DropdownButton
Labels: a: tests,framework,f: material design,a: error message,has reproducible steps,found in release: 2.5,found in release: 2.6,team-design,triaged-design

## Description

I was trying to write tests to test for a `DropdownButton`. I made the tester to first tap on the `DropdownButton` to expand the options. But when I tried to make the tester to tap on one of the dropdown options, it failed to do so. It was giving error saying that the finder matched two widgets but realistically there should only be one that matches.

## Steps to Reproduce

<details>
  <summary>main.dart</summary>
  
  ```dart
  import 'package:flutter/material.dart';

  void main() => runApp(const MyApp());

  class MyApp extends StatelessWidget {
    const MyApp({Key? key}) : super(key: key);

    static const String _title = 'Flutter Code Sample';

    @override
    Widget build(BuildContext context) {
      return MaterialApp(
        title: _title,
        home: Scaffold(
          appBar: AppBar(title: const Text(_title)),
          body: const Center(
            child: MyStatefulWidget(),
          ),
        ),
      );
    }
  }

  class MyStatefulWidget extends StatefulWidget {
    const MyStatefulWidget({Key? key}) : super(key: key);

    @override
    State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
  }

  class _MyStatefulWidgetState extends State<MyStatefulWidget> {
    String dropdownValue = 'One';

    @override
    Widget build(BuildContext context) {
      return DropdownButton<String>(
        key: const Key('dropdownButton'),
        value: dropdownValue,
        onChanged: (String? newValue) {
          setState(() {
            dropdownValue = newValue!;
          });
        },
        items: <String>['One', 'Two', 'Free', 'Four']
            .map<DropdownMenuItem<String>>((String value) {
          return DropdownMenuItem<String>(
            value: value,
            child: Text(value),
          );
        }).toList(),
      );
    }
  }
  ```
</details>

<details>
  <summary>widget_test.dart</summary>
  
  ```dart
  import 'package:flutter/material.dart';
  import 'package:flutter_test/flutter_test.dart';

  import 'package:hello_app/main.dart';

  void main() {
    testWidgets('dropdown button', (WidgetTester tester) async {
      await tester.pumpWidget(MyApp());

      await tester.tap(find.byKey(const Key('dropdownButton')));
      await tester.pumpAndSettle();
      await tester.tap(find.text('Two'));

      final widget = find.byWidgetPredicate((widget) {
        return widget is DropdownButton && widget.value == 'Two';
      });
      expect(widget, findsOneWidget);
    });
  }

  ```
</details>

The test would fail on the following line:

```dart
await tester.tap(find.text('Two'));
```

**Expected results:** <!-- what did you want to see? -->

The test should pass

**Actual results:** <!-- what did you see? -->

The test failed when the tester tried to tap on one of the dropdown options

```
The following assertion was thrown running a test:
The finder "2 widgets with text "Two" (ignoring offstage widgets): [Text("Two", dependencies:
[MediaQuery, DefaultTextStyle]), Text("Two", dependencies: [DefaultTextStyle, MediaQuery])]" (used
in a call to "tap()") ambiguously found multiple matching widgets. The "tap()" method needs a single
target.
```

<details>
  <summary>Logs</summary>

### Analyze
```
No issues found! (ran in 4.7s)
```

### Doctor
```
[✓] Flutter (Channel stable, 2.2.3, on macOS 11.5.2 20G95 darwin-x64, locale en-AU)
    • Flutter version 2.2.3 at <scrubbed>
    • Framework revision f4abaa0735 (2 months ago), 2021-07-01 12:46:11 -0700
    • Engine revision 241c87ad80
    • Dart version 2.13.4

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at <scrubbed>
    • Platform android-30, build-tools 30.0.2
    • ANDROID_HOME = <scrubbed>
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.5.1, Build version 12E507
    • CocoaPods version 1.10.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)

[✓] VS Code (version 1.60.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.26.0

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-x64     • macOS 11.5.2 20G95 darwin-x64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 93.0.4577.63

• No issues found!
```

</details>