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
e02462a4
Unverified
Commit
e02462a4
authored
Jun 03, 2022
by
Taha Tesser
Committed by
GitHub
Jun 03, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
`CheckedPopupMenuItem`: Fix cursor bug and add cursor parameter (#103474)
parent
a27fcf1a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
89 additions
and
7 deletions
+89
-7
popup_menu.dart
packages/flutter/lib/src/material/popup_menu.dart
+9
-6
popup_menu_test.dart
packages/flutter/test/material/popup_menu_test.dart
+80
-1
No files found.
packages/flutter/lib/src/material/popup_menu.dart
View file @
e02462a4
...
...
@@ -461,6 +461,7 @@ class CheckedPopupMenuItem<T> extends PopupMenuItem<T> {
super
.
enabled
,
super
.
padding
,
super
.
height
,
super
.
mouseCursor
,
super
.
child
,
})
:
assert
(
checked
!=
null
);
...
...
@@ -514,13 +515,15 @@ class _CheckedPopupMenuItemState<T> extends PopupMenuItemState<T, CheckedPopupMe
@override
Widget
buildChild
()
{
return
ListTile
(
return
IgnorePointer
(
child:
ListTile
(
enabled:
widget
.
enabled
,
leading:
FadeTransition
(
opacity:
_opacity
,
child:
Icon
(
_controller
.
isDismissed
?
null
:
Icons
.
done
),
),
title:
widget
.
child
,
),
);
}
}
...
...
packages/flutter/test/material/popup_menu_test.dart
View file @
e02462a4
...
...
@@ -1620,7 +1620,6 @@ void main() {
);
});
testWidgets
(
'CheckedPopupMenuItem custom padding'
,
(
WidgetTester
tester
)
async
{
final
Key
popupMenuButtonKey
=
UniqueKey
();
final
Type
menuItemType
=
const
CheckedPopupMenuItem
<
String
>(
child:
Text
(
'item'
)).
runtimeType
;
...
...
@@ -2092,6 +2091,86 @@ void main() {
expect
(
RendererBinding
.
instance
.
mouseTracker
.
debugDeviceActiveCursor
(
1
),
SystemMouseCursors
.
basic
);
});
testWidgets
(
'CheckedPopupMenuItem changes mouse cursor when hovered'
,
(
WidgetTester
tester
)
async
{
const
Key
key
=
ValueKey
<
int
>(
1
);
// Test CheckedPopupMenuItem() constructor
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Scaffold
(
body:
Align
(
alignment:
Alignment
.
topLeft
,
child:
Material
(
child:
MouseRegion
(
cursor:
SystemMouseCursors
.
forbidden
,
child:
CheckedPopupMenuItem
<
int
>(
key:
key
,
mouseCursor:
SystemMouseCursors
.
text
,
value:
1
,
child:
Container
(),
),
),
),
),
),
),
);
final
TestGesture
gesture
=
await
tester
.
createGesture
(
kind:
PointerDeviceKind
.
mouse
,
pointer:
1
);
await
gesture
.
addPointer
(
location:
tester
.
getCenter
(
find
.
byKey
(
key
)));
addTearDown
(
gesture
.
removePointer
);
await
tester
.
pump
();
expect
(
RendererBinding
.
instance
.
mouseTracker
.
debugDeviceActiveCursor
(
1
),
SystemMouseCursors
.
text
);
// Test default cursor
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Scaffold
(
body:
Align
(
alignment:
Alignment
.
topLeft
,
child:
Material
(
child:
MouseRegion
(
cursor:
SystemMouseCursors
.
forbidden
,
child:
CheckedPopupMenuItem
<
int
>(
key:
key
,
value:
1
,
child:
Container
(),
),
),
),
),
),
),
);
expect
(
RendererBinding
.
instance
.
mouseTracker
.
debugDeviceActiveCursor
(
1
),
SystemMouseCursors
.
click
);
// Test default cursor when disabled
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Scaffold
(
body:
Align
(
alignment:
Alignment
.
topLeft
,
child:
Material
(
child:
MouseRegion
(
cursor:
SystemMouseCursors
.
forbidden
,
child:
CheckedPopupMenuItem
<
int
>(
key:
key
,
value:
1
,
enabled:
false
,
child:
Container
(),
),
),
),
),
),
),
);
expect
(
RendererBinding
.
instance
.
mouseTracker
.
debugDeviceActiveCursor
(
1
),
SystemMouseCursors
.
basic
);
});
testWidgets
(
'PopupMenu in AppBar does not overlap with the status bar'
,
(
WidgetTester
tester
)
async
{
const
List
<
PopupMenuItem
<
int
>>
choices
=
<
PopupMenuItem
<
int
>>[
PopupMenuItem
<
int
>(
value:
1
,
child:
Text
(
'Item 1'
)),
...
...
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