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
671b2bfe
Commit
671b2bfe
authored
Sep 03, 2015
by
Adam Barth
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1044 from abarth/disable_reparent_during_sync
Disable reparent during sync
parents
2b25c33b
7d711b9e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
34 deletions
+36
-34
framework.dart
packages/flutter/lib/src/widgets/framework.dart
+2
-1
syncing_test.dart
packages/unit/test/widget/syncing_test.dart
+34
-33
No files found.
packages/flutter/lib/src/widgets/framework.dart
View file @
671b2bfe
...
...
@@ -19,6 +19,7 @@ export 'package:sky/src/rendering/box.dart' show BoxConstraints, BoxDecoration,
export
'package:sky/src/rendering/object.dart'
show
Point
,
Offset
,
Size
,
Rect
,
Color
,
Paint
,
Path
;
final
bool
_shouldLogRenderDuration
=
false
;
// see also 'enableProfilingLoop' argument to runApp()
final
bool
_shouldReparentDuringSync
=
false
;
// currently in development
typedef
Widget
Builder
(
);
typedef
void
WidgetTreeWalker
(
Widget
);
...
...
@@ -380,7 +381,7 @@ abstract class Widget {
Widget
candidate
=
oldNode
.
singleChild
;
assert
(
candidate
==
null
||
candidate
.
parent
==
oldNode
);
oldNode
=
null
;
while
(
candidate
!=
null
)
{
while
(
candidate
!=
null
&&
_shouldReparentDuringSync
)
{
if
(
_canSync
(
newNode
,
candidate
))
{
assert
(
candidate
.
parent
!=
null
);
assert
(
candidate
.
parent
.
singleChild
==
candidate
);
...
...
packages/unit/test/widget/syncing_test.dart
View file @
671b2bfe
...
...
@@ -57,38 +57,39 @@ void main() {
});
test
(
'remove one'
,
()
{
WidgetTester
tester
=
new
WidgetTester
();
tester
.
pumpFrame
(()
{
return
new
Container
(
child:
new
Container
(
child:
new
TestState
(
state:
10
,
child:
new
Container
()
)
)
);
});
TestState
stateWidget
=
tester
.
findWidget
((
widget
)
=>
widget
is
TestState
);
expect
(
stateWidget
.
state
,
equals
(
10
));
expect
(
stateWidget
.
syncs
,
equals
(
0
));
tester
.
pumpFrame
(()
{
return
new
Container
(
child:
new
TestState
(
state:
11
,
child:
new
Container
()
)
);
});
expect
(
stateWidget
.
state
,
equals
(
10
));
expect
(
stateWidget
.
syncs
,
equals
(
1
));
});
// Requires _shouldReparentDuringSync
// test('remove one', () {
//
// WidgetTester tester = new WidgetTester();
//
// tester.pumpFrame(() {
// return new Container(
// child: new Container(
// child: new TestState(
// state: 10,
// child: new Container()
// )
// )
// );
// });
//
// TestState stateWidget = tester.findWidget((widget) => widget is TestState);
//
// expect(stateWidget.state, equals(10));
// expect(stateWidget.syncs, equals(0));
//
// tester.pumpFrame(() {
// return new Container(
// child: new TestState(
// state: 11,
// child: new Container()
// )
// );
// });
//
// expect(stateWidget.state, equals(10));
// expect(stateWidget.syncs, equals(1));
//
// });
}
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