Skip to content

DropdownMenuEntry style's text style is not resolving with states #177363

@rmahmadkhan

Description

@rmahmadkhan

Steps to reproduce

textStyle in ButtonStyle for DropdownMenuEntry is not resolving with states. It doesn't change fontWeight or fontSize for focused entry.

You can use the following textStyle in the ButtonStyle;

textStyle: WidgetStateProperty.resolveWith(
                (states) => TextStyle(
                  fontWeight: states.contains(WidgetState.focused)
                      ? FontWeight.bold
                      : FontWeight.w400,
                  fontSize: 14,
                  height: 20 / 14,
                ),
              ),

WidgetStateProperty.resolveWith is working with other properties like foregroundColor as you can see in the reproducible code below.

Expected results

It is expected to change text style according to the state of button in DropdownMenu

Actual results

Not resolving with states on textStyle.

Code sample

Code sample
DropdownMenu(
        alignmentOffset: Offset(0, 6),
        menuStyle: MenuStyle(
          maximumSize: WidgetStatePropertyAll(Size.fromHeight(200)),
          padding: const WidgetStatePropertyAll(EdgeInsets.all(4)),
        ),
        dropdownMenuEntries: [
          DropdownMenuEntry(
            value: 'all',
            label: 'All',
            style: ButtonStyle(
              textStyle: WidgetStateProperty.resolveWith(
                (states) => TextStyle(
                  fontWeight: states.contains(WidgetState.focused)
                      ? FontWeight.bold
                      : FontWeight.w400,
                  fontSize: 14,
                  height: 20 / 14,
                ),
              ),
              padding: const WidgetStatePropertyAll(
                EdgeInsets.symmetric(horizontal: 10, vertical: 8),
              ),
              foregroundColor: WidgetStateProperty.resolveWith(
                (states) => states.contains(WidgetState.focused)
                    ? Colors.teal.shade800
                    : Colors.black,
              ),
              backgroundColor: WidgetStateProperty.resolveWith(
                (states) => states.contains(WidgetState.focused)
                    ? Colors.teal.shade50
                    : states.contains(WidgetState.hovered)
                        ? Colors.grey
                        : Colors.transparent,
              ),
              shape: WidgetStatePropertyAll(
                RoundedRectangleBorder(
                  borderRadius: BorderRadius.all(Radius.circular(10)),
                ),
              ),
            ),
          ),
          DropdownMenuEntry(
            value: 'upcoming',
            label: 'Upcoming',
            style: ButtonStyle(
              textStyle: WidgetStateProperty.resolveWith(
                    (states) => TextStyle(
                  fontWeight: states.contains(WidgetState.focused)
                      ? FontWeight.bold
                      : FontWeight.w400,
                  fontSize: 14,
                  height: 20 / 14,
                ),
              ),
              padding: const WidgetStatePropertyAll(
                EdgeInsets.symmetric(horizontal: 10, vertical: 8),
              ),
              foregroundColor: WidgetStateProperty.resolveWith(
                    (states) => states.contains(WidgetState.focused)
                    ? Colors.teal.shade800
                    : Colors.black,
              ),
              backgroundColor: WidgetStateProperty.resolveWith(
                    (states) => states.contains(WidgetState.focused)
                    ? Colors.teal.shade50
                    : states.contains(WidgetState.hovered)
                    ? Colors.grey
                    : Colors.transparent,
              ),
              shape: WidgetStatePropertyAll(
                RoundedRectangleBorder(
                  borderRadius: BorderRadius.all(Radius.circular(10)),
                ),
              ),
            ),
          ),
          DropdownMenuEntry(
            value: 'past',
            label: 'Past',
            style: ButtonStyle(
              textStyle: WidgetStateProperty.resolveWith(
                    (states) => TextStyle(
                  fontWeight: states.contains(WidgetState.focused)
                      ? FontWeight.bold
                      : FontWeight.w400,
                  fontSize: 14,
                  height: 20 / 14,
                ),
              ),
              padding: const WidgetStatePropertyAll(
                EdgeInsets.symmetric(horizontal: 10, vertical: 8),
              ),
              foregroundColor: WidgetStateProperty.resolveWith(
                    (states) => states.contains(WidgetState.focused)
                    ? Colors.teal.shade800
                    : Colors.black,
              ),
              backgroundColor: WidgetStateProperty.resolveWith(
                    (states) => states.contains(WidgetState.focused)
                    ? Colors.teal.shade50
                    : states.contains(WidgetState.hovered)
                    ? Colors.grey
                    : Colors.transparent,
              ),
              shape: WidgetStatePropertyAll(
                RoundedRectangleBorder(
                  borderRadius: BorderRadius.all(Radius.circular(10)),
                ),
              ),
            ),
          ),
        ],
      ),

Screenshots or Video

Screenshots / Video demonstration

Expected Output

Image

Current Output

Image
Screen.Recording.2025-10-22.at.10.20.50.AM.mov

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.35.1, on macOS 26.0.1 25A362 darwin-arm64, locale
    en-PK) [397ms]
    • Flutter version 3.35.1 on channel stable at
      /Users/ahmad/development/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 20f8274939 (10 weeks ago), 2025-08-14 10:53:09 -0700
    • Engine revision 1e9a811bf8
    • Dart version 3.9.0
    • DevTools version 2.48.0
    • Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop,
      enable-windows-desktop, enable-android, enable-ios, cli-animations,
      enable-lldb-debugging

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    [1,403ms]
    • Android SDK at /Users/ahmad/Library/Android/sdk
    • Emulator version 35.6.11.0 (build_id 13610412) (CL:N/A)
    • Platform android-36, build-tools 34.0.0
    • Java binary at: /Applications/Android
      Studio.app/Contents/jbr/Contents/Home/bin/java
      This is the JDK bundled with the latest Android Studio installation on
      this machine.
      To manually set the JDK path, use: `flutter config
      --jdk-dir="path/to/jdk"`.
    • Java version OpenJDK Runtime Environment (build 21.0.6+-13391695-b895.109)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 26.0.1) [984ms]
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 17A400
    • CocoaPods version 1.16.2

[✓] Chrome - develop for the web [50ms]
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2025.1) [49ms]
    • 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 21.0.6+-13391695-b895.109)

[✓] VS Code (version 1.105.0) [19ms]
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.120.0

[✓] Connected device (4 available) [6.2s]
    • Ahmad's iPhone (wireless) (mobile) • 00008110-001238C02E98801E
      • ios            • iOS 26.0.1 23A355
    • iPhone 17 Pro (mobile)             • 828FAD79-1E9B-4C45-8729-656155AF3944
      • ios            • com.apple.CoreSimulator.SimRuntime.iOS-26-0 (simulator)
    • macOS (desktop)                    • macos
      • darwin-arm64   • macOS 26.0.1 25A362 darwin-arm64
    • Chrome (web)                       • chrome
      • web-javascript • Google Chrome 141.0.7390.109

[✓] Network resources [625ms]
    • All expected network resources are available.

• No issues found!

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work listf: material designflutter/packages/flutter/material repository.found in release: 3.35Found to occur in 3.35found in release: 3.38Found to occur in 3.38frameworkflutter/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 team

Type

No type

Projects

Status

Done (PR merged)

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions