Since RelativeRect's whole purpose in life is to make work with Stack
easier, it's silly that you can't directly use it with Positioned.
Also, tests for RelativeRect.
And fixes for the bugs that found...
It's safe to remove the unneeded `void`s from setters since the blocking issues in the
`always_declare_return_types` lint have been fixed (https://github.com/dart-lang/linter/). We can also safely flip the bit on `avoid_return_types_on_setters`.
A flow layout is optimized for reposition children with transformation
matrices. A flow layout can animate the position of its children very
efficiently.
I ran into a case where I was setting minHeight=∞ and then calling
layout() with that constraint, which is all kinds of bad. To try to
catch this earlier, this patch now provides a way to catch constraints
that are requiring infinite values.
We don't _always_ check this because there are valid uses for
BoxConstraints.biggest, e.g. as an additionalConstraint.
This reverts commit f41b3411da35929b09009e47cb52474389e42874, reversing
changes made to e33d8d96212f3e337a6660f1eb1118bffc945bf5.
This was a bad check-in due to my mangling uploading a new version of the branch from a different machine.
This reverts https://github.com/flutter/flutter/pull/2639 and will be replaced by https://github.com/flutter/flutter/pull/2640
The asserting will continue until morale improves!
* Convert all assert(*.isNormalized) checks to use the new
debugAssertIsNormalized technology.
* Convert CustomMultiChildLayout to use the new RenderingError
technology to greatly improve the detail in errors you get when
writing CustomMultiChildLayout delegates.
* Add BoxConstraints.copyWith().
* Indent the descendants in the rendering exception data dump so that
when you have multiple children it's clearer what's going on.
Introduces a new Tooltip class.
Adds support for tooltips to IconButton and Scaffold.
Adds some tooltips to various demos.
Also some tweaks to stack.dart that I made before I decided not to go
down a "CustomPositioned" route.
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).
- 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.
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.
This pattern breaks when using compositing because we need to lift those
operations into the compositing tree. This patch removes all the ones I could
find and adds an assert to help prevent more from getting introduced.
Fixes#191
This patch simplifies PaintingContext with several goals:
1) We now call a callback instead of assuming the caller has a single child to
paint. This change will let us handle render objects that wish to paint more
than one child.
2) We now avoid creating lots of empty picture layers because we don't eagerly
start recording pictures. Instead, we wait for the first caller to touch the
canvas before creating the picture recorder.
3) We now are more consistent about which values have incorporated the painting
offset.
A common pattern is to use a Positioned with a Sized box to give both an offset
from the edge as well as a fixed size to the child. This patch rolls into into
the Stack layout algorithm for simplicity.
Fixes#250
Now a RenderBox is considered hit if one of its children are hit or it itself
decides that it's hit. In particular, empty space inside a flex won't be hit
because none of the children are located there and a RenderFlex doesn't
consider itself hittable.
Fixes#53Fixes#1221
Add a AnimatedRelativeRectValue class for animating RelativeRects.
Add a PositionedTransition class for animating Positioned using
AnimatedRelativeRectValues.
Add a test for PositionedTransition.
Fix a math bug a RelativeRect found by the test.
Fix a logic bug in the two ParentDataWidget classes found by the test.
Specifically, they were marking the child dirty, rather than the parent.
The parentData is for the parent's layout, not the child's, so they have
to mark the parent dirty. (I didn't hoist this up to the superclass
because ParentData could be used for painting, hit testing,
accessibility, or any number of other things, and I didn't want to bake
in the assumption that it needed markNeedsLayout.)
- truncate pixel values to 1dp since there's really no point being told
the Size is 302.98732587287 by 648.28498579187.
- describe more Widgets so that debugDumpApp() is more useful.
- remove bufferValue from ProgressIndicator (cc @hansmuller) since it's
not yet implemented.
- half-hearted toString() for ThemeData. There's no point making a
complete one, since it would cause line-wrap even on big monitors in
debugDumpApp dumps, and you can easily get the actual values from a
debugging if that's the issue.
- flesh out BoxConstraints.toString() so that fully unconstrained and
fully infinite constraints are called out explicitly. I experimented
with adding even more special cases, e.g. calling out unconstrained
widths with fixed heights, etc, but it made the output less readable.
- remove a redundant _updateVariable() in AnimatedContainer (cc
@abarth).
- add more information to RenderView.toString().
Introduce a class that can describe the metrics used in a Positioned
widget, to enable easier manipulation and storage of the values, e.g.
for animation purposes.
Add type annotations in many places.
Fix some identifiers to have more lint-satisfying names.
Make all operator==s consistent in style.
Reorder some functions for consistency.
Make ParentData no longer dynamic, and fix all the code around that.
Now that you import a top-level file for each layer of the Flutter
framework, within the framework we can use relative paths without being
worried about the copy/pasta problem we used to have.
Added horizontal and vertical alignment properties to Stack so that the origin of non-positioned children can be specified. Currently all of the non-positioned children just end up with their top-left at 0,0. Now, for example, you can center the children by specifying verticalAlignment: 0.5, horizontalAlignment: 0.5.
Added IndexedStack which only paints the stack child specified by the index property. Since it's a Stack, it's as big as the biggest non-positioned child. This component will be essential for building mobile drop down menus.
Added a (likely temporary) example that demonstrates IndexedStack.