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
5f711794
Unverified
Commit
5f711794
authored
Mar 30, 2023
by
Henry Riehl
Committed by
GitHub
Mar 30, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Wire up MenuAnchor clipBehaviour property (#123632)
Wire up MenuAnchor clipBehaviour property
parent
8c5d223b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
67 additions
and
6 deletions
+67
-6
menu_anchor.dart
packages/flutter/lib/src/material/menu_anchor.dart
+5
-5
menu_anchor_test.dart
packages/flutter/test/material/menu_anchor_test.dart
+62
-1
No files found.
packages/flutter/lib/src/material/menu_anchor.dart
View file @
5f711794
...
...
@@ -127,7 +127,7 @@ class MenuAnchor extends StatefulWidget {
this
.
childFocusNode
,
this
.
style
,
this
.
alignmentOffset
=
Offset
.
zero
,
this
.
clipBehavior
=
Clip
.
non
e
,
this
.
clipBehavior
=
Clip
.
hardEdg
e
,
this
.
anchorTapClosesMenu
=
false
,
this
.
onOpen
,
this
.
onClose
,
...
...
@@ -183,7 +183,7 @@ class MenuAnchor extends StatefulWidget {
/// {@macro flutter.material.Material.clipBehavior}
///
/// Defaults to [Clip.
non
e].
/// Defaults to [Clip.
hardEdg
e].
final
Clip
clipBehavior
;
/// Whether the menus will be closed if the anchor area is tapped.
...
...
@@ -1530,7 +1530,7 @@ class SubmenuButton extends StatefulWidget {
this
.
style
,
this
.
menuStyle
,
this
.
alignmentOffset
,
this
.
clipBehavior
=
Clip
.
non
e
,
this
.
clipBehavior
=
Clip
.
hardEdg
e
,
this
.
focusNode
,
this
.
statesController
,
this
.
leadingIcon
,
...
...
@@ -1584,7 +1584,7 @@ class SubmenuButton extends StatefulWidget {
/// {@macro flutter.material.Material.clipBehavior}
///
/// Defaults to [Clip.
non
e].
/// Defaults to [Clip.
hardEdg
e].
final
Clip
clipBehavior
;
/// {@macro flutter.widgets.Focus.focusNode}
...
...
@@ -3312,7 +3312,7 @@ class _MenuPanelState extends State<_MenuPanel> {
shadowColor:
shadowColor
,
surfaceTintColor:
surfaceTintColor
,
type:
backgroundColor
==
null
?
MaterialType
.
transparency
:
MaterialType
.
canvas
,
clipBehavior:
Clip
.
hardEdge
,
clipBehavior:
widget
.
clipBehavior
,
child:
Padding
(
padding:
resolvedPadding
,
child:
SingleChildScrollView
(
...
...
packages/flutter/test/material/menu_anchor_test.dart
View file @
5f711794
...
...
@@ -945,6 +945,67 @@ void main() {
expect
(
material
.
color
,
equals
(
Colors
.
red
));
});
testWidgets
(
'MenuAnchor clip behavior'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Material
(
child:
Center
(
child:
MenuAnchor
(
menuChildren:
const
<
Widget
>
[
MenuItemButton
(
child:
Text
(
'Button 1'
),
),
],
builder:
(
BuildContext
context
,
MenuController
controller
,
Widget
?
child
)
{
return
FilledButton
(
onPressed:
()
{
controller
.
open
();
},
child:
const
Text
(
'Tap me'
),
);
},
),
)
)
)
);
await
tester
.
tap
(
find
.
text
(
'Tap me'
));
await
tester
.
pump
();
// Test default clip behavior.
expect
(
getMenuBarMaterial
(
tester
).
clipBehavior
,
equals
(
Clip
.
hardEdge
));
// Close the menu.
await
tester
.
tapAt
(
const
Offset
(
10.0
,
10.0
));
await
tester
.
pumpAndSettle
();
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Material
(
child:
Center
(
child:
MenuAnchor
(
clipBehavior:
Clip
.
antiAlias
,
menuChildren:
const
<
Widget
>
[
MenuItemButton
(
child:
Text
(
'Button 1'
),
),
],
builder:
(
BuildContext
context
,
MenuController
controller
,
Widget
?
child
)
{
return
FilledButton
(
onPressed:
()
{
controller
.
open
();
},
child:
const
Text
(
'Tap me'
),
);
},
),
)
)
)
);
await
tester
.
tap
(
find
.
text
(
'Tap me'
));
await
tester
.
pump
();
// Test custom clip behavior.
expect
(
getMenuBarMaterial
(
tester
).
clipBehavior
,
equals
(
Clip
.
antiAlias
));
});
testWidgets
(
'open and close works'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
MaterialApp
(
...
...
@@ -2057,7 +2118,7 @@ void main() {
'focusNode: null'
,
'menuStyle: MenuStyle#00000(backgroundColor: MaterialStatePropertyAll(MaterialColor(primary value: Color(0xff4caf50))), elevation: MaterialStatePropertyAll(20.0), shape: MaterialStatePropertyAll(RoundedRectangleBorder(BorderSide(width: 0.0, style: none), BorderRadius.zero)))'
,
'alignmentOffset: null'
,
'clipBehavior:
non
e'
,
'clipBehavior:
hardEdg
e'
,
],
),
);
...
...
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