Move _activeCardDragEndPoint near build() so it's more obvious that it
is part of the build state.
Make a couple of functions use setState() since they modify variables
that are used by build().
Add a more detailed comment to the empty setState() call, since those
are dubious in general and need explaining when they occur, lest people
start using them as magic incantations to Make Things Work.
If a StatefulComponent marks itself dirty, gets rebuilt, then its parent
gets rebuilt, its parent will find that its child is from a newer
generation and hasn't changed. Previously, we considered two stateful
nodes to not be syncable even if they were the same; combined with the
way the "old" node looks like it's been put elsewhere (since it's
already been synced), we end up confused as to why the new node is
already mounted.
This fixes the problem by making the canSync logic consider two
identical nodes as syncable (since they are; syncChild() short-circuits
that case), and by changing syncChildren to consider identical nodes as
matches even if they are already synced.
This specifically improves the reporting of exceptions in syncChild(),
and makes the way we've been adding information to toStringName() less
ad-hoc and easier to extend.
Also:
- don't mark a node as from the new generation if it is dirty, since we
know it still has to be built.
- establish the rule that you can't call setState() during initState()
or build().
- make syncChild() return early for unchanged children.
- update the tests, including adding a new one.
Surface all the constructor arguments of AnimationTiming in all its subclasses.
Remove some pointless casts.
Fix some typos.
Put constructors first in class declarations.
Remove some blank lines where they just confused the structure of the code.
- Add documentation for AnimationTiming.
- typo: defaules -> defaults.
- added type information to isWatching() signature.
- made Widget.toStringName() include more useful information.
- cleaned up StatefulComponent._sync(): more specific signature, change
redundant if to else, remove redundant cast.
- change order of TransitionBase arguments for consistency.
- prevent TransitionBase from affecting the performance in its
constructor when it didn't create it (but see #1103).
- remove TODO() from @mpcomplete... no, there is not currently a better
way to inherit a constructor, unfortunately.