Commit Graph

71 Commits

Author SHA1 Message Date
Hans Muller
1e18c38380 Uncomment the Dismissable unit test that checks for a #1068 fix 2015-09-11 10:44:38 -07:00
Hixie
5125bd5d0b Change how we decide if two nodes can sync.
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.
2015-09-11 10:26:36 -07:00
Hans Muller
639f9d9b06 Finish converting Dismissable from Listener to GestureDetector
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.
2015-09-11 09:37:55 -07:00
Adam Barth
63101e49bc Fold fling gesture into onDragEnd
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.
2015-09-10 12:38:11 -07:00
Adam Barth
2234294dd4 Remove "disqualified" concept
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
2015-09-09 17:17:03 -07:00
Adam Barth
6fc343a097 Remove package:sky/base
These files really belong on other libraries.
2015-09-08 10:59:07 -07:00
Adam Barth
25b8039958 Merge pull request #1076 from abarth/docs_animation
Introduce package:sky/animation.dart
2015-09-08 09:51:14 -07:00
Adam Barth
b356d14635 Introduce package:sky/animation.dart
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.
2015-09-08 09:44:01 -07:00
Hixie
0a37e06b4d Fix breakage caused by sync-across-removal patch.
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.
2015-09-08 09:28:08 -07:00
Adam Barth
95277953aa Document and bring sanity to BoxConstraints
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.
2015-09-05 11:33:02 -07:00
Adam Barth
48f600f85d Merge pull request #1071 from abarth/center_expand
Center and Align should expand by default
2015-09-04 16:21:07 -07:00
Adam Barth
5af85d9045 Center and Align should expand by default
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.
2015-09-04 16:11:58 -07:00
Hans Muller
18e512d3a2 Replace Scroll with Drag in names in GestureRecognizer et al 2015-09-04 16:02:30 -07:00
Hans Muller
e6d48ac5b9 Merge pull request #1066 from HansMuller/more-dismissable-unit-tests
Add Dismissable unit tests

Add coverage for the DismissDirection paramter.
2015-09-04 14:45:46 -07:00
Hans Muller
b02531a9c2 Add Dismissable unit tests 2015-09-04 14:31:03 -07:00
Hixie
6cac226fa6 Handle Widget instances being moved as-is to different parts of the tree. 2015-09-04 12:31:38 -07:00
Adam Barth
f5102d1137 Events should bubble up the tree
Previously we reversed the event path by mistake before dispatching events.
2015-09-03 18:20:38 -07:00
Hans Muller
952e73583f Fix minor problems in _ScrollGestureRecognizer, Dismissable
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().
2015-09-03 13:40:35 -07:00
Adam Barth
c2ee2db555 Merge pull request #1041 from abarth/overconstrainted_flex
RenderFlex should handle overconstrainted constraints
2015-09-03 11:27:12 -07:00
Adam Barth
7d711b9ee0 Disable reparent during sync
This feature is causing a bug because the widget tree isn't correctly
synchronized with the render tree.
2015-09-03 10:59:26 -07:00
Adam Barth
2473346fce RenderFlex should handle overconstrainted constraints
Rather than reading out the maxWidth, we should call constrainWidth to factor
in the minWidth, which might be bigger.
2015-09-03 10:35:40 -07:00
Hans Muller
ed8c1cb69e Enable dynamic changes to itemsWrap in PageableList 2015-09-02 16:00:53 -07:00
Hans Muller
a69a95df26 Restore PageableList itemsWrap:true
Makes PageableList with itemsWrap:true work again.

Plumbed the itemsWrap parameter through to HomogenousViewport.

Fixes issue #877.
2015-09-02 10:56:19 -07:00
Adam Barth
02ebc4fa67 Remove some unused dart:sky IDLs
This CL deletes a bunch of unused IDL files and removes some dead code in the
engine.
2015-09-02 00:09:43 -07:00
Hixie
aae2426000 Still try to sync even if a node has been removed from the tree.
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.
2015-09-01 13:32:28 -07:00
Hans Muller
9d1bb04a71 Merge pull request #974 from HansMuller/dismissable-uses-gestures
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.
2015-08-31 16:46:26 -07:00
Hans Muller
7a42fe3482 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.
2015-08-31 16:44:25 -07:00
Adam Barth
bd038cfc53 Merge pull request #972 from abarth/parent_data_madness
Positioned 'remembers' things it shouldn't
2015-08-31 16:41:36 -07:00
Adam Barth
64a784141e Positioned 'remembers' things it shouldn't
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
2015-08-31 16:41:14 -07:00
Hixie
820137b7f9 Remove the inner SizeObserver from ScrollableWidgetList.
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
2015-08-31 15:57:45 -07:00
Adam Barth
ffc6eaa9bd Add an origin parameter to transforms
This parameter makes it easier to do math when you don't want to center your
tranform at (0, 0).
2015-08-31 13:21:26 -07:00
Adam Barth
528ff0f117 onPressed not called when in a Positioned Flex
We were setting the main axis extent to zero because we had a sign error.

Fixes #918
2015-08-31 09:12:40 -07:00
Adam Barth
bef55951a5 Scrolls should start immediately when possible
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.)
2015-08-29 22:30:49 -07:00
Adam Barth
5feb77f69f Remove unused import to make analyzer happy 2015-08-28 20:50:54 -07:00
Adam Barth
b40864c9b7 Disambiguate horizontal and vertical scrolling
We now have separate gestures for horizontal, vertical, and pan scrolling.
2015-08-28 20:33:14 -07:00
Hixie
fc7943fe06 Test MixedViewport
add/remove/add smoketest
basic vertical behaviour
basic horizontal behaviour
2015-08-28 16:59:10 -07:00
Adam Barth
f4869c764b onScrollStart shouldn't have an offset
Instead, we pump a onScrollUpdate with the offset if there is an offset.
2015-08-28 15:07:30 -07:00
Adam Barth
81b3bdd414 Merge pull request #930 from abarth/scroll
Add scroll gestures and use them in Scrollable
2015-08-28 14:05:36 -07:00
Adam Barth
e99ff36283 Add scroll gestures and use them in Scrollable
This patch replaces the scroll gestures used by Scrollable with ones detected
by the ScrollGestureDetector.
2015-08-28 13:59:46 -07:00
Hixie
9047830c2e Rationalise the Key API.
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)`.
2015-08-28 13:17:34 -07:00
Adam Barth
dc84e882df Use GestureDetector in the framework and examples
We're now using it at the widget layer for everything except scrolling and
flinging.
2015-08-28 10:58:46 -07:00
Adam Barth
95e80663db Add tap, show press, and long press gestures and use tap in IconButton
These gestures use the new gesture detection system.
2015-08-28 10:21:35 -07:00
Adam Barth
01e7c6966e Fix analyzer warning 2015-08-27 22:59:24 -07:00
Adam Barth
d7e6f7b751 Merge pull request #908 from abarth/gesture_arena
Add GestureArena
2015-08-27 17:17:28 -07:00
Adam Barth
d8de2f9770 Add GestureArena
In the GestureArena, gestures will fight it out to see which is the real
ultimate gesture.
2015-08-27 17:17:12 -07:00
Eric Seidel
19766c05de Merge pull request #878 from eseidelGoogle/grid
Add basic Grid widget and test RenderGrid
2015-08-27 15:55:39 -07:00
Adam Barth
24d1e09b0d Add test for PointerRouter 2015-08-27 15:29:31 -07:00
Eric Seidel
b58f850e63 Add a Widget wrapper around Grid and test RenderGrid
@abarth
2015-08-27 14:52:19 -07:00
Eric Seidel
0d4b997008 Add a pageChanged callback to PageableList
Also includes changes to widget_tester sufficient to
test scrolling.

@abarth
2015-08-27 14:51:53 -07:00
Adam Barth
315577fc95 Scheduler should be able to cancel a queued callback
Previously, once a callback was in the execution queue, it couldn't be
canceled. Now we check whether the callback was canceled before executing it.
2015-08-27 10:51:01 -07:00