Commit 7f0f22ab authored by Adam Barth's avatar Adam Barth

Merge pull request #831 from abarth/track_mimic

Properly track mimics that move in the tree
parents a2286ee7 15e8f741
......@@ -75,10 +75,7 @@ class Mimic extends GlobalKeyWatcher {
void didUnmount() {
super.didUnmount();
if (_mimicable != null) {
_mimicable.stopMimic();
_mimicable = null;
}
_stopMimic();
}
void didSyncWatchedKey(GlobalKey key, Widget widget) {
......@@ -91,9 +88,18 @@ class Mimic extends GlobalKeyWatcher {
_setMimicable(null);
}
void _stopMimic() {
if (_mimicable != null) {
_mimicable.stopMimic();
_mimicable = null;
}
}
void _setMimicable(widget) {
if (_mimicable == null && widget != null)
if (_mimicable != widget) {
_stopMimic();
widget.startMimic();
}
setState(() {
_mimicable = widget;
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment