Skip to content

DropdownMenu item icon and DropdownMenu.leadingIcon are not aligned horizontally #161668

Closed

Description

@bleroux

Steps to reproduce

  1. Run the given code sample.
  2. Tap on the dropdown to open the menu.
  3. Observe the first item icon alignment.

Expected results

The item icon is aligned with the DropdownMenu leading icon:

Image

Actual results

The item icon is not aligned with the DropdownMenu leading icon:

Image

Code sample

Code sample
import 'package:flutter/material.dart';

void main() => runApp(const MyApp());

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return Transform.scale(
      scale: 1.0,
      child: MaterialApp(
        title: 'Material App',
        theme: ThemeData.dark().copyWith(visualDensity: VisualDensity.standard),
        home: const Home(),
      ),
    );
  }
}

class Home extends StatelessWidget {
  const Home({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: Container(
          padding: const EdgeInsets.all(16.0),
          width: 400,
          child: Column(
            mainAxisSize: MainAxisSize.min,
            spacing: 8.0,
            children: [
              Container(
                height: 16.0,
                color: Colors.grey[700],
                child: Row(
                  children: [
                    Container(color: Colors.deepOrangeAccent, width: 12.0),
                    Container(color: Colors.orangeAccent, width: 24.0),
                    Container(color: Colors.deepOrangeAccent, width: 12.0),
                    Container(color: Colors.yellow, width: 4.0),
                  ],
                ),
              ),
              TextField(
                controller: TextEditingController(text: 'TextField with prefix icon'),
                decoration: const InputDecoration(
                  filled: true,
                  labelText: 'For reference',
                  prefixIcon: Icon(Icons.check_box_rounded),
                ),
              ),
              Container(
                height: 16.0,
                color: Colors.grey[700],
                child: Row(
                  children: [
                    Container(color: Colors.deepOrangeAccent, width: 12.0),
                    Container(color: Colors.orangeAccent, width: 24.0),
                    Container(color: Colors.deepOrangeAccent, width: 12.0),
                    Container(color: Colors.yellow, width: 4.0),
                  ],
                ),
              ),
              const DropdownMenu<String>(
                expandedInsets: EdgeInsets.zero,
                leadingIcon: Icon(Icons.check_box_rounded),
                dropdownMenuEntries: [
                  DropdownMenuEntry(
                    label: 'Item with leading icon',
                    value: '1',
                    leadingIcon: Icon(Icons.check_box_rounded),
                  ),
                  DropdownMenuEntry(label: 'Item 2', value: '2'),
                ],
                label: Text('DropdownMenu with icon'),
                inputDecorationTheme: InputDecorationTheme(filled: true),
              ),
            ],
          ),
        ),
      ),
    );
  }
}

Screenshots or Video

No response

Logs

No response

Flutter Doctor output

Doctor output
Flutter (Channel master, 3.28.0-2.0.pre.38753, on Ubuntu 24.04.1 LTS 6.8.0-51-generic, locale fr_FR.UTF-8)

Activity

  1. added
    in triagePresently being triaged by the triage team
    a: text inputEntering text in a text field or keyboard related problems
    c: regressionIt was better in the past than it is now
    frameworkflutter/packages/flutter repository. See also f: labels.
    has reproducible stepsThe issue has been confirmed reproducible and is ready to work on
    p: material_uimaterial_ui package in flutter/packages
    and removed
    in triagePresently being triaged by the triage team
    on Jan 15, 2025
  2. self-assigned this
    on Jan 15, 2025
  3. bleroux commented on Jan 15, 2025

    @bleroux
    ContributorAuthor

    This as a regression related to #152069. I will file a PR soon.

  4. moved this from To do to PR submitted in Nevercodeon Jan 16, 2025
  5. moved this from PR submitted to Done (PR merged) in Nevercodeon Jan 21, 2025
  6. added
    r: fixedIssue is closed as already fixed in a newer version
    on Jan 21, 2025
  7. github-actions commented on Feb 4, 2025

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  8. locked as resolved and limited conversation to collaborators on Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

a: text inputEntering text in a text field or keyboard related problemsc: regressionIt was better in the past than it is nowfound in release: 3.28Found to occur in 3.28frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onp: material_uimaterial_ui package in flutter/packagesr: fixedIssue is closed as already fixed in a newer versionteam-text-inputOwned by Text Input team

Type

No type

Projects

  • Status
    Done (PR merged)

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions