mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
Disable reparent during sync
This feature is causing a bug because the widget tree isn't correctly synchronized with the render tree.
This commit is contained in:
parent
cbbdf8041a
commit
7d711b9ee0
@ -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;
|
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 _shouldLogRenderDuration = false; // see also 'enableProfilingLoop' argument to runApp()
|
||||||
|
final bool _shouldReparentDuringSync = false; // currently in development
|
||||||
|
|
||||||
typedef Widget Builder();
|
typedef Widget Builder();
|
||||||
typedef void WidgetTreeWalker(Widget);
|
typedef void WidgetTreeWalker(Widget);
|
||||||
@ -380,7 +381,7 @@ abstract class Widget {
|
|||||||
Widget candidate = oldNode.singleChild;
|
Widget candidate = oldNode.singleChild;
|
||||||
assert(candidate == null || candidate.parent == oldNode);
|
assert(candidate == null || candidate.parent == oldNode);
|
||||||
oldNode = null;
|
oldNode = null;
|
||||||
while (candidate != null) {
|
while (candidate != null && _shouldReparentDuringSync) {
|
||||||
if (_canSync(newNode, candidate)) {
|
if (_canSync(newNode, candidate)) {
|
||||||
assert(candidate.parent != null);
|
assert(candidate.parent != null);
|
||||||
assert(candidate.parent.singleChild == candidate);
|
assert(candidate.parent.singleChild == candidate);
|
||||||
|
@ -57,38 +57,39 @@ void main() {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test('remove one', () {
|
// Requires _shouldReparentDuringSync
|
||||||
|
// test('remove one', () {
|
||||||
WidgetTester tester = new WidgetTester();
|
//
|
||||||
|
// WidgetTester tester = new WidgetTester();
|
||||||
tester.pumpFrame(() {
|
//
|
||||||
return new Container(
|
// tester.pumpFrame(() {
|
||||||
child: new Container(
|
// return new Container(
|
||||||
child: new TestState(
|
// child: new Container(
|
||||||
state: 10,
|
// child: new TestState(
|
||||||
child: new Container()
|
// state: 10,
|
||||||
)
|
// child: new Container()
|
||||||
)
|
// )
|
||||||
);
|
// )
|
||||||
});
|
// );
|
||||||
|
// });
|
||||||
TestState stateWidget = tester.findWidget((widget) => widget is TestState);
|
//
|
||||||
|
// TestState stateWidget = tester.findWidget((widget) => widget is TestState);
|
||||||
expect(stateWidget.state, equals(10));
|
//
|
||||||
expect(stateWidget.syncs, equals(0));
|
// expect(stateWidget.state, equals(10));
|
||||||
|
// expect(stateWidget.syncs, equals(0));
|
||||||
tester.pumpFrame(() {
|
//
|
||||||
return new Container(
|
// tester.pumpFrame(() {
|
||||||
child: new TestState(
|
// return new Container(
|
||||||
state: 11,
|
// child: new TestState(
|
||||||
child: new Container()
|
// state: 11,
|
||||||
)
|
// child: new Container()
|
||||||
);
|
// )
|
||||||
});
|
// );
|
||||||
|
// });
|
||||||
expect(stateWidget.state, equals(10));
|
//
|
||||||
expect(stateWidget.syncs, equals(1));
|
// expect(stateWidget.state, equals(10));
|
||||||
|
// expect(stateWidget.syncs, equals(1));
|
||||||
});
|
//
|
||||||
|
// });
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user