This will ensure that the width of an empty Input is consistent with the
width of an Input that contains text.
Also add a unit test for the Input widget and a way for tests to provide mock
implementations of Mojo services such as the keyboard.
Also, introduce Colors and Typography to hold the material colors and the
typography declarations. Previously we expected clients of these libraries to
import them into a namespace, but that doesn't play nice with re-exporting them
from material.dart.
When we sync() a Component, we need to clear the old Component's _child
pointer, otherwise if we reuse that Component we'll get confused about
what the old child is.
We were not removing children if they were more recently synced than we
were. This makes no sense. We should remove all children unless they
were synced this very generation already (in which case they'll be
somewhere else in the tree by now).
This patch is part of a sequence of patches towards fewer top-level libraries.
In this patch, the gesture libraries are combined into one gestures.dart
library.
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.
If it's a StatefulComponent, then it's ok to reuse it so long as it
hasn't been initialised.
If it's a regular Component or a TagNode, then it's always ok to reuse.
If it's a RenderObjectWrapper, then it's ok to reuse so long as it
doesn't have a renderObject.
To put it another way, this changes how we prevent the following
nonsensical situations from arising:
- Sync two stateful StatefulComponents together
- Sync two RenderObjectWrappers with RenderObjects together
When either of those cases happen, we just drop the old one on the
ground and use the new one unchanged.
This patch start down the road of implementing text layout and painting without
the DOM. We can construct a basic paragraph consisting of a single run of text
and we can get through layout without crashing.
Dismissable now only depends on GestureDetector.
Added a unit test that verifies that issue #1068 has been fixed. It's commented out for now.
Cleaned up VelocityTracker.cc et al a little.
That way the fling engages in the same direction as the scroll. For example, if
you have a horizontal scroll nested inside a vertical scroll, the fling will
take place in the same direction as the scroll.
Allows a non-initialised stateful component to be used as a source of
settings more than once. Instead of asserting that it was only being
used once, we assert that once you are stateful you don't get used as a
bag of settings, which is the real thing we were trying to avoid.
A lot of code ends up using StatefulComponents as a source multiple
times in a row, and before this would fail.
Patch by Ian Hickson
Move the animation libraries into src/animation and change importers to use
package:sky/animation.dart. Also, move scheduler.dart into the animation
library so that the animation library can be self-contained.
This makes the sync code stop if it would have to rearrange the
RenderObjects. I'll make it handle the cross-RenderObject case, as well
as the insertion-sync case, in subsequent patches.
Turns out many of the functions on BoxConstraints weren't used or had callers
that could easily be updated to other functions. I've added dartdoc to all the
public functions as well as renamed some functions that had similar names but
did different things.
This patch makes Center and Align expand by default, which is usually what you
want. It also adds a ShrinkWrap option to let you shrink wrap in one or both
directions if that's really what you want to do.
Alternating scroll gestures would sometimes be ignored because _ScrollGestureRecognizer didn't always reset its _state when the pointer[s] went up.
A Dismissable dismiss triggered by a drag and then a fling could cause the next attempt to drag-dimiss to fail.
Fixed the definition of lerpColor().
This should handle a case like a stateful component inside a Container
inside another Container having one of those Containers removed while
still keeping that stateful component around with its state.
The problem of how to handle the Container then being reinserted is a
separate issue not handled by this patch.
Convert Dismissable to use gestures
Convert Dismissable to use the ScrollStart, ScrollUpdate, and ScrollEnd gestures. Support for fling gestures is TBD.
Included a basic unit test that checks that one item can be dismissed with a press-drag-release gesture.
Fixed the scroll gesture recognizer: if the last pointer goes up and candidate recognizers still exist, then reject the gesture.
Convert Dismissable to use the ScrollStart, ScrollUpdate, and ScrollEnd gestures. Support for fling gestures is TBD.
Included a basic unit test that checks that one item can be dismissed with a press-drag-release gesture.
Fixed the scroll gesture recognizer: if the last pointer goes up and candidate recognizers still exist, then reject the gesture.
This patch makes ParentDataNode less general purpose and instead teaches Flex
and Stack how to program the parent data for their children. We used to have
this general system because parent data used to carry CSS styling, but we don't
need it anymore.
Fixes#957
Adds a HomogeneousViewport class that works like MixedViewport but
handles only children that have all the same height.
Converts ScrollableWidgetList to use that, so that we don't waste a
frame looking at the size of the contents each time we change size.
This allows a number of seemingly pointless double-pumps in the tests
to be removed.
Other changes that were necessary to support the above:
- RenderBlock now supports minExtent (think 'min-height' in CSS)
- RenderBlock now supports itemExtent (forces the height of each
child to be the same, so that the itemExtent passed to the fixed-
height scrollables are all authoritative instead of a source of
bugs when they don't match)
- RenderBlockViewport now supports horizontal scrolling
- improved the style of the isInfinite assert in box.dart
- fixed the position of a comment in mixed_viewport.dart
- added a test
- made the logic for how many items to show be more precise
If there are no other gestures in the arena, we should kick off the scroll
gesture right away. This change pulled a refactoring of how we dispatch events
to Widgets. Now we dispatch events to Widgets interleaved with their associated
RenderObjects. (Previously we dispatched to all of the RenderObjects first.)
Add a way of having keys based on numeric types or DateTimes by having a ValueKey<T> class.
Remove the redundant ways of declaring things, except for leaving one shorthand -- you can say `new Key(s)` instead of `new ValueKey<String>(s)`.
Also, rename build_utils.dart to widget_tester.dart. These files are now named
for their most commonly used classes.
Finally, add a .analysis_options to silence the (intentional) analyzer warnings
in append_child_test.dart.
- add debugDescribeSettings to a few classes that were missing it
- fix some minor bugs in RenderShrinkWrapWidth and ShrinkWrapWidth
- introduce RenderShrinkWrapHeight and ShrinkWrapHeight
This lets clients listen for when a widget with a given global key goes through
a sync operation. We'll need this for mimic to track its mimicable when it
moves around the tree.
This patch adds a new test harness and a first, trivial test to run with the
harness. The new test harness is built on package:test and should run on
Travis. Over time, we'll migrate our existing tests into this harness.