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
d97f41ca
Unverified
Commit
d97f41ca
authored
Apr 30, 2021
by
Tong Mu
Committed by
GitHub
Apr 30, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "MouseRegion enter/exit event can be triggered with button pressed (#81148)" (#81557)
This reverts commit
ace61f01
.
parent
ce9aee66
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 addition
and
43 deletions
+1
-43
binding.dart
packages/flutter/lib/src/rendering/binding.dart
+1
-7
mouse_region_test.dart
packages/flutter/test/widgets/mouse_region_test.dart
+0
-36
No files found.
packages/flutter/lib/src/rendering/binding.dart
View file @
d97f41ca
...
...
@@ -282,13 +282,7 @@ mixin RendererBinding on BindingBase, ServicesBinding, SchedulerBinding, Gesture
event
is
PointerAddedEvent
||
event
is
PointerRemovedEvent
)
{
assert
(
event
.
position
!=
null
);
_mouseTracker
!.
updateWithEvent
(
event
,
// Mouse events(enter and exit) can be triggered with or without buttons pressed.
// If the button is pressed, we need to re-execute the hit test instead of
// reusing the cached results to trigger possible events.
()
=>
(
hitTestResult
==
null
||
event
.
down
)
?
renderView
.
hitTestMouseTrackers
(
event
.
position
)
:
hitTestResult
,
);
_mouseTracker
!.
updateWithEvent
(
event
,
()
=>
hitTestResult
??
renderView
.
hitTestMouseTrackers
(
event
.
position
));
}
super
.
dispatchEvent
(
event
,
hitTestResult
);
}
...
...
packages/flutter/test/widgets/mouse_region_test.dart
View file @
d97f41ca
...
...
@@ -76,42 +76,6 @@ class _HoverFeedbackState extends State<HoverFeedback> {
}
void
main
(
)
{
testWidgets
(
'onEnter and onExit can be triggered with mouse buttons pressed'
,
(
WidgetTester
tester
)
async
{
PointerEnterEvent
?
enter
;
PointerExitEvent
?
exit
;
await
tester
.
pumpWidget
(
Center
(
child:
MouseRegion
(
child:
Container
(
color:
const
Color
.
fromARGB
(
0xff
,
0xff
,
0x00
,
0x00
),
width:
100.0
,
height:
100.0
,
),
onEnter:
(
PointerEnterEvent
details
)
=>
enter
=
details
,
onExit:
(
PointerExitEvent
details
)
=>
exit
=
details
,
),
));
final
TestGesture
gesture
=
await
tester
.
createGesture
(
kind:
PointerDeviceKind
.
mouse
,
buttons:
kPrimaryMouseButton
);
await
gesture
.
addPointer
(
location:
Offset
.
zero
);
await
gesture
.
down
(
Offset
.
zero
);
// Press the mouse button.
addTearDown
(
gesture
.
removePointer
);
await
tester
.
pump
();
enter
=
null
;
exit
=
null
;
// Trigger the enter event.
await
gesture
.
moveTo
(
const
Offset
(
400.0
,
300.0
));
expect
(
enter
,
isNotNull
);
expect
(
enter
!.
position
,
equals
(
const
Offset
(
400.0
,
300.0
)));
expect
(
enter
!.
localPosition
,
equals
(
const
Offset
(
50.0
,
50.0
)));
expect
(
exit
,
isNull
);
// Trigger the exit event.
await
gesture
.
moveTo
(
const
Offset
(
1.0
,
1.0
));
expect
(
exit
,
isNotNull
);
expect
(
exit
!.
position
,
equals
(
const
Offset
(
1.0
,
1.0
)));
expect
(
exit
!.
localPosition
,
equals
(
const
Offset
(-
349.0
,
-
249.0
)));
});
testWidgets
(
'detects pointer enter'
,
(
WidgetTester
tester
)
async
{
PointerEnterEvent
?
enter
;
PointerHoverEvent
?
move
;
...
...
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