258 Commits

Author SHA1 Message Date
Ian Hickson
c21b565f0b tightenWidth(), tightenHeight() => tighten(width:, height:)
This makes it more consistent with tightFor(), and also makes it
easier to tighten both directions at once when you're not sure you
will always do so (e.g. if you have a height and width that might be
null, and want to tighten whichever ones aren't null).
2016-01-10 19:49:07 -08:00
Ian Hickson
20a01b425e Add more debugPaintSizeEnabled construction lines.
- padding is shown in blue with a darker blue around the child
- spacing (empty size boxes or padding) is shown in gray
- alignment from a RenderPositionedBox is shown with yellow arrows
2016-01-08 23:13:20 -08:00
Adam Barth
ee88a685f8 Optimize repainting in Scaffold
Previously, we triggered a layout (and hence a repaint) when sliding the
draw because we gave the draw loose constraints. The drawer uses an
Align to move itself to the proper side of the screen, so it can have
tight constraints, which makes it a layout boundary.

Also, don't trigger a layout just because the Scaffold rebuilds. There
isn't any state in the scaffold custom layout, so it doesn't need to
repaint just because we created a new instance of the delegate.

Finally, add the debugging infrastructure I used to find these issues.
2016-01-08 01:57:30 -08:00
Adam Barth
76dd6228b4 Remove BlockDirection in favor of ScrollDirection
We'll probably renaming ScrollDirection to Axis in a future patch.

Fixes #151
2016-01-07 10:11:39 -08:00
Ian Hickson
13d6cc3273 Rationalise all our exception catching and reporting code
- make them all have the same style
- make them all include the stack trace last
- make them all stop printing if their callback is set (if
  appropriate, they don't yet all have callbacks)
2016-01-06 21:49:23 -08:00
Ian Hickson
94833b24bf Remove unreferenced getter "debugDoesLayoutWithCallback".
I think I wanted to use this at some point but ended up going a
different direction. Instead, object.dart has a private field that
serves a similar purpose.
2016-01-06 19:14:45 -08:00
Adam Barth
e64d93a520 Switch PageableList over to using RenderList
This patch moves PageableList off HomogeneousViewport and onto RenderList and
friends, making it match the new ScrollableList.
2016-01-06 15:28:01 -08:00
Adam Barth
b1f9138f52 Switch clients of ScrollableList to ScrollableList2
This patch also changed ScrollableList2 to use an Iterable instead of an
List for its children. This change lets clients map their underlying
data lazily. If the clients actually have a concrete list, we skip the
extra copy and grab the child list directly.
2016-01-05 16:21:00 -08:00
Adam Barth
37106ea603 Complete features of ScrollableList2
This patch implements the remaining missing features of ScrollableList2.
It should now be nearly a drop-in replacement for ScrollableList. The
next patch will switch callers over to the new machinery.
2016-01-05 14:29:12 -08:00
Adam Barth
7aa575b0d4 Remove ScrollDirection.both
Almost none of the clients of ScrollDirection can handle scrolling in both
directions.

Fixes #151
2016-01-04 16:46:40 -08:00
Adam Barth
99bca282c9 Introduce ScrollableList2
ScrollableList2 uses the same pattern as ScrollableGrid, which requires the
client to allocate widgets for every list item but doesn't inflate them unless
they're actually needed for the view. It improves on the original
ScrollableList by not requiring a rebuild of the whole visible portion of the
list when scrolling. In fact, small scrolls can often be handled entirely by
repainting.
2016-01-04 16:34:39 -08:00
Adam Barth
6106fa9d6d Add support for scrollable grids
We now support (vertically) scrollable grids with viewporting. If the
scroll doesn't reveal any new rows, we execute the scroll with a repaint
(i.e., no layout). If the scroll reveals a new row, we trigger a layout
to change the set of materialized children in the viewport.
2016-01-04 11:23:42 -08:00
Adam Barth
46a178dce6 Generalize grid layout
This patch make grid layout much more flexible. The behavior is factored
out into a GridDelegate that's modeled after the custom layout
delegates. The patch includes a MaxTileWidthGridDelegate that implements
the old behavior and a FixedColumnCountGridDelegate that implements a
grid layout with a fixed number of columns.

Fixes #1048
2016-01-02 14:30:45 -08:00
Adam Barth
e9ac6d308d RenderBox should use Offset for child offset
Previously we used Position, which makes it harder to accumulate offsets
when walking the render tree.
2016-01-01 20:11:38 -08:00
Adam Barth
9484370042 ScrollbarPainter exception when scrolling MaterialList
When assigning a new overlayPainter, we were detaching the old overlay
painter even if the render object itself wasn't attached. Now we only
twiddle the attach/detach state of the overlay painter when we're
attached ourselves.

Fixes #1047
2016-01-01 19:33:03 -08:00
Ian Hickson
9bad312af2 RenderFractionalTranslation
- Add RenderFractionalTranslation, a render box that does a
  translation based on a FractionalOffset.

- Make FractionalOffset more like Offset
  - dx/dy instead of x/y
  - add /, ~/, %
  - add .zero

- Add alongOffset and alongSize to FractionalOffset so that you can
  easily apply FractionalOffset to Offsets and Sizes. (Better name
  suggestions welcome.)

- Add transformHitTests boolean to RenderTransform (also on
  RenderFractionalTranslation), and to classes based on it.

- Remove the fade from Dismissable. We can add it back using the
  builder-with-child pattern like Draggable if we need it. See #1003
  for tha feature request.

- Rename a bunch of variables in dismissable.dart.

- Change the test for dismissable to not handle leftwards dismisses
  one pixel different from rightwards dismisses, and cleaned up the
  resulting effect on the test (mostly making sure we had the right
  number of pumps, with comments explaining what each one was).

Fixes #174.
2015-12-24 11:04:25 -08:00
Ian Hickson
e48efdca15 Merge pull request #982 from Hixie/fewer-bit-updates
Less tree walking for compositing bits updates.
2015-12-21 11:33:11 -08:00
Ian Hickson
543a7df0f6 Update RenderPositionedBox documentation. 2015-12-19 21:07:36 -08:00
Hixie
ab01c7bf73 Less tree walking for compositing bits updates.
Use the same technique for updating compositing bits as layout and
painting. This avoids walking the entire rendering tree when all you
need to update is a small subtree.
2015-12-17 13:55:53 -08:00
Hixie
b5e7e1ce7a Close some sentences. (rendering dartdocs) 2015-12-16 13:30:33 -08:00
Ian Hickson
7dad780f13 Merge pull request #946 from Hixie/pointerExceptions
Catch exceptions in pointer handling
2015-12-16 09:42:15 -08:00
Ian Hickson
7ea5879e88 Merge pull request #920 from Hixie/renderView-non-null
Be clearer about whether renderView can be null.
2015-12-16 09:42:04 -08:00
Hixie
a87351ad88 Aggressively try to catch misuse of DropDownButton
Fixes https://github.com/flutter/flutter/issues/948.
I hope.
2015-12-15 16:30:04 -08:00
Hixie
4e23ecd668 Catch exceptions in pointer handling
If we don't catch these exceptions, we get confused about what's going
on with the pointers, and the app basically stops working.
2015-12-15 15:24:56 -08:00
Hixie
6047c6da37 Be clearer about whether renderView can be null. 2015-12-15 13:49:04 -08:00
Hans Muller
0d983cd87a CustomMultiChildLayout and CustomOneChildLayout now use their delegate's shouldRelayout() method instead of a "token" to decide if layout is needed.
MultiChildLayoutDelegate and OnChildLayoutDelegate are now expected to be stateless, i.e. they'll typically be built each time their custom layout widget is built. If the identical layout delegate is provided to a new custom layout, layout will not happen.

Revised the bottom sheet implementation per the new custom layout classes. Removed a SizeObserver.

Fixes #899
2015-12-15 12:37:42 -08:00
Devon Carew
4226b6008e remove todos for service extension params 2015-12-15 11:08:42 -08:00
Devon Carew
cde14ab649 more checked mode guards; more types; fewer todos 2015-12-14 19:04:34 -08:00
Devon Carew
211aeabb87 review comments 2015-12-14 12:51:39 -08:00
Devon Carew
ce6b330a80 expose flutter debug functionality using VM service extensions 2015-12-14 10:22:20 -08:00
Ian Hickson
d29970df8b Rename Pointerer to Gesturer. 2015-12-14 07:54:54 -08:00
Ian Hickson
ade93651ac Refactor bindings. 2015-12-13 23:34:41 -08:00
Ian Hickson
e78d6cbc6b Merge pull request #857 from Hixie/hashCodes
Use hashValues instead of hard-coded hashCode getters
2015-12-11 21:46:32 -08:00
Ian Hickson
cb39108146 Minor fixes in comments and style. 2015-12-11 20:25:08 -08:00
Ian Hickson
d1364643db applyPaintTransform() improvements
Previously, applyPaintTransform() had to know how it was positioned in
its parent, even though that's really the parent's responsibility.

Now, applyPaintTransform() is given a child and applies the transform
that it would give the child during paint.

This makes it possible for applyPaintTransform() to work across
coordinate system boundaries (e.g. box to sector, or view to box --
previously, view to box only worked because we explicitly skipped that
step -- since view doesn't actually apply a transform, it doesn't
really matter).
2015-12-10 22:22:00 -08:00
Ian Hickson
5996d381a7 Check for cycles in our various tree structures. 2015-12-10 19:30:46 -08:00
Adam Barth
40dda1ed4b Add dartdoc for image classes
- Adds dartdoc for all the `of` functions.
 - Renames Image to RawImage. This widget is rarely used and shouldn't take up
   such a nice global name.

Fixes #361
2015-12-10 18:34:56 -08:00
Adam Barth
87e6a5cc12 Add more dartdoc for basic widgets 2015-12-10 14:58:57 -08:00
Adam Barth
ffad464c96 Merge pull request #877 from abarth/better_asserts
Improve asserts when performLayout missing
2015-12-10 12:23:36 -08:00
Adam Barth
2edb6807b8 Improve asserts when performLayout missing
Fixes #566
2015-12-10 12:15:07 -08:00
Hixie
3c4442cecb Remove debugDoingPaint setter.
debugDoingPaint is an internal flag and really shouldn't be globally settable.
2015-12-10 10:42:35 -08:00
Ian Hickson
d8a3ed3efc Use hashValues instead of hard-coded hashCode getters 2015-12-09 22:10:33 -08:00
Florian Loitsch
b5aba60147 Minor modifs. 2015-12-09 17:07:51 -08:00
Adam Barth
ab89d2e499 Update to the new TextDecoration API
Now with fewer lists.
2015-12-09 15:11:34 -08:00
Adam Barth
5d6d258533 Update documentation based on comments in previous patch 2015-12-09 09:48:22 -08:00
Adam Barth
e55858411f Add some more dartdoc to widgets 2015-12-08 23:42:34 -08:00
Ian Hickson
1a049c14e5 Catch un-normalized BoxConstraints
Add BoxConstraints.isNormalized feature.

Use this feature in asserts in all the intrinsic dimension methods, in
various relevant BoxConstraints methods, and in layout().

Wrap the _DebugSize logic in BoxConstraints.constrain() in an assert
block to avoid a branch in release mode.

Remove the logic in BoxConstraints.isSatisfiedBy() that dealt with
non-normalized values.

Add BoxConstraints.normalize().

Make RenderCustomOneChildLayoutBox.performLayout() only set
parentUsesSize on the child if the constraints aren't tight.
2015-12-08 21:35:39 -08:00
Eric Seidel
2f4864efbb Merge pull request #825 from eseidelGoogle/locale_test
Add a test to stocks for changing the locale
2015-12-08 16:34:53 -08:00
Eric Seidel
09894ec50b Add a test to stocks for changing the locale
I had to add a setLocale method to WidgetTester and
split the code in FlutterBinding which handled locale
changes to allow me to dispatch a locale change w/o actually
changing what the c++ code reports as the locale.

Also added the test to Travis.

@abarth @jason-simmons
2015-12-08 16:16:24 -08:00
Collin Jackson
56818d186d Merge pull request #801 from collinjackson/fix_dynamic_hero
Fix hero transition when using dynamic routes
2015-12-08 13:48:45 -08:00