Commit Graph

249 Commits

Author SHA1 Message Date
Adam Barth
fbd5460b04 Integrate WidgetTester with FakeAsync
Fixes #1084
2015-10-01 10:56:58 -07:00
Adam Barth
45c906d2ad Make fn3 the default widget framework 2015-10-01 09:48:35 -07:00
Adam Barth
4525159831 Consolidate widget tests
Now that we've ported all the widget tests to fn3, we don't need a separate fn3
directory.
2015-09-30 18:58:17 -07:00
Hans Muller
c06995a379 Clamp the snapped scroll simulation; Scrollable settle() and fling() return a Future 2015-09-30 16:52:17 -07:00
Adam Barth
946da1015a Merge pull request #1411 from abarth/port_input_test
Port input_test to fn3
2015-09-30 16:00:52 -07:00
Adam Barth
f4afd0d9d2 Merge pull request #1418 from abarth/dimissable_test
Port dimissable_test.dart to fn3
2015-09-30 15:18:19 -07:00
Adam Barth
d4b1519cef Port dimissable_test.dart to fn3 2015-09-30 15:03:32 -07:00
Hans Muller
4ac052357f Snap scrolling: additional tests, cleanup 2015-09-30 14:13:11 -07:00
Adam Barth
11e7dfbe79 Port input_test to fn3 2015-09-30 13:25:46 -07:00
Adam Barth
347bd25cb4 Remove BuildContext argument to initState
This argument isn't needed anymore now that State has a getter for context.
2015-09-30 13:15:46 -07:00
Adam Barth
84f2b5a5b0 Merge pull request #1397 from jason-simmons/editable_text_unused_import_sky
Fix a couple of analyzer warnings
2015-09-29 19:42:43 -07:00
Hixie
a91dd07cb3 Draggable
Introduce a Draggable class that wraps all the logic of dragging
something and dropping it on a DragTarget.

Update examples/widgets/drag_and_drop.dart accordingly.

Make the performance/transition part of routes optional.
2015-09-29 18:00:40 -07:00
Hixie
f103d397d6 Make hit testing work in horizontal scrolling list
Previously, hitTestChildren in RenderBlockViewport just didn't support
horizontal scrolling, due to an oversight.
2015-09-29 16:30:18 -07:00
Hans Muller
9b6590890a Land snap_scrolling_test.dart 2015-09-29 15:28:42 -07:00
Jason Simmons
571c7dd9ff Fix a couple of analyzer warnings
* Unused import in editable_text.dart
* Type mismatch in append_child_test.dart
2015-09-29 14:04:47 -07:00
Hans Muller
7385641f6d SnapOffsets for fling Scrolling
Initial snap offset support for ScrollableWidgetList (and ScrollableList<T>) and ScrollableMixedWidgetList. If a ```toSnapOffset(scrollOffset)``` function is provided, fling Scrolls will coast to the returned value. If ```alignmentOffset``` is specified then fling scrolls conclude when toSnapOffset's value lines up with the Scrollable widget's origin + alignmentOffset. For example if the Scrollable widget's height was 200.0, and alignmentOffset:100.0 was specified, then fling scrolls would end with the value returned by toSnapOffset() lined up with the center of the Scrollable.

This approach to Scrollable snapping assumes that the layout of whatever the Scrollable contains is known at the outset. This is often true however a ScrollableMixedWidgetList may not know its items' sizes until they've been reached by scrolling.

This is a first cut at snapping support. Among the things that remain to be done:
- Scrolling limits trump snapping. Snapping should probably trump scrolling limits.
- Drag scrolls aren't snapped. This may be desirable so perhaps the feature should be controlled with a flag.
- Specifying alignmentOffset as a percentage would probably be more convenient.
- It would be nice if one could wrap items in a SnapOffset value like: ```new SnapOffset(0.5, child: myItem)``` to snap to the center of the item.

Updated the CardCollection example: snapping and fixed size items can be turned on/off with Drawer checkboxes.
2015-09-29 11:09:59 -07:00
Adam Barth
64dfb8496c Actually notify GlobalKey listeners in fn3
This patch makes a number of changes:

1) buildDirtyComponents now prevents all calls to setState, not just those
   higher in the tree. This change is necessary for consistency with
   MixedViewport and HomogeneousViewport because those widgets already build
   subwidgets with that restriction. If the "normal" build didn't enforce that
   rule, then some widgets would break when put inside a mixed or homogeneous
   viewport.

2) We now notify global key listeners in a microtask after beginFrame. That
   means setState is legal in these callbacks and that we'll produce another
   frame if someone calls setState in such a callback.
2015-09-27 17:22:48 -07:00
Adam Barth
a74d02dadf Rename Sky to Flutter in a few more places 2015-09-26 12:46:03 -07:00
Hixie
0a0a92eb45 Port stocks to fn3 and introduce an App component. 2015-09-25 17:52:33 -07:00
Adam Barth
4ad83fa059 Port some more tests to fn3 2015-09-25 11:27:48 -07:00
Adam Barth
7d02880cf4 Port some more tests to fn3 2015-09-25 10:51:56 -07:00
Adam Barth
06ffa75919 Convert some tests to fn3 2015-09-25 09:29:04 -07:00
Hixie
c3b3b71bed Rename ComponentState and use initState().
ComponentState becomes State, for brevity.
Instead of overriding its constructor, override initState().
This makes writing States much simpler.
2015-09-24 16:00:51 -07:00
Hixie
b948967855 fn3: MixedViewport
Also:
- Expose the slot of each Element.
- Minor improvements to HomogeneousViewport.
- Replace TestComponent with FlipComponent in tests.
2015-09-24 14:52:13 -07:00
Adam Barth
0d63d6b775 Port most of scrollable.dart to fn3 2015-09-24 10:26:27 -07:00
James Robinson
e854d7457d Update to Mojo 4e4d51ce28a8edcb32b9c7f555e38e2ae84a825e, update deps
This updates to mojo 4e4d51ce28a and mojo sdk 711a0bcfb141b4 and updates the sky
package's pubspec.yaml dependency to '>=0.1.0 <0.2.0' to be compatible with
the current mojo package. This includes an update to the Mojo Dart generator to
produce real classes for enums and the corresponding updates for users of the
KeyboardType enum in Sky as well as one scoped_ptr->std::unique_ptr in shell
corresponding to a change in the Mojo EDK.

When a new version of the sky and sky_services package are pushed this will fix
domokit/mojo#440.
2015-09-23 17:26:46 -07:00
Hixie
ea45169083 fn3: Port HomogeneousViewport 2015-09-23 16:21:13 -07:00
Hixie
6ea86b6a2f fn3: Listener
In this new world, Listener is just a wrapper around a node in the
render tree that hooks directly into the event handling logic.
2015-09-23 11:22:51 -07:00
Hixie
b3ebd4406b Expose _descendantRenderObject as 'renderer'
This allows people to use localToGlobal and company.
2015-09-23 11:13:45 -07:00
Adam Barth
fa119c38b9 Add tests for ParentData 2015-09-23 10:59:49 -07:00
Hixie
2a5fad937b fn3: Minor cleanup
- Remove the unique objects used as slots since we decided 'null' was
  fine after all
- Rename 'slot' to 'newSlot' when it's used as an argument to change the
  _slot field, to clarify which variable has the newer value
- Remove the RenderObject registry since we'll do listeners a different
  way. This also removes handleEvent for the same reason.
- Remove the TODOs for mount/unmount becoming didMount/didUnmount since
  the methods do in fact do the mounting/unmounting.
2015-09-23 09:24:13 -07:00
Hixie
555138e60e fn3: Binding to RenderView
In the old world, we had two ways to bind a Widget tree to a
RenderObject node, one way for RenderView and one mostly untested way
for other cases (it's only tested by the spinning_mixed.dart demo). For
fn3, I made these the same code path.

This patch also introduces GlobalKey, though the GlobalKey logic isn't
hooked in yet.

This is Hello World in the new world:

```dart
import 'package:sky/src/fn3.dart';

void main() {
  runApp(new Text('Hello World!'));
}
```
2015-09-23 09:12:01 -07:00
Adam Barth
8b162b5950 Add tests for MultiChildRenderWidget 2015-09-23 08:52:15 -07:00
Adam Barth
fb4a87ad68 Add ParentDataWidget and InheritedWidget to fn3 2015-09-22 16:07:27 -07:00
Hixie
b73b06e4ad fn3: Add a binding for fn3 and sky.
- I extracted the BuildScheduler into a separate binding.dart file.
- Various changes to expose private members that are needed by
  binding.dart.
- Registering the render objects for event dispatch.
- Convert the tests to use the new binding mechanism.

This doesn't yet have a RenderView or event handling.
2015-09-22 12:30:37 -07:00
Hixie
59f7e7f08e Fix scrolling of Block.
Since our build function depends on scrollBehavior.isScrollable, any
time we update scrollBehavior we are implicitly updating our state. As
such, we must do so during a setState() call, or else we won't rebuild
and might not bother to listen to the scroll gestures.

This probably broke when we made Block not listen to gestures if it
wasn't overflowing.
2015-09-22 10:36:34 -07:00
Jason Simmons
963fb41334 Merge pull request #1245 from jason-simmons/editable_text_initial_blink
Ensure that EditableText always shows a cursor
2015-09-22 09:29:52 -07:00
Jason Simmons
9b84e6b8e9 Merge pull request #1255 from jason-simmons/skyanalyzer_pub_cache
Some cleanup of the Sky analyzer script
2015-09-22 09:29:27 -07:00
Hixie
ba41fd3538 More dartdoc for fn3, and sundry changes.
- move _uniqueChild earlier since a comment now mentions it earlier.
- reorder methods in Element to more closely reflect call order.
- change mount to be the place that sets the parent pointer, for consistency.
- make the lifecycleState a purely debug-time thing for consistency.
- make BuildableElement.unmount set dirty to false so that we won't
  build unmounted objects.
- rename "updated" to "newWidget" for clarity.
- change how we unmount things so that the slot is reset up to a
  RenderObjectElement, but not further, and don't reset the depth.
2015-09-21 17:44:15 -07:00
Adam Barth
12097bdde0 Remove uses of sky.GestureEvent 2015-09-21 17:05:45 -07:00
Adam Barth
051354ae1d Remove EventDisposition
All the use cases for EventDisposition are now addressed by the gesture
detection system.
2015-09-21 16:45:09 -07:00
Hixie
205335f0f0 Fix fn3 build errors
Add a LeafRenderObjectElement, fix a test to use the new contract.
2015-09-21 15:45:49 -07:00
Hixie
547c324d4b fn3 review
- adds dartdocs
- replaces config setter with didUpdateConfig() so that you can't replace
the config outside of the system
- renames didUnmount() with destroy().
- rename Component to StatelessComponent, ComponentConfiguration to
StatefulComponent
- move debug dump to end of file
- renamed _holder to _element
2015-09-21 15:42:18 -07:00
Adam Barth
d27f3d5251 Merge pull request #1259 from abarth/fn3_rebuild
fn3 shouldn't rebuild components that don't change identity
2015-09-21 15:05:14 -07:00
Collin Jackson
746134a3c9 Merge pull request #1214 from collinjackson/scale_tests
add a test for scale gestures
2015-09-21 14:47:50 -07:00
Jason Simmons
64f75399ef Some cleanup of the Sky analyzer script
* If no source path is provided, then run the analyzer on the Sky unit tests
* Fix the filter for errors found in pub cache packages
* Generalize the filter for the analyzer's "xx errors/warnings/hints found" status message

Also fix a test that caused a warning in the analyzer.
2015-09-21 14:14:30 -07:00
Jason Simmons
58b421aaf4 Ensure that EditableText always shows a cursor
Previously EditableText would render a text widget with no cursor if the text
value was empty.

Also adjust the height of the cursor widget to reflect the style's line
height, and update the cursor painting to match.
2015-09-21 14:12:55 -07:00
Adam Barth
b361a3b4a8 fn3 shouldn't rebuild components that don't change identity 2015-09-21 14:00:26 -07:00
Adam Barth
b9c06c0ade Make stateful components work in fn3 2015-09-21 11:02:36 -07:00
Ian Hickson
6a88ec6d71 Merge pull request #1248 from abarth/fn3
Prototype of fn3
2015-09-21 10:26:25 -07:00
Adam Barth
130a5cb6dc Fix analyzer warnings
We were just missing a few type casts in tests to make the analyzer happy.
2015-09-19 19:21:11 -07:00
Adam Barth
b4ff5ca6ae Prototype of fn3
This patch contains a prototype of a new widget framework. In this framework,
Components can be reused in the tree as many times as the author desires. Also,
StatefulComponent is split into two pieces, a ComponentConfiguration and a
ComponentState. The ComponentConfiguration is created by the author and can be
reused as many times as desired. When mounted into the tree, the
ComponentConfiguration creates a ComponentState to hold the state for the
component. The state remains in the tree and cannot be reused.
2015-09-18 23:17:52 -07:00
krisgiesing
93ebc9e417 Merge pull request #1242 from krisgiesing/master
Fix Rect intersection; add test
2015-09-18 15:28:35 -07:00
Kris Giesing
c52b6fb9e8 Fix Rect intersection; add test 2015-09-18 15:22:59 -07:00
jason-simmons
682116529e Merge pull request #1229 from jason-simmons/editable_text_placeholder_flex
In EditableText, wrap the placeholder text in a Row so it will expand to its parent's width
2015-09-18 14:24:26 -07:00
Jason Simmons
80b2c1732a In EditableText, wrap the placeholder text in a Row so it will expand to its parent's width
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.
2015-09-18 13:46:31 -07:00
Adam Barth
4467a268ce Move theme into material.dart
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.
2015-09-18 09:57:21 -07:00
Hixie
499d832259 Handle the case of a Widget being moved down
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.
2015-09-17 17:23:20 -07:00
Hixie
b1e64571e6 Fix removal logic in widgets
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).
2015-09-17 13:30:27 -07:00
Collin Jackson
6dd58b2108 add a test for scale gestures 2015-09-17 12:45:13 -07:00
Adam Barth
41b8ffd623 Create gestures.dart
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.
2015-09-16 18:25:00 -07:00
Ian Hickson
ebf71f59d6 Merge pull request #1191 from Hixie/flex
FlexAlignItems.stretch didn't stretch
2015-09-16 13:09:08 -07:00
Adam Barth
699fa2415c Merge pull request #1194 from abarth/drawer_gestures
Move Drawer to GestureDetector
2015-09-16 12:38:28 -07:00
Adam Barth
74f7d9efee Move Drawer to GestureDetector
This fixes an issue in the stocks app in horizontal mode where you could both
scroll and drag the drawer at the same time.
2015-09-16 12:33:51 -07:00
Hixie
07e010de1b FlexAlignItems.stretch didn't stretch 2015-09-16 12:22:37 -07:00
Hixie
cd6c4da3c6 Refactor rendering_tester
RenderView has to be a singleton for sanity during tests, otherwise they
all end up in the dirty lists and we end up pumping all of them each frame.
2015-09-16 12:03:57 -07:00
Hixie
dfd821e595 Ignore generation of child if child is unchanged
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.
2015-09-15 13:20:37 -07:00
Ian Hickson
942d1fa6ac Merge pull request #1157 from Hixie/minor-fixes
Minor cleanups (spelling mistakes, unneeded casts)
2015-09-14 12:11:31 -07:00
Adam Barth
b0c300e526 Add dartdoc for proxy_box.dart and other code in rendering
Almost done adding dartdoc to the rendering layer.
2015-09-14 10:35:31 -07:00
Hixie
0376c35ae4 Minor cleanups (spelling mistakes, unneeded casts)
Rename Outter to Outer.

Change _sync() in StatefulComponent to assert the argument type in the
signature rather than in the code.
2015-09-14 10:28:28 -07:00
Adam Barth
129238ed27 Merge pull request #1138 from abarth/fewer_settings
Disentangle FontSize from Settings
2015-09-11 13:12:48 -07:00
Adam Barth
b89d790a84 Disentangle FontSize from Settings
Instead, just store the default font sizes in statics. These statics are
constants for now, but we'll probably make them configurable at some point.
2015-09-11 12:51:27 -07:00
Andrew Wilson
844cf1fac7 Merge pull request #1131 from apwilson/shrinkwrap
Shrink wrap when constraints are infinite.
2015-09-11 12:37:51 -07:00
Andrew Wilson
380cfb265f Shrink wrap when constraints are infinite. 2015-09-11 12:12:59 -07:00
Adam Barth
fddfe574c4 Merge pull request #1127 from abarth/scroll_drag
Rename scroll.dart to drag.dart
2015-09-11 10:59:10 -07:00
Adam Barth
99bc146642 Merge pull request #1133 from abarth/paragraph_builder
ParagraphBuilder should be able to build a paragraph
2015-09-11 10:59:02 -07:00
Adam Barth
3d3c50b2cf Rename scroll.dart to drag.dart
The gesture is now called "drag". The library name should match.
2015-09-11 10:55:54 -07:00
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
Adam Barth
403441d2ab ParagraphBuilder should be able to build a paragraph
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.
2015-09-11 10:23:15 -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
Adam Barth
07d96a2314 Rename layout_utils.dart to rendering_tester.dart
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.
2015-08-26 15:49:04 -07:00
Adam Barth
d8fdccc596 Merge pull request #875 from abarth/merge_pump_frame
Merge pumpPaintFrame and pumpFrame in WidgetTester
2015-08-26 15:46:28 -07:00
Adam Barth
c405631ccd Merge pumpPaintFrame and pumpFrame in WidgetTester
We can make all the test pass by removing more of the mocks and using the real
code.
2015-08-26 15:42:52 -07:00
Collin Jackson
56508d4159 Merge pull request #872 from collinjackson/more_date_picker_tests
Test year selection for date picker
2015-08-26 15:39:24 -07:00
Collin Jackson
52ed57e1bb Test year selection for date picker 2015-08-26 15:30:49 -07:00
Hans Muller
38d2302864 Merge pull request #850 from HansMuller/progress-bar-animation
Fix ProgressIndicators and add a regression test

Added some unit test infrastucture for checking layers.
2015-08-26 15:24:12 -07:00
Hans Muller
4e650a8928 Fix ProgressIndicators and add a regression test
Added some unit test infrasture for checking layers.
2015-08-26 15:22:24 -07:00
Hixie
b1468cb2ea ShrinkWrapHeight widget
- add debugDescribeSettings to a few classes that were missing it
- fix some minor bugs in RenderShrinkWrapWidth and ShrinkWrapWidth
- introduce RenderShrinkWrapHeight and ShrinkWrapHeight
2015-08-26 15:07:53 -07:00
Adam Barth
bb38d1d974 Remove unused import to silence analyzer 2015-08-26 14:21:36 -07:00
Adam Barth
92e5a65d29 Add a basic test for DatePicker
Most of this work in this patch is building out the test framework to the point
where we can write this test.
2015-08-26 13:38:05 -07:00
Adam Barth
fd3884b473 Turn big_circle.dart into a test
Fixes #829
2015-08-26 11:10:16 -07:00
Adam Barth
2e2fa94e1b Sector demo is broken because of compositor changes
We need to implement visitChildren for the RenderObjects in the sector demo.
Also, add a test.

Fixes #790
2015-08-26 10:58:30 -07:00
Adam Barth
240e807f84 Add a basic test for Mimic tree movement 2015-08-25 16:50:44 -07:00
Adam Barth
fde6b0a4b6 Add a test for #833
This test just exercises Align to make sure it can sync.
2015-08-25 16:13:33 -07:00
Adam Barth
d7ba514546 Fix global key error while using fitness app
We were making local copies of the listener maps, but we were actually
iterating the underlying sets. Now we make local copies of the sets.

Fixes #803
2015-08-25 14:45:18 -07:00
Adam Barth
16328cc875 Add GlobalKey.registerSyncListener
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.
2015-08-24 12:55:55 -07:00
Adam Barth
2873880f50 Fix analyzer warnings 2015-08-22 08:24:02 -07:00
Adam Barth
ac7c3a00fa Migrate RenderBox tests to box_test.dart 2015-08-21 10:18:48 -07:00
Adam Barth
ccd00bc5c2 Migrate sky/tests/layout to sky/unit/test
Also, I've organized the tests by the render object they're testing.
2015-08-21 10:01:58 -07:00
Adam Barth
c7f528dab8 Migrate some tests to sky/unit/test 2015-08-21 09:13:52 -07:00
Adam Barth
b64e1aaba8 Introduce sky/unit/test
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.
2015-08-20 21:01:13 -07:00