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
0d221dc2
Unverified
Commit
0d221dc2
authored
Jan 18, 2022
by
chunhtai
Committed by
GitHub
Jan 18, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up mouse region code (#96636)
* Clean up mouse region code * remove even more code
parent
f12c83ea
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
53 deletions
+21
-53
basic.dart
packages/flutter/lib/src/widgets/basic.dart
+21
-53
No files found.
packages/flutter/lib/src/widgets/basic.dart
View file @
0d221dc2
...
@@ -6185,7 +6185,7 @@ class Listener extends SingleChildRenderObjectWidget {
...
@@ -6185,7 +6185,7 @@ class Listener extends SingleChildRenderObjectWidget {
///
///
/// * [Listener], a similar widget that tracks pointer events when the pointer
/// * [Listener], a similar widget that tracks pointer events when the pointer
/// has buttons pressed.
/// has buttons pressed.
class
MouseRegion
extends
S
tateful
Widget
{
class
MouseRegion
extends
S
ingleChildRenderObject
Widget
{
/// Creates a widget that forwards mouse events to callbacks.
/// Creates a widget that forwards mouse events to callbacks.
///
///
/// By default, all callbacks are empty, [cursor] is [MouseCursor.defer], and
/// By default, all callbacks are empty, [cursor] is [MouseCursor.defer], and
...
@@ -6197,10 +6197,10 @@ class MouseRegion extends StatefulWidget {
...
@@ -6197,10 +6197,10 @@ class MouseRegion extends StatefulWidget {
this
.
onHover
,
this
.
onHover
,
this
.
cursor
=
MouseCursor
.
defer
,
this
.
cursor
=
MouseCursor
.
defer
,
this
.
opaque
=
true
,
this
.
opaque
=
true
,
this
.
child
,
Widget
?
child
,
})
:
assert
(
cursor
!=
null
),
})
:
assert
(
cursor
!=
null
),
assert
(
opaque
!=
null
),
assert
(
opaque
!=
null
),
super
(
key:
key
);
super
(
key:
key
,
child:
child
);
/// Triggered when a mouse pointer has entered this widget.
/// Triggered when a mouse pointer has entered this widget.
///
///
...
@@ -6347,13 +6347,26 @@ class MouseRegion extends StatefulWidget {
...
@@ -6347,13 +6347,26 @@ class MouseRegion extends StatefulWidget {
/// This defaults to true.
/// This defaults to true.
final
bool
opaque
;
final
bool
opaque
;
/// The widget below this widget in the tree.
@override
///
RenderMouseRegion
createRenderObject
(
BuildContext
context
)
{
/// {@macro flutter.widgets.ProxyWidget.child}
return
RenderMouseRegion
(
final
Widget
?
child
;
onEnter:
onEnter
,
onHover:
onHover
,
onExit:
onExit
,
cursor:
cursor
,
opaque:
opaque
,
);
}
@override
@override
State
<
MouseRegion
>
createState
()
=>
_MouseRegionState
();
void
updateRenderObject
(
BuildContext
context
,
RenderMouseRegion
renderObject
)
{
renderObject
..
onEnter
=
onEnter
..
onHover
=
onHover
..
onExit
=
onExit
..
cursor
=
cursor
..
opaque
=
opaque
;
}
@override
@override
void
debugFillProperties
(
DiagnosticPropertiesBuilder
properties
)
{
void
debugFillProperties
(
DiagnosticPropertiesBuilder
properties
)
{
...
@@ -6371,51 +6384,6 @@ class MouseRegion extends StatefulWidget {
...
@@ -6371,51 +6384,6 @@ class MouseRegion extends StatefulWidget {
}
}
}
}
class
_MouseRegionState
extends
State
<
MouseRegion
>
{
void
handleExit
(
PointerExitEvent
event
)
{
if
(
widget
.
onExit
!=
null
&&
mounted
)
widget
.
onExit
!(
event
);
}
PointerExitEventListener
?
getHandleExit
()
{
return
widget
.
onExit
==
null
?
null
:
handleExit
;
}
@override
Widget
build
(
BuildContext
context
)
{
return
_RawMouseRegion
(
this
);
}
}
class
_RawMouseRegion
extends
SingleChildRenderObjectWidget
{
_RawMouseRegion
(
this
.
owner
)
:
super
(
child:
owner
.
widget
.
child
);
final
_MouseRegionState
owner
;
@override
RenderMouseRegion
createRenderObject
(
BuildContext
context
)
{
final
MouseRegion
widget
=
owner
.
widget
;
return
RenderMouseRegion
(
onEnter:
widget
.
onEnter
,
onHover:
widget
.
onHover
,
onExit:
owner
.
getHandleExit
(),
cursor:
widget
.
cursor
,
opaque:
widget
.
opaque
,
);
}
@override
void
updateRenderObject
(
BuildContext
context
,
RenderMouseRegion
renderObject
)
{
final
MouseRegion
widget
=
owner
.
widget
;
renderObject
..
onEnter
=
widget
.
onEnter
..
onHover
=
widget
.
onHover
..
onExit
=
owner
.
getHandleExit
()
..
cursor
=
widget
.
cursor
..
opaque
=
widget
.
opaque
;
}
}
/// A widget that creates a separate display list for its child.
/// A widget that creates a separate display list for its child.
///
///
/// This widget creates a separate display list for its child, which
/// This widget creates a separate display list for its child, which
...
...
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