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
b628ff40
Commit
b628ff40
authored
Nov 13, 2015
by
Adam Barth
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #349 from abarth/reparent_data
Parent data not updated when reparenting using global keys
parents
f0825a82
35464f44
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
3 deletions
+54
-3
framework.dart
packages/flutter/lib/src/widgets/framework.dart
+3
-3
parent_data_test.dart
packages/unit/test/widget/parent_data_test.dart
+51
-0
No files found.
packages/flutter/lib/src/widgets/framework.dart
View file @
b628ff40
...
...
@@ -1275,9 +1275,6 @@ abstract class RenderObjectElement<T extends RenderObjectWidget> extends Buildab
super
.
mount
(
parent
,
newSlot
);
assert
(
_slot
==
newSlot
);
attachRenderObject
(
newSlot
);
ParentDataElement
parentDataElement
=
_findAncestorParentDataElement
();
if
(
parentDataElement
!=
null
)
updateParentData
(
parentDataElement
.
widget
);
_dirty
=
false
;
}
...
...
@@ -1491,6 +1488,9 @@ abstract class RenderObjectElement<T extends RenderObjectWidget> extends Buildab
_slot
=
newSlot
;
_ancestorRenderObjectElement
=
_findAncestorRenderObjectElement
();
_ancestorRenderObjectElement
?.
insertChildRenderObject
(
renderObject
,
newSlot
);
ParentDataElement
parentDataElement
=
_findAncestorParentDataElement
();
if
(
parentDataElement
!=
null
)
updateParentData
(
parentDataElement
.
widget
);
}
void
detachRenderObject
()
{
...
...
packages/unit/test/widget/parent_data_test.dart
View file @
b628ff40
...
...
@@ -284,4 +284,55 @@ void main() {
checkTree
(
tester
,
<
TestParentData
>[]);
});
});
test
(
'ParentDataWidget interacts with global keys'
,
()
{
testWidgets
((
WidgetTester
tester
)
{
GlobalKey
key
=
new
GlobalKey
();
tester
.
pumpWidget
(
new
Stack
(<
Widget
>[
new
Positioned
(
top:
10.0
,
left:
10.0
,
child:
new
DecoratedBox
(
key:
key
,
decoration:
kBoxDecorationA
)
)
])
);
checkTree
(
tester
,
<
TestParentData
>[
new
TestParentData
(
top:
10.0
,
left:
10.0
),
]);
tester
.
pumpWidget
(
new
Stack
(<
Widget
>[
new
Positioned
(
top:
10.0
,
left:
10.0
,
child:
new
DecoratedBox
(
decoration:
kBoxDecorationB
,
child:
new
DecoratedBox
(
key:
key
,
decoration:
kBoxDecorationA
)
)
)
])
);
checkTree
(
tester
,
<
TestParentData
>[
new
TestParentData
(
top:
10.0
,
left:
10.0
),
]);
tester
.
pumpWidget
(
new
Stack
(<
Widget
>[
new
Positioned
(
top:
10.0
,
left:
10.0
,
child:
new
DecoratedBox
(
key:
key
,
decoration:
kBoxDecorationA
)
)
])
);
checkTree
(
tester
,
<
TestParentData
>[
new
TestParentData
(
top:
10.0
,
left:
10.0
),
]);
});
});
}
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