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
0fbc95df
Unverified
Commit
0fbc95df
authored
Oct 07, 2020
by
Tong Mu
Committed by
GitHub
Oct 07, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove the extra wrapping of `Listener` (#67340)
parent
76cbc462
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
50 deletions
+2
-50
basic.dart
packages/flutter/lib/src/widgets/basic.dart
+2
-49
debug_test.dart
packages/flutter/test/material/debug_test.dart
+0
-1
No files found.
packages/flutter/lib/src/widgets/basic.dart
View file @
0fbc95df
...
...
@@ -5804,7 +5804,7 @@ class WidgetToRenderBoxAdapter extends LeafRenderObjectWidget {
/// }
/// ```
/// {@end-tool}
class
Listener
extends
S
tateless
Widget
{
class
Listener
extends
S
ingleChildRenderObject
Widget
{
/// Creates a widget that forwards point events to callbacks.
///
/// The [behavior] argument defaults to [HitTestBehavior.deferToChild].
...
...
@@ -5819,8 +5819,7 @@ class Listener extends StatelessWidget {
this
.
behavior
=
HitTestBehavior
.
deferToChild
,
Widget
?
child
,
})
:
assert
(
behavior
!=
null
),
_child
=
child
,
super
(
key:
key
);
super
(
key:
key
,
child:
child
);
/// Called when a pointer comes into contact with the screen (for touch
/// pointers), or has its button pressed (for mouse pointers) at this widget's
...
...
@@ -5856,52 +5855,6 @@ class Listener extends StatelessWidget {
/// How to behave during hit testing.
final
HitTestBehavior
behavior
;
// The widget listened to by the listener.
//
// The reason why we don't expose it is that once the deprecated methods are
// removed, Listener will no longer need to store the child, but will pass
// the child to `super` instead.
final
Widget
?
_child
;
@override
Widget
build
(
BuildContext
context
)
{
// TODO(dkwingsmt): Remove the extra wrapper, and make `Listener` a
// StatelessWidget. https://github.com/flutter/flutter/issues/65586
return
_PointerListener
(
onPointerDown:
onPointerDown
,
onPointerUp:
onPointerUp
,
onPointerMove:
onPointerMove
,
onPointerHover:
onPointerHover
,
onPointerCancel:
onPointerCancel
,
onPointerSignal:
onPointerSignal
,
behavior:
behavior
,
child:
_child
,
);
}
}
class
_PointerListener
extends
SingleChildRenderObjectWidget
{
const
_PointerListener
({
Key
?
key
,
this
.
onPointerDown
,
this
.
onPointerMove
,
this
.
onPointerUp
,
this
.
onPointerHover
,
this
.
onPointerCancel
,
this
.
onPointerSignal
,
this
.
behavior
=
HitTestBehavior
.
deferToChild
,
Widget
?
child
,
})
:
assert
(
behavior
!=
null
),
super
(
key:
key
,
child:
child
);
final
PointerDownEventListener
?
onPointerDown
;
final
PointerMoveEventListener
?
onPointerMove
;
final
PointerUpEventListener
?
onPointerUp
;
final
PointerHoverEventListener
?
onPointerHover
;
final
PointerCancelEventListener
?
onPointerCancel
;
final
PointerSignalEventListener
?
onPointerSignal
;
final
HitTestBehavior
behavior
;
@override
RenderPointerListener
createRenderObject
(
BuildContext
context
)
{
return
RenderPointerListener
(
...
...
packages/flutter/test/material/debug_test.dart
View file @
0fbc95df
...
...
@@ -157,7 +157,6 @@ void main() {
' Semantics
\n
'
' FocusScope
\n
'
' AbsorbPointer
\n
'
' _PointerListener
\n
'
' Listener
\n
'
' HeroControllerScope
\n
'
' Navigator-[GlobalObjectKey<NavigatorState> _WidgetsAppState#00000]
\n
'
...
...
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