Skip to content

Commit 57a994b

Browse files
authored
Merge pull request #361 from AhmedLSayed9/fix_dropdown_formfield_clips_large_text_scale
Fix DropdownButtonFormField clips text when large text scale is used …
2 parents 7b75ff7 + 1a4fcb2 commit 57a994b

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

packages/dropdown_button2/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
- Add `MenuItemStyleData.useDecorationHorizontalPadding`, used to determine whether to use the horizontal padding from "decoration.contentPadding" for menu items when using `DropdownButtonFormField2`.
1313
- Use decoration hint text as the default value for dropdown button hints [Flutter core].
1414
- Update SDK constraints: ">=3.4.0 <4.0.0"
15+
- Fix DropdownButtonFormField clips text when large text scale is used [Flutter core].
1516

1617
## 3.0.0-beta.21
1718

packages/dropdown_button2/lib/src/dropdown_button2.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,9 @@ class _DropdownButton2State<T> extends State<DropdownButton2<T>> with WidgetsBin
644644
double get _denseButtonHeight {
645645
final double fontSize =
646646
_textStyle!.fontSize ?? Theme.of(context).textTheme.titleMedium!.fontSize!;
647-
final double scaledFontSize = MediaQuery.textScalerOf(context).scale(fontSize);
647+
final double lineHeight =
648+
_textStyle!.height ?? Theme.of(context).textTheme.titleMedium!.height ?? 1.0;
649+
final double scaledFontSize = MediaQuery.textScalerOf(context).scale(fontSize * lineHeight);
648650
return math.max(scaledFontSize, math.max(_iconStyle.iconSize, _kDenseButtonHeight));
649651
}
650652

0 commit comments

Comments
 (0)