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
8c1d9d76
Unverified
Commit
8c1d9d76
authored
Jan 26, 2022
by
Jonah Williams
Committed by
GitHub
Jan 26, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[framework] make HitTestEntry generic (#97175)
parent
f085e1a9
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
10 additions
and
14 deletions
+10
-14
hit_test.dart
packages/flutter/lib/src/gestures/hit_test.dart
+4
-3
box.dart
packages/flutter/lib/src/rendering/box.dart
+1
-4
mouse_tracker.dart
packages/flutter/lib/src/rendering/mouse_tracker.dart
+3
-2
sliver.dart
packages/flutter/lib/src/rendering/sliver.dart
+1
-4
mouse_tracker_test_utils.dart
...ages/flutter/test/rendering/mouse_tracker_test_utils.dart
+1
-1
No files found.
packages/flutter/lib/src/gestures/hit_test.dart
View file @
8c1d9d76
...
@@ -38,19 +38,20 @@ abstract class HitTestTarget {
...
@@ -38,19 +38,20 @@ abstract class HitTestTarget {
HitTestTarget
.
_
();
HitTestTarget
.
_
();
/// Override this method to receive events.
/// Override this method to receive events.
void
handleEvent
(
PointerEvent
event
,
HitTestEntry
entry
);
void
handleEvent
(
PointerEvent
event
,
HitTestEntry
<
HitTestTarget
>
entry
);
}
}
/// Data collected during a hit test about a specific [HitTestTarget].
/// Data collected during a hit test about a specific [HitTestTarget].
///
///
/// Subclass this object to pass additional information from the hit test phase
/// Subclass this object to pass additional information from the hit test phase
/// to the event propagation phase.
/// to the event propagation phase.
class
HitTestEntry
{
@optionalTypeArgs
class
HitTestEntry
<
T
extends
HitTestTarget
>
{
/// Creates a hit test entry.
/// Creates a hit test entry.
HitTestEntry
(
this
.
target
);
HitTestEntry
(
this
.
target
);
/// The [HitTestTarget] encountered during the hit test.
/// The [HitTestTarget] encountered during the hit test.
final
HitTestTarget
target
;
final
T
target
;
@override
@override
String
toString
()
=>
'
${describeIdentity(this)}
(
$target
)'
;
String
toString
()
=>
'
${describeIdentity(this)}
(
$target
)'
;
...
...
packages/flutter/lib/src/rendering/box.dart
View file @
8c1d9d76
...
@@ -886,7 +886,7 @@ class BoxHitTestResult extends HitTestResult {
...
@@ -886,7 +886,7 @@ class BoxHitTestResult extends HitTestResult {
}
}
/// A hit test entry used by [RenderBox].
/// A hit test entry used by [RenderBox].
class
BoxHitTestEntry
extends
HitTestEntry
{
class
BoxHitTestEntry
extends
HitTestEntry
<
RenderBox
>
{
/// Creates a box hit test entry.
/// Creates a box hit test entry.
///
///
/// The [localPosition] argument must not be null.
/// The [localPosition] argument must not be null.
...
@@ -894,9 +894,6 @@ class BoxHitTestEntry extends HitTestEntry {
...
@@ -894,9 +894,6 @@ class BoxHitTestEntry extends HitTestEntry {
:
assert
(
localPosition
!=
null
),
:
assert
(
localPosition
!=
null
),
super
(
target
);
super
(
target
);
@override
RenderBox
get
target
=>
super
.
target
as
RenderBox
;
/// The position of the hit test in the local coordinates of [target].
/// The position of the hit test in the local coordinates of [target].
final
Offset
localPosition
;
final
Offset
localPosition
;
...
...
packages/flutter/lib/src/rendering/mouse_tracker.dart
View file @
8c1d9d76
...
@@ -238,8 +238,9 @@ class MouseTracker extends ChangeNotifier {
...
@@ -238,8 +238,9 @@ class MouseTracker extends ChangeNotifier {
assert
(
result
!=
null
);
assert
(
result
!=
null
);
final
LinkedHashMap
<
MouseTrackerAnnotation
,
Matrix4
>
annotations
=
LinkedHashMap
<
MouseTrackerAnnotation
,
Matrix4
>();
final
LinkedHashMap
<
MouseTrackerAnnotation
,
Matrix4
>
annotations
=
LinkedHashMap
<
MouseTrackerAnnotation
,
Matrix4
>();
for
(
final
HitTestEntry
entry
in
result
.
path
)
{
for
(
final
HitTestEntry
entry
in
result
.
path
)
{
if
(
entry
.
target
is
MouseTrackerAnnotation
)
{
final
Object
target
=
entry
.
target
;
annotations
[
entry
.
target
as
MouseTrackerAnnotation
]
=
entry
.
transform
!;
if
(
target
is
MouseTrackerAnnotation
)
{
annotations
[
target
]
=
entry
.
transform
!;
}
}
}
}
return
annotations
;
return
annotations
;
...
...
packages/flutter/lib/src/rendering/sliver.dart
View file @
8c1d9d76
...
@@ -870,7 +870,7 @@ class SliverHitTestResult extends HitTestResult {
...
@@ -870,7 +870,7 @@ class SliverHitTestResult extends HitTestResult {
///
///
/// The coordinate system used by this hit test entry is relative to the
/// The coordinate system used by this hit test entry is relative to the
/// [AxisDirection] of the target sliver.
/// [AxisDirection] of the target sliver.
class
SliverHitTestEntry
extends
HitTestEntry
{
class
SliverHitTestEntry
extends
HitTestEntry
<
RenderSliver
>
{
/// Creates a sliver hit test entry.
/// Creates a sliver hit test entry.
///
///
/// The [mainAxisPosition] and [crossAxisPosition] arguments must not be null.
/// The [mainAxisPosition] and [crossAxisPosition] arguments must not be null.
...
@@ -882,9 +882,6 @@ class SliverHitTestEntry extends HitTestEntry {
...
@@ -882,9 +882,6 @@ class SliverHitTestEntry extends HitTestEntry {
assert
(
crossAxisPosition
!=
null
),
assert
(
crossAxisPosition
!=
null
),
super
(
target
);
super
(
target
);
@override
RenderSliver
get
target
=>
super
.
target
as
RenderSliver
;
/// The distance in the [AxisDirection] from the edge of the sliver's painted
/// The distance in the [AxisDirection] from the edge of the sliver's painted
/// area (as given by the [SliverConstraints.scrollOffset]) to the hit point.
/// area (as given by the [SliverConstraints.scrollOffset]) to the hit point.
/// This can be an unusual direction, for example in the [AxisDirection.up]
/// This can be an unusual direction, for example in the [AxisDirection.up]
...
...
packages/flutter/test/rendering/mouse_tracker_test_utils.dart
View file @
8c1d9d76
...
@@ -96,7 +96,7 @@ class TestAnnotationTarget with Diagnosticable implements MouseTrackerAnnotation
...
@@ -96,7 +96,7 @@ class TestAnnotationTarget with Diagnosticable implements MouseTrackerAnnotation
// A hit test entry that can be assigned with a [TestAnnotationTarget] and an
// A hit test entry that can be assigned with a [TestAnnotationTarget] and an
// optional transform matrix.
// optional transform matrix.
class
TestAnnotationEntry
extends
HitTestEntry
{
class
TestAnnotationEntry
extends
HitTestEntry
<
TestAnnotationTarget
>
{
TestAnnotationEntry
(
TestAnnotationTarget
target
,
[
Matrix4
?
transform
])
TestAnnotationEntry
(
TestAnnotationTarget
target
,
[
Matrix4
?
transform
])
:
transform
=
transform
??
Matrix4
.
identity
(),
super
(
target
);
:
transform
=
transform
??
Matrix4
.
identity
(),
super
(
target
);
...
...
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