Repository navigation
DropdownMenu crashes when provided menuStyle with small maximumSize #162356
Copy link
Copy link
Closed
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: error messageError messages from the Flutter frameworkError messages from the Flutter frameworkfound in release: 3.27Found to occur in 3.27Found to occur in 3.27found in release: 3.29Found to occur in 3.29Found to occur in 3.29frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onp: material_uimaterial_ui package in flutter/packagesmaterial_ui package in flutter/packagesr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-designOwned by Design Languages teamOwned by Design Languages teamtriaged-designTriaged by Design Languages teamTriaged by Design Languages team
Description
Steps to reproduce
set maximumSize property of menuStyle to be smaller than the DropdownMenu
Expected results
maximumSize property of menuStyle should be able to set the width of menu item smaller than the DropdownMenu
Actual results
DropdownMenu would overwrite the minimumSize property of menuStyle to the width of the Textfield, The widget would throw when trying to set the width to be smaller than Textfield.
Code sample
Code sample
import 'package:flutter/material.dart';
void main() {
runApp(const DropApp());
}
class DropApp extends StatelessWidget {
const DropApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Padding(
padding: const EdgeInsets.all(32.0),
child: DropdownMenu<String>(
width: 200.0,
dropdownMenuEntries: [
DropdownMenuEntry(
value: "1", label: "one this is a long long long text"),
DropdownMenuEntry(
value: "2", label: "two this is a long long long text"),
],
menuStyle: MenuStyle(
maximumSize: WidgetStatePropertyAll(Size(150.0, 100.0)),
),
),
),
),
);
}
}
Screenshots or Video
Screenshots / Video demonstration
[Upload media here]
Logs
Logs
══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
The following assertion was thrown building _MenuPanel(dirty, dependencies:
[InheritedCupertinoTheme, _InheritedTheme, _LocalizationsScope-[GlobalKey#f400a]], state:
_MenuPanelState#b76a8):
BoxConstraints has non-normalized width constraints.
The offending constraints were:
BoxConstraints(200.0<=w<=150.0, 0.0<=h<=100.0; NOT NORMALIZED)
Flutter Doctor output
Doctor output
[✓] Flutter (Channel stable, 3.27.3, on macOS 14.6.1 23G93 darwin-arm64, locale en-AU)
• Flutter version 3.27.3 on channel stable at /Users/mainj/php/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision c519ee916e (7 days ago), 2025-01-21 10:32:23 -0800
• Engine revision e672b006cb
• Dart version 3.6.1
• DevTools version 2.40.2Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: error messageError messages from the Flutter frameworkError messages from the Flutter frameworkfound in release: 3.27Found to occur in 3.27Found to occur in 3.27found in release: 3.29Found to occur in 3.29Found to occur in 3.29frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onp: material_uimaterial_ui package in flutter/packagesmaterial_ui package in flutter/packagesr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-designOwned by Design Languages teamOwned by Design Languages teamtriaged-designTriaged by Design Languages teamTriaged by Design Languages team
Activity
danagbemava-nc commentedon Jan 29, 2025
Reproducible using the code sample provided above.
flutter doctor -v
fix `DropdownMenu` crashes when provided menuStyle with small maximum…
github-actions commentedon Feb 28, 2025
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 -vand a minimal reproduction of the issue.