72 Commits

Author SHA1 Message Date
Adam Barth
4b1a9ff14c Remove PointerRouter and GestureArena arguments
There's no reason to make clients supply a PointerRounter and a
GestureArena when constructing gesture recognizers. These objects are
statics and the gesture recognizers can just grab them directly.

Also, remove the callback constructor arguments. Almost no code used
them. Instead, people seem to prefer using the `..` operator to set
callbacks on the recognizers. Removing the arguments removes a bunch of
boilerplate.
2016-02-24 22:23:00 -08:00
Adam Barth
8e326d724a Add the ability to recognize gestures on text spans
Currently the interface for recognizing gestures on text spans is pretty ugly,
but hopefully we can improve it with time.

Fixes #156
2016-02-24 17:07:35 -08:00
Hans Muller
ba93987c6e Added bottom_sheet_rebuild_test 2016-02-24 07:49:08 -08:00
Adam Barth
1484add104 Add TestGesture
This helper makes it easier to write correct tests that involve
gestures.

Fixes #1855
2016-02-21 14:32:58 -08:00
Adam Barth
4fb47600e4 Add a Velocity class to be explicit about units
We were using an Offset, which represented pixels/second, but it wasn't
clear to clients whether that was pixels/ms. Now we use a Velocity class
that is explict about the units.

Fixes #1510
Fixes #785
2016-02-13 22:59:09 -08:00
Hixie
19a2f5ef74 Horizontal and Vertical Draggables 2016-02-12 17:16:39 -08:00
Adam Barth
baca514f99 Merge pull request #1827 from abarth/scrollable_list_padding
Fix padding for ScrollableList
2016-02-12 13:59:59 -08:00
Adam Barth
ad2fa5a6e7 Fix padding for ScrollableList
Previously we had totally wrong behavior. Now we have more correct behavior and
testing.

Fixes #1808
2016-02-12 13:39:05 -08:00
Hixie
fd7be69df0 SizeObserver crusade: snap alignment
Remove the SizeObserver you need to use snap alignment in lists by
having the lists provide the size themselves in the callback.

Also, remove snapAlignmentOffset since we couldn't figure out how to
explain it and it's not really needed.
2016-02-12 12:40:44 -08:00
Hixie
6b487e4ecc Refactor MultiDragPointerState to support delays
...even after winning the arena.
2016-02-11 16:48:17 -08:00
Jason Simmons
279c6149c5 Merge pull request #1747 from jason-simmons/input_field_clear
Change the text/selection value API of the input field
2016-02-11 13:46:13 -08:00
Hixie
8e279f320e Provide a Draggable that starts on drag
This lets it cooperate with other gestures like tap.

The way I implemented this was to refactor the entire Draggable gesture
logic to use a new kind of gesture detector called
MultiDragGestureRecognizer. It works a bit like
MultiTapGestureRecognizer but for drags.

Also some tweaks to the velocity estimator.
2016-02-11 12:54:10 -08:00
Jason Simmons
52c55344d9 Change the text/selection value API of the input field
(see https://github.com/flutter/flutter/issues/1586)
2016-02-11 12:52:15 -08:00
Ian Hickson
a94999ba50 Clean up imports and exports.
Each layer is supposed to reexport the parts of the previous layer
that are part of its API.

- In painting.dart, export from dart:ui all the Canvas-related APIs
  that make sense to be used at higher levels, e.g. PaintingStyle.

- Delete painting/shadows.dart. It was dead code.

- In rendering/object.dart, export all of painting.dart.

- In widgets/basic.dart, export all of painting.dart and
  animation.dart. Some classes in animation/ are renamed to make this
  less disruptive and confusing to the namespace.

- Split out Stocks back into an import model rather than a part model,
  so that it's easier to manage its dependencies on a per-file basis.

- Move Ticker to scheduler library.

- Remove as many redundant imports as possible now.

- Some minor nit picking cleanup in various files.
2016-02-11 00:06:23 -08:00
Adam Barth
fc23277df5 Cleanup MixedViewport
This patch fixes a couple minor bugs and cleans up MixedViewport a bit.
2016-02-10 23:24:28 -08:00
Adam Barth
40151689f1 ScrollableList was applying padding twice
We need to subtract the padding instead of adding it.
2016-02-10 15:51:25 -08:00
Adam Barth
ec9ab32435 ScrollBehavior should support negative min scroll offset
Fixes #1730
2016-02-10 12:13:20 -08:00
Adam Barth
4ba5e712bc Teach PageableList about scroll anchors 2016-02-10 10:34:59 -08:00
Adam Barth
b07203a887 Merge pull request #1749 from abarth/viewport_scroll_anchor
Teach ScrollableList about scroll anchors
2016-02-10 09:47:41 -08:00
Adam Barth
d6ae53fec4 Teach ScrollableList about scroll anchors 2016-02-10 09:25:49 -08:00
Hixie
4d5e40675b Tapping through drag targets.
Factor out the HitTestBehavior logic so that RenderMetaData can use it.

Use that in DragTarget.
2016-02-09 17:03:46 -08:00
Adam Barth
f0276d09e4 Add scroll anchor for Block
This patch teaches block how to anchor its scrolling to the end rather than the
start.

Fixes #136
2016-02-09 15:17:39 -08:00
Adam Barth
7458ed226a Merge pull request #1710 from abarth/scroll_anchor
Preliminaries for scroll anchoring
2016-02-09 10:37:43 -08:00
Hixie
9cea6c50f5 Fix drawer in accessibility mode
The "leaf merge" feature was getting confused when we reset the
SemanticsNode. We now separately track whether the node itself is marked
as being merged vs whether we inherited that state, and we don't reset
the inherited state until you're reattached or reserialised. In the
latter case, we do a "just in time" clearing of the flag just like we
previously did a "just in time" setting of the flag, except now the flag
we're setting or clearing is the inherited flag not the actual flag.
2016-02-09 10:05:16 -08:00
Adam Barth
70d96ecb0b Improve unit conversions in Scrollable 2016-02-09 09:50:35 -08:00
Adam Barth
5b89669424 Remove HomogeneousViewport
The virtual viewport machinery now handles all of these use cases.
Previous clients of ScrollableWidgetList can use ScrollableLazyList
instead.
2016-02-05 20:12:18 -08:00
Hixie
1a0484cc7e Improve exceptions and asserts for rendering lib.
* Use actual exceptions rather than assertions containing code
  containing strings when trying to give messages to authors.
* Introduce RenderingError which is an AssertionError that takes a
  string argument, to support the above.
* Provide a BoxDimensions.hasBoundedWidth/hasBoundedHeight API.
* Document BoxDimensions.isNormalized.
* Provide more useful information when we assert isNormalized and find
  that it is false.
* When finding the size is infinite, crawl the tree to figure out which
  render box is likely responsible for the infinite constraints.
* Provide more information when size doesn't match the constraints.
* Provide more information when intrinsic dimension methods violate the
  constraints.
* Only spam a huge amount of information for the first exception from
  the rendering library. I've noticed a lot of people looking at the
  last exception printed rather than the first and that's very
  misleading -- after the rendering library hits an exception, all bets
  are off regarding what'll happen in the future. All kinds of asserts
  might fire.
* Improve docs around the debug methods and flags for the above.
* Make Block default to have no children. Previously, giving no children
  crashed with a confusing message about a null deref in an assert.
2016-02-05 13:55:40 -08:00
yjbanov
113544fa62 add test for ModalBarrier 2016-02-04 10:36:55 -08:00
yjbanov
19a01171f2 better error message when Navigator is used with no NavigatorState in the context 2016-02-04 10:11:25 -08:00
Adam Barth
b303e3db48 Move ServiceMocker into flutter_test
People writing their own tests will want to mock services as well.
2016-02-03 10:46:19 -08:00
Adam Barth
12507d1bdd RawKeyboardListener asserts if disposed without keyboard
We need to check whether we're attached to the keyboard before trying to
detach from the keyboard.
2016-02-02 20:02:23 -08:00
Adam Barth
b89d81a998 Merge pull request #1522 from abarth/editing_mojom
Update to new editing.mojom
2016-02-02 12:14:19 -08:00
yjbanov
4c823cdb97 add debugFillDescription to OverflowBox 2016-02-02 09:40:13 -08:00
Adam Barth
fade0dc097 Update to new editing.mojom
Now the keyboard is responsible for maintaining the state of the text
field.
2016-02-02 09:04:27 -08:00
Hixie
85689f1231 Make the Semantics code be a service.
Port the tests to use the new interface.
2016-02-01 12:57:47 -08:00
Hixie
e8a21f5d91 Turn MojoShell into an actual binding 2016-02-01 11:30:05 -08:00
Adam Barth
f8342c7a84 Fix analyzer warnings related to SemanticsListener
These were introduced by the recent engine roll.
2016-01-30 21:55:59 -08:00
Adam Barth
fa03df2d82 Add an alignment property to OverflowBox
This patch changes the default alignment of OverflowBox to center rather than
having a bias towards the upper-left corner.

Fixes #1236
2016-01-29 14:35:57 -08:00
Hixie
28a1788371 Semantics 2016-01-27 10:04:49 -08:00
Adam Barth
27a73a589c Merge pull request #1400 from abarth/reorder_update_children
updateChildren() needs to walk the list forward
2016-01-26 20:08:36 -08:00
Adam Barth
05839e51ca updateChildren() needs to walk the list forward
This patch changes the framework to walk the child list forwards so that build
functions with global side effects do sensible things. Specifically, if you
have a number of autofocusable children, the first one the list will acquire
the focus because it gets built first now.

Fixes #182
2016-01-26 20:02:46 -08:00
Adam Barth
a535164357 Keyboard doesn't dismiss when the drawer comes up
When introducing Focus widgets for the Drawer (and ModalRoutes), we weren't
actually giving them the focus. Now we move the focus scope when pushing modal
routes.

Fixes #184
2016-01-26 19:57:37 -08:00
Ian Hickson
5494323db9 Move us to HashSet to avoid the overhead of tracking the order 2016-01-23 18:13:13 -08:00
Adam Barth
61f82ee18c Improve the factoring between Input and RawEditableLine
RawEditableLine is now responsible for the scrolling behavior, which
removes the need for callbacks between RawEditableLine and Input. It
also fixes a bug whereby the whole Input widget (including its icon)
would scroll when the text got long.
2016-01-23 01:09:22 -08:00
Adam Barth
432bfb4729 Add material design features to Input
Properly support labels, hints, icons, and custom typography.
2016-01-23 00:21:18 -08:00
Adam Barth
4e83a5ccdb Add the ability to lose focus
Fixes #1308
2016-01-22 14:01:51 -08:00
Adam Barth
bdef1038e9 Input widget shrinks when typing a space
This patch restructures how we size the editing region of the Input widget. Now
RenderEditableLine understands that it's a single-line editing widget and sizes
itself correctly.
2016-01-22 13:18:24 -08:00
Hans Muller
8218ff683f Change Block children to be a named parameter 2016-01-22 08:04:21 -08:00
Hans Muller
5ae1b41ca4 Added TwoLevelList 2016-01-21 16:27:18 -08:00
Adam Barth
f176ed27de Don't autofocus Input widgets by default
Instead, require the developer to opt-in to autofocusing because autofocusing
can be disruptive.

Fixes #1307
2016-01-21 14:11:50 -08:00