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
7f56a614
Unverified
Commit
7f56a614
authored
Dec 17, 2019
by
Shi-Hao Hong
Committed by
GitHub
Dec 17, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix isDense default for DropdownButtonFormField (#47160)
parent
1871c61f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
3 deletions
+35
-3
dropdown.dart
packages/flutter/lib/src/material/dropdown.dart
+1
-1
dropdown_form_field_test.dart
packages/flutter/test/material/dropdown_form_field_test.dart
+34
-2
No files found.
packages/flutter/lib/src/material/dropdown.dart
View file @
7f56a614
...
...
@@ -1402,7 +1402,7 @@ class DropdownButtonFormField<T> extends FormField<T> {
Color
iconDisabledColor
,
Color
iconEnabledColor
,
double
iconSize
=
24.0
,
bool
isDense
=
fals
e
,
bool
isDense
=
tru
e
,
bool
isExpanded
=
false
,
double
itemHeight
,
})
:
assert
(
items
==
null
||
items
.
isEmpty
||
value
==
null
||
...
...
packages/flutter/test/material/dropdown_form_field_test.dart
View file @
7f56a614
...
...
@@ -13,6 +13,10 @@ import '../rendering/mock_canvas.dart';
const
List
<
String
>
menuItems
=
<
String
>[
'one'
,
'two'
,
'three'
,
'four'
];
final
ValueChanged
<
String
>
onChanged
=
(
_
)
{
};
final
Type
dropdownButtonType
=
DropdownButton
<
String
>(
onChanged:
(
_
)
{
},
items:
const
<
DropdownMenuItem
<
String
>>[],
).
runtimeType
;
Finder
_iconRichText
(
Key
iconKey
)
{
return
find
.
descendant
(
...
...
@@ -31,7 +35,7 @@ Widget buildFormFrame({
Color
iconDisabledColor
,
Color
iconEnabledColor
,
double
iconSize
=
24.0
,
bool
isDense
=
fals
e
,
bool
isDense
=
tru
e
,
bool
isExpanded
=
false
,
Widget
hint
,
Widget
disabledHint
,
...
...
@@ -227,7 +231,6 @@ void main() {
buildFormFrame
(
buttonKey:
buttonKey
,
value:
value
,
isDense:
true
,
onChanged:
onChanged
,
),
);
...
...
@@ -262,6 +265,35 @@ void main() {
}
});
testWidgets
(
'DropdownButtonFormField.isDense is true by default'
,
(
WidgetTester
tester
)
async
{
// Regression test for https://github.com/flutter/flutter/issues/46844
final
Key
buttonKey
=
UniqueKey
();
const
String
value
=
'two'
;
await
tester
.
pumpWidget
(
TestApp
(
textDirection:
TextDirection
.
ltr
,
child:
Material
(
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'
)),
);
}).
toList
(),
),
),
),
);
final
RenderBox
box
=
tester
.
renderObject
<
RenderBox
>(
find
.
byType
(
dropdownButtonType
));
expect
(
box
.
size
.
height
,
24.0
);
});
testWidgets
(
'DropdownButtonFormField - custom text style'
,
(
WidgetTester
tester
)
async
{
const
String
value
=
'foo'
;
final
UniqueKey
itemKey
=
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