Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
74ac8678
Unverified
Commit
74ac8678
authored
Jul 19, 2022
by
Foong Siqi
Committed by
GitHub
Jul 19, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modify calculation of dense button height when text scale is large for dropdown button (#107201)
parent
7148cba6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
1 deletion
+42
-1
dropdown.dart
packages/flutter/lib/src/material/dropdown.dart
+3
-1
dropdown_form_field_test.dart
packages/flutter/test/material/dropdown_form_field_test.dart
+39
-0
No files found.
packages/flutter/lib/src/material/dropdown.dart
View file @
74ac8678
...
...
@@ -1331,8 +1331,10 @@ class _DropdownButtonState<T> extends State<DropdownButton<T>> with WidgetsBindi
// Similarly, we don't reduce the height of the button so much that its icon
// would be clipped.
double
get
_denseButtonHeight
{
final
double
textScaleFactor
=
MediaQuery
.
of
(
context
).
textScaleFactor
;
final
double
fontSize
=
_textStyle
!.
fontSize
??
Theme
.
of
(
context
).
textTheme
.
subtitle1
!.
fontSize
!;
return
math
.
max
(
fontSize
,
math
.
max
(
widget
.
iconSize
,
_kDenseButtonHeight
));
final
double
scaledFontSize
=
textScaleFactor
*
fontSize
;
return
math
.
max
(
scaledFontSize
,
math
.
max
(
widget
.
iconSize
,
_kDenseButtonHeight
));
}
Color
get
_iconColor
{
...
...
packages/flutter/test/material/dropdown_form_field_test.dart
View file @
74ac8678
...
...
@@ -567,6 +567,45 @@ void main() {
}
});
testWidgets
(
'DropdownButtonFormField with isDense:true does not clip large scale text'
,
(
WidgetTester
tester
)
async
{
final
Key
buttonKey
=
UniqueKey
();
const
String
value
=
'two'
;
await
tester
.
pumpWidget
(
TestApp
(
textDirection:
TextDirection
.
ltr
,
child:
Builder
(
builder:
(
BuildContext
context
)
=>
MediaQuery
(
data:
MediaQuery
.
of
(
context
).
copyWith
(
textScaleFactor:
3.0
),
child:
Material
(
child:
Center
(
child:
DropdownButtonFormField
<
String
>(
key:
buttonKey
,
value:
value
,
onChanged:
onChanged
,
items:
menuItems
.
map
<
DropdownMenuItem
<
String
>>((
String
item
)
{
return
DropdownMenuItem
<
String
>(
key:
ValueKey
<
String
>(
item
),
value:
item
,
child:
Text
(
item
,
key:
ValueKey
<
String
>(
'
${item}
Text'
),
style:
const
TextStyle
(
fontSize:
20.0
)),
);
}).
toList
(),
),
),
),
),
),
),
);
final
RenderBox
box
=
tester
.
renderObject
<
RenderBox
>(
find
.
byType
(
dropdownButtonType
));
expect
(
box
.
size
.
height
,
72.0
);
});
testWidgets
(
'DropdownButtonFormField.isDense is true by default'
,
(
WidgetTester
tester
)
async
{
// Regression test for https://github.com/flutter/flutter/issues/46844
final
Key
buttonKey
=
UniqueKey
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment