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
a9c71d7e
Unverified
Commit
a9c71d7e
authored
May 25, 2022
by
Taha Tesser
Committed by
GitHub
May 25, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Reland]: Fix `DropdownButton` menu clip (#104251)
parent
406d86b4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
21 deletions
+58
-21
dropdown.dart
packages/flutter/lib/src/material/dropdown.dart
+27
-21
dropdown_test.dart
packages/flutter/test/material/dropdown_test.dart
+31
-0
No files found.
packages/flutter/lib/src/material/dropdown.dart
View file @
a9c71d7e
...
@@ -286,27 +286,33 @@ class _DropdownMenuState<T> extends State<_DropdownMenu<T>> {
...
@@ -286,27 +286,33 @@ class _DropdownMenuState<T> extends State<_DropdownMenu<T>> {
namesRoute:
true
,
namesRoute:
true
,
explicitChildNodes:
true
,
explicitChildNodes:
true
,
label:
localizations
.
popupMenuLabel
,
label:
localizations
.
popupMenuLabel
,
child:
Material
(
child:
ClipRRect
(
type:
MaterialType
.
transparency
,
borderRadius:
widget
.
borderRadius
??
BorderRadius
.
zero
,
textStyle:
route
.
style
,
clipBehavior:
widget
.
borderRadius
!=
null
child:
ScrollConfiguration
(
?
Clip
.
antiAlias
// Dropdown menus should never overscroll or display an overscroll indicator.
:
Clip
.
none
,
// Scrollbars are built-in below.
child:
Material
(
// Platform must use Theme and ScrollPhysics must be Clamping.
type:
MaterialType
.
transparency
,
behavior:
ScrollConfiguration
.
of
(
context
).
copyWith
(
textStyle:
route
.
style
,
scrollbars:
false
,
child:
ScrollConfiguration
(
overscroll:
false
,
// Dropdown menus should never overscroll or display an overscroll indicator.
physics:
const
ClampingScrollPhysics
(),
// Scrollbars are built-in below.
platform:
Theme
.
of
(
context
).
platform
,
// Platform must use Theme and ScrollPhysics must be Clamping.
),
behavior:
ScrollConfiguration
.
of
(
context
).
copyWith
(
child:
PrimaryScrollController
(
scrollbars:
false
,
controller:
widget
.
route
.
scrollController
!,
overscroll:
false
,
child:
Scrollbar
(
physics:
const
ClampingScrollPhysics
(),
thumbVisibility:
true
,
platform:
Theme
.
of
(
context
).
platform
,
child:
ListView
(
),
padding:
kMaterialListPadding
,
child:
PrimaryScrollController
(
shrinkWrap:
true
,
controller:
widget
.
route
.
scrollController
!,
children:
children
,
child:
Scrollbar
(
thumbVisibility:
true
,
child:
ListView
(
padding:
kMaterialListPadding
,
shrinkWrap:
true
,
children:
children
,
),
),
),
),
),
),
),
...
...
packages/flutter/test/material/dropdown_test.dart
View file @
a9c71d7e
...
@@ -3809,4 +3809,35 @@ void main() {
...
@@ -3809,4 +3809,35 @@ void main() {
expect
(
tester
.
getBottomRight
(
find
.
text
(
hintText
)).
dx
,
776.0
);
expect
(
tester
.
getBottomRight
(
find
.
text
(
hintText
)).
dx
,
776.0
);
expect
(
tester
.
getBottomRight
(
find
.
text
(
hintText
)).
dy
,
350.0
);
expect
(
tester
.
getBottomRight
(
find
.
text
(
hintText
)).
dy
,
350.0
);
});
});
testWidgets
(
'BorderRadius property clips dropdown menu'
,
(
WidgetTester
tester
)
async
{
const
double
radius
=
20.0
;
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Scaffold
(
body:
Center
(
child:
DropdownButtonFormField
<
String
>(
borderRadius:
BorderRadius
.
circular
(
radius
),
value:
'One'
,
items:
<
String
>[
'One'
,
'Two'
,
'Three'
,
'Four'
]
.
map
<
DropdownMenuItem
<
String
>>((
String
value
)
{
return
DropdownMenuItem
<
String
>(
value:
value
,
child:
Text
(
value
),
);
}).
toList
(),
onChanged:
(
_
)
{
},
),
),
),
),
);
await
tester
.
tap
(
find
.
text
(
'One'
));
await
tester
.
pumpAndSettle
();
final
RenderClipRRect
renderClip
=
tester
.
allRenderObjects
.
whereType
<
RenderClipRRect
>().
first
;
expect
(
renderClip
.
borderRadius
,
BorderRadius
.
circular
(
radius
));
});
}
}
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