Commit 15e8f741 authored by Adam Barth's avatar Adam Barth

Properly track mimics that move in the tree

We weren't telling the new mimicable that we wanted to start mimicing it.
parent 4923f0cd
......@@ -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