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
8d30177f
Unverified
Commit
8d30177f
authored
Jan 19, 2022
by
Chinmoy
Committed by
GitHub
Jan 19, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prevents DropdownButton from applying borderRadius property to the (#96695)
parent
ec1a7793
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
62 deletions
+0
-62
dropdown.dart
packages/flutter/lib/src/material/dropdown.dart
+0
-19
dropdown_test.dart
packages/flutter/test/material/dropdown_test.dart
+0
-43
No files found.
packages/flutter/lib/src/material/dropdown.dart
View file @
8d30177f
...
@@ -97,7 +97,6 @@ class _DropdownMenuItemButton<T> extends StatefulWidget {
...
@@ -97,7 +97,6 @@ class _DropdownMenuItemButton<T> extends StatefulWidget {
const
_DropdownMenuItemButton
({
const
_DropdownMenuItemButton
({
Key
?
key
,
Key
?
key
,
this
.
padding
,
this
.
padding
,
required
this
.
borderRadius
,
required
this
.
route
,
required
this
.
route
,
required
this
.
buttonRect
,
required
this
.
buttonRect
,
required
this
.
constraints
,
required
this
.
constraints
,
...
@@ -111,7 +110,6 @@ class _DropdownMenuItemButton<T> extends StatefulWidget {
...
@@ -111,7 +110,6 @@ class _DropdownMenuItemButton<T> extends StatefulWidget {
final
BoxConstraints
constraints
;
final
BoxConstraints
constraints
;
final
int
itemIndex
;
final
int
itemIndex
;
final
bool
enableFeedback
;
final
bool
enableFeedback
;
final
BorderRadius
borderRadius
;
@override
@override
_DropdownMenuItemButtonState
<
T
>
createState
()
=>
_DropdownMenuItemButtonState
<
T
>();
_DropdownMenuItemButtonState
<
T
>
createState
()
=>
_DropdownMenuItemButtonState
<
T
>();
...
@@ -178,16 +176,6 @@ class _DropdownMenuItemButtonState<T> extends State<_DropdownMenuItemButton<T>>
...
@@ -178,16 +176,6 @@ class _DropdownMenuItemButtonState<T> extends State<_DropdownMenuItemButton<T>>
height:
widget
.
route
.
itemHeight
,
height:
widget
.
route
.
itemHeight
,
child:
widget
.
route
.
items
[
widget
.
itemIndex
],
child:
widget
.
route
.
items
[
widget
.
itemIndex
],
);
);
final
BorderRadius
itemBorderRadius
;
if
(
widget
.
route
.
items
.
length
==
1
)
{
itemBorderRadius
=
widget
.
borderRadius
;
}
else
if
(
widget
.
itemIndex
==
0
)
{
itemBorderRadius
=
BorderRadius
.
only
(
topLeft:
widget
.
borderRadius
.
topLeft
,
topRight:
widget
.
borderRadius
.
topRight
);
}
else
if
(
widget
.
itemIndex
==
widget
.
route
.
items
.
length
-
1
)
{
itemBorderRadius
=
BorderRadius
.
only
(
bottomLeft:
widget
.
borderRadius
.
bottomLeft
,
bottomRight:
widget
.
borderRadius
.
bottomRight
);
}
else
{
itemBorderRadius
=
BorderRadius
.
zero
;
}
// An [InkWell] is added to the item only if it is enabled
// An [InkWell] is added to the item only if it is enabled
if
(
dropdownMenuItem
.
enabled
)
{
if
(
dropdownMenuItem
.
enabled
)
{
child
=
InkWell
(
child
=
InkWell
(
...
@@ -195,7 +183,6 @@ class _DropdownMenuItemButtonState<T> extends State<_DropdownMenuItemButton<T>>
...
@@ -195,7 +183,6 @@ class _DropdownMenuItemButtonState<T> extends State<_DropdownMenuItemButton<T>>
enableFeedback:
widget
.
enableFeedback
,
enableFeedback:
widget
.
enableFeedback
,
onTap:
_handleOnTap
,
onTap:
_handleOnTap
,
onFocusChange:
_handleFocusChange
,
onFocusChange:
_handleFocusChange
,
borderRadius:
itemBorderRadius
,
child:
child
,
child:
child
,
);
);
}
}
...
@@ -279,7 +266,6 @@ class _DropdownMenuState<T> extends State<_DropdownMenu<T>> {
...
@@ -279,7 +266,6 @@ class _DropdownMenuState<T> extends State<_DropdownMenu<T>> {
constraints:
widget
.
constraints
,
constraints:
widget
.
constraints
,
itemIndex:
itemIndex
,
itemIndex:
itemIndex
,
enableFeedback:
widget
.
enableFeedback
,
enableFeedback:
widget
.
enableFeedback
,
borderRadius:
widget
.
borderRadius
??
BorderRadius
.
zero
,
),
),
];
];
...
@@ -1113,11 +1099,6 @@ class DropdownButton<T> extends StatefulWidget {
...
@@ -1113,11 +1099,6 @@ class DropdownButton<T> extends StatefulWidget {
final
AlignmentGeometry
alignment
;
final
AlignmentGeometry
alignment
;
/// Defines the corner radii of the menu's rounded rectangle shape.
/// Defines the corner radii of the menu's rounded rectangle shape.
///
/// The radii of the first menu item's top left and right corners are
/// defined by the corresponding properties of the [borderRadius].
/// Similarly, the radii of the last menu item's bottom and right corners
/// are defined by the corresponding properties of the [borderRadius].
final
BorderRadius
?
borderRadius
;
final
BorderRadius
?
borderRadius
;
@override
@override
...
...
packages/flutter/test/material/dropdown_test.dart
View file @
8d30177f
...
@@ -3564,43 +3564,6 @@ void main() {
...
@@ -3564,43 +3564,6 @@ void main() {
..
rrect
()
..
rrect
()
..
rrect
(
rrect:
const
RRect
.
fromLTRBXY
(
0.0
,
0.0
,
144.0
,
208.0
,
radius
,
radius
)),
..
rrect
(
rrect:
const
RRect
.
fromLTRBXY
(
0.0
,
0.0
,
144.0
,
208.0
,
radius
,
radius
)),
);
);
final
InkWell
firstItem
=
tester
.
widget
(
find
.
widgetWithText
(
InkWell
,
'One'
));
final
InkWell
lastItem
=
tester
.
widget
(
find
.
widgetWithText
(
InkWell
,
'Four'
));
expect
(
firstItem
.
borderRadius
,
const
BorderRadius
.
vertical
(
top:
Radius
.
circular
(
radius
)));
expect
(
lastItem
.
borderRadius
,
const
BorderRadius
.
vertical
(
bottom:
Radius
.
circular
(
radius
)));
});
testWidgets
(
'borderRadius is properly applied to InkWell when there is only one item'
,
(
WidgetTester
tester
)
async
{
const
BorderRadius
borderRadius
=
BorderRadius
.
all
(
Radius
.
circular
(
5.0
));
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Scaffold
(
body:
Center
(
child:
DropdownButton
<
String
>(
borderRadius:
borderRadius
,
value:
'One'
,
items:
const
<
DropdownMenuItem
<
String
>>[
DropdownMenuItem
<
String
>(
value:
'One'
,
child:
Text
(
'One'
)
),
],
onChanged:
(
_
)
{
},
),
),
),
),
);
await
tester
.
tap
(
find
.
text
(
'One'
));
await
tester
.
pumpAndSettle
();
final
InkWell
menuItem
=
tester
.
widget
(
find
.
widgetWithText
(
InkWell
,
'One'
));
expect
(
menuItem
.
borderRadius
,
borderRadius
);
});
});
// Regression test for https://github.com/flutter/flutter/issues/88574
// Regression test for https://github.com/flutter/flutter/issues/88574
...
@@ -3718,11 +3681,5 @@ void main() {
...
@@ -3718,11 +3681,5 @@ void main() {
..
rrect
()
..
rrect
()
..
rrect
(
rrect:
const
RRect
.
fromLTRBXY
(
0.0
,
0.0
,
800.0
,
208.0
,
radius
,
radius
)),
..
rrect
(
rrect:
const
RRect
.
fromLTRBXY
(
0.0
,
0.0
,
800.0
,
208.0
,
radius
,
radius
)),
);
);
final
InkWell
firstItem
=
tester
.
widget
(
find
.
widgetWithText
(
InkWell
,
'One'
));
final
InkWell
lastItem
=
tester
.
widget
(
find
.
widgetWithText
(
InkWell
,
'Four'
));
expect
(
firstItem
.
borderRadius
,
const
BorderRadius
.
vertical
(
top:
Radius
.
circular
(
radius
)));
expect
(
lastItem
.
borderRadius
,
const
BorderRadius
.
vertical
(
bottom:
Radius
.
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