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
80997a68
Commit
80997a68
authored
Sep 25, 2015
by
Adam Barth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a currentWidget and currentState accessor to GlobalKeys
parent
d717be94
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
+9
-5
framework.dart
packages/flutter/lib/src/fn3/framework.dart
+9
-5
No files found.
packages/flutter/lib/src/fn3/framework.dart
View file @
80997a68
...
...
@@ -92,6 +92,15 @@ abstract class GlobalKey extends Key {
}
}
Element
get
currentElement
=>
_registry
[
this
];
Widget
get
currentWidget
=>
currentElement
?.
widget
;
State
get
currentState
{
Element
element
=
currentElement
;
if
(
element
is
StatefulComponentElement
)
return
element
.
state
;
return
null
;
}
static
void
registerRemoveListener
(
GlobalKey
key
,
GlobalKeyRemoveListener
listener
)
{
assert
(
key
!=
null
);
Set
<
GlobalKeyRemoveListener
>
listeners
=
...
...
@@ -109,11 +118,6 @@ abstract class GlobalKey extends Key {
assert
(
removed
);
}
static
Element
getElement
(
GlobalKey
key
)
{
assert
(
key
!=
null
);
return
_registry
[
key
];
}
// TODO(ianh): call this
static
void
_notifyListeners
()
{
assert
(()
{
...
...
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