61 Commits

Author SHA1 Message Date
Eric Seidel
58068b9e41 Add TODOs about components needing to adjust to screen size changes.
Our current static view_configuration design cannot work.

https://github.com/domokit/mojo/issues/231

R=ianh@google.com

Review URL: https://codereview.chromium.org/1169813009.
2015-06-10 11:28:00 -07:00
Eric Seidel
c87b98b687 Enable antialiasing on Paint by default.
The app looks so much better with this on.

R=jackson@google.com, abarth@chromium.org

Review URL: https://codereview.chromium.org/1172413002.
2015-06-10 11:11:03 -07:00
Hans Muller
c572af7f6e Right-size the toolbar
Tweaked the layout in Scaffold a little: the Scaffold
accounts for the (Android) notification bar's height,
instead of the ToolBar. I think it would be best if
moving the app below the notification area were handled
at a lower level. Doing it in Scaffold seemed OK for the
moment, since one could put a ToolBar component anywhere
in an app.

Closes #208

R=ianh@google.com

Review URL: https://codereview.chromium.org/1171173003.
2015-06-10 11:06:50 -07:00
Hixie
003083a12d Remove one more use of mirrors: Components now have to explicitly sync their fields.
This also removes one bit of magic to make it more obvious what on is
going on during a sync, which should hopefully help.

Components have to decide if they support being stateful or not. If
they do, then they must implement syncFields() and have mutable
fields; if they don't, then they must have final fields. This isn't
particularly enforced, though.

This also renames _willSync() to _retainStatefulNodeIfPossible(), for
clarity, and fixes some minor style issues and one typo that was
breaking the drawer.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1174023003
2015-06-10 10:33:04 -07:00
Collin Jackson
950b3d40c5 Extend Sky's RenderFlex with intrinsic sizes and compute cross-size height
Renders interactive_flex and stocks demos fine. Could use more testing,
so I'm going to work on that after I land this.

R=abarth@chromium.org, abarth

Review URL: https://codereview.chromium.org/1173493003
2015-06-10 10:11:58 -07:00
Adam Barth
38e39c0ec5 Make ink splashes work in MenuItem
Previously, the ink splashes would disappear immediately because the button
highlight would change the structure of the component hierarchy and we weren't
smart enough to retain the underlying RenderInkSplash. This CL is a point fix
for that issue by avoiding changing the structure of the component hierarchy. A
more complete fix would be to make Container smarter about how it syncs its
subcomponents.

R=eseidel@chromium.org, ianh@google.com

Review URL: https://codereview.chromium.org/1168323003.
2015-06-10 09:23:24 -07:00
Adam Barth
57df667f8f Add a basic InkWell implementation
This CL replaces the (non-working) components2 InkWell with some code based on
the ink_well example. There are at least two issues with the implementation:

1) The ink splash always starts at the center of the well because we don't have
   a facility for converting from global to local coordinates, which means we
   can't tell where the tap occurred in the local coordinates we need to use
   for painting.

2) When used inside a MenuItem, the in splash disappears shortly after
   starting, presumably because the button starts highlighting, which causes a
   component rebuild and somehow we lose the RenderInkWell instance.

I plan to address these issues in subsequent CLs.

R=ianh@google.com

Review URL: https://codereview.chromium.org/1172033003.
2015-06-10 09:04:15 -07:00
Hixie
d54c213b24 Clean up a bunch of our Dart code.
- constructors first
 - have either a blank line at the top and bottom of each class, or no blank line in either place (it's still inconsistent about which we should do)
 - hide clamp()

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1172173002
2015-06-09 15:27:58 -07:00
Hixie
5156f12b32 Move AnimatedComponent away from mirrors and towards a callback-based setter.
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1171273002
2015-06-09 15:24:51 -07:00
Matt Perry
7cbe385e8f Add a shadow to the FloatingActionButton.
Also added a helper class to Sky framework for building shadow DrawLoopers.

R=abarth@chromium.org, eseidel@chromium.org, ianh@google.com

Review URL: https://codereview.chromium.org/1175683002.
2015-06-09 15:51:04 -04:00
Adam Barth
3e5993eeee Give the popup menu a 2px border radius
This matches the material design spec.

R=ianh@google.com, jackson@chromium.org

Review URL: https://codereview.chromium.org/1169873003.
2015-06-09 12:43:27 -07:00
Hixie
2fa798966e OneChildRenderObjectWrapper and Scaffold were ignoring the return value of syncChild().
This would cause them to forget what the most recent child they'd been given was, with disastrous effects later.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1173683003
2015-06-09 12:23:17 -07:00
Adam Barth
ff13e9ae9e Add material shadows to toolbar and drawer
Also, I've fixed the mask color on the drawer.

R=ianh@google.com

Review URL: https://codereview.chromium.org/1168203004.
2015-06-09 12:07:14 -07:00
Hans Muller
65926f65fb Added a key: parameter to ParentDataNode, ContentDataNode
The FlexExpandingChild flex parameter is now a keyword as
well, which adds a small readability benefit.

R=ianh@google.com

Review URL: https://codereview.chromium.org/1172503004.
2015-06-09 11:00:47 -07:00
Adam Barth
7a930b8352 Add a proper material shadow the popup menu
R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1172723002.
2015-06-09 10:31:39 -07:00
Adam Barth
e50d0e622b ShrinkWrap the Stocks menu
The popup menu in the stocks app is supposed to size its width to the max
intrinsic width of the menu. This CL teaches it how to do that.

It's a shame that we need to ceilToDouble the output of RenderParagraph. If we
don't do that, we run into floating point layout trouble and the menu triggers
a line break. The correct fix is to do layout in fixed point.

R=ianh@google.com

Review URL: https://codereview.chromium.org/1168113005
2015-06-08 16:20:11 -07:00
Hixie
c4b64d74f3 Rename Container's desiredSize argument to width and height arguments.
Also change SizedBox.

This makes the code that uses Container() and SizedBox() much more readable.

The underlying RenderSizedBox is not affected by this change.

R=abarth@chromium.org, eseidel@chromium.org

Review URL: https://codereview.chromium.org/1166203002
2015-06-08 14:36:19 -07:00
Collin Jackson
d4ef9dcb26 Sky support for flexbox justify content
R=abarth@chromium.org, abarth

Review URL: https://codereview.chromium.org/1164363002
2015-06-08 14:14:02 -07:00
Adam Barth
5a14f03f7b Add Point.origin for new Point(0.0, 0.0)
R=eseidel@chromium.org, ianh@google.com

Review URL: https://codereview.chromium.org/1166183002
2015-06-08 13:36:52 -07:00
Adam Barth
b311e286f3 Add a basic popup menu implementation to stocks2
The popup menu is displayed in the wrong location with the wrong width, but it
does draw. I've also removed the checkbox because the flex container was
causing me trouble.  I'll add it back in a later CL.

R=ianh@google.com

Review URL: https://codereview.chromium.org/1166153002
2015-06-08 12:52:15 -07:00
Adam Barth
c0d900414f Add |constraints| to Container for PopupMenuItem
This CL is the first step towards getting PopupMenuItem working in fn2. We
introduce the ability to add a minWidth to a Container by creating a
RenderConstrainedBox class to apply the new constraints.

R=ianh@google.com

Review URL: https://codereview.chromium.org/1155683011
2015-06-08 12:22:52 -07:00
Hixie
5703762fc1 Port DrawerHeader to fn2 world.
This includes making SizedBox default to infinite size, and making
Container default to containing one infinite-sized SizedBox. That way,
you can use an empty Container as a spacer in a flex box.

The rendering doesn't quite work, because of a bug in flex whereby it
doesn't shrink-wrap its contents in the cross-direction, it fills the
parent. Collin is on that.

R=jackson@google.com

Review URL: https://codereview.chromium.org/1163633003
2015-06-08 11:00:05 -07:00
Collin Jackson
668e1e37ab Implement a simple checkbox in Sky’s fn2 components library
R=abarth@chromium.org, abarth

Review URL: https://codereview.chromium.org/1161813005
2015-06-05 14:51:37 -07:00
Hixie
12aa568fc4 Export Point, Size, Rect, Color, Paint, Path, BoxDecoration, Border, BorderSide, EdgeDims, and FlexDirection from fn2.dart
That way most of our libraries don't have to use sky.Foo all over the place, and we can reduce the number of imports in most Dart components.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1161323004
2015-06-05 10:18:50 -07:00
Collin Jackson
18ab61e1ee Use an enum for Dart bindings for Skia Paint style
R=abarth@chromium.org, abarth

Review URL: https://codereview.chromium.org/1171543002
2015-06-05 10:12:45 -07:00
Adam Barth
247344193d Add the floating action button to stocks2
The + isn't quite centered properly, but the button is a circle in the right
place.

R=eseidel@chromium.org, ianh@google.com

Review URL: https://codereview.chromium.org/1156383004
2015-06-05 10:07:51 -07:00
Adam Barth
9ea7ac504c Expose _remove from fn2
Turns out Scaffold needs to hook _remove, so we need to rename it to remove to
expose it outside fn2.dart.

R=ianh@google.com

Review URL: https://codereview.chromium.org/1160013007
2015-06-05 09:03:23 -07:00
Collin Jackson
45cbbc0fae Implement radio button for Sky’s fn2
R=abarth@chromium.org, eseidel@chromium.org, abarth

Review URL: https://codereview.chromium.org/1157573012
2015-06-04 17:24:38 -07:00
Hixie
96aadc99b4 Rename "BorderSide.None" to "BorderSide.none", since it's a constant, and change the sky.Size.infinite() constructor to a constant.
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1158263005
2015-06-04 16:17:20 -07:00
Adam Barth
c5c3f31a17 Make the StockList actually work in stocks2
RenderScaffold needs to attach and detach its children when asked.

R=eseidel@chromium.org, ianh@google.com

Review URL: https://codereview.chromium.org/1149893025
2015-06-04 15:50:07 -07:00
Hixie
9b0cb975cb Improve the RenderObject.toString() logic so that there's not blank lines everywhere and to generally be better.
Adds sizes, positions, transforms, improves RenderParagraph's output.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1160233004
2015-06-04 15:45:44 -07:00
Eric Seidel
ca3b643ca9 Start making input work
Does not work yet.

R=ianh@google.com

Review URL: https://codereview.chromium.org/1163973005
2015-06-04 15:18:09 -07:00
Hixie
77ef219796 Fix some minor warnings from the analyzer in the framework.
R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1162623011
2015-06-04 14:11:02 -07:00
Hixie
8ee5aa0bc6 Give RenderObject a useful toString().
This makes debugging the render tree a lot easier. Just print the node
you care about, and you get an indented tree view of its subtree,
including settings. New subclasses should implement the new virtual
method debugDescribeSettings() to expose new settings.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1157993005
2015-06-04 14:10:07 -07:00
Adam Barth
0fcbeef342 Make FixedHeightScrollable understand heights
This CL makes FixedHeightScrollable able to measure heights. In the DOM-based
version, FixedHeightScrollable forced a synchronous layout in a microtask in
order to measure the size of itself and its children. In the DOM-less version,
we now require the subclass to tell us the item height and we measure our own
height using a layout callback.

R=ianh@google.com

Review URL: https://codereview.chromium.org/1161063005
2015-06-04 13:42:16 -07:00
Collin Jackson
31f8f740d1 Implement menu_divider
R=abarth@chromium.org, abarth

Review URL: https://codereview.chromium.org/1163913004
2015-06-04 13:11:40 -07:00
Hixie
6a0d1ffb2f Style guide says enum values should be lowerCamelCase.
https://www.dartlang.org/articles/style-guide/#names

R=jackson@google.com

Review URL: https://codereview.chromium.org/1158813004
2015-06-04 12:24:10 -07:00
Adam Barth
22b39a9f88 Add RenderClip and use it in FixedHeightScrollable
In the future, we might want to extend this class to clip to a configurable
rect in addition to clipping to its bounds.

R=eseidel@chromium.org, ianh@google.com

Review URL: https://codereview.chromium.org/1145263006
2015-06-04 11:14:30 -07:00
Collin Jackson
ab90994194 Stub out InkWell and implement Sky’s fn2 menu item
R=abarth@chromium.org, ianh@google.com, abarth, hixie

Review URL: https://codereview.chromium.org/1165983002
2015-06-04 11:04:01 -07:00
Adam Barth
4491168fcb Make FixedHeightScrollable mostly work in fn2
We still need to add a clip and a way to integrate with layout, but those
changes are more invasive and I'll do them in separate CLs.

R=eseidel@chromium.org, ianh@google.com

Review URL: https://codereview.chromium.org/1166983003
2015-06-04 10:52:12 -07:00
Hixie
8e34567652 Rename RenderNode to RenderObject.
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1165013003
2015-06-04 10:45:21 -07:00
Hixie
04f10fbf64 Fix the crash when the drawer is hidden.
The root cause of the crash was threefold:
 - you can't enumerate enums, in dart; you have to enumerate their values.
 - RenderNodeWrapper was trying to call remove(child.root) on its root, but that's
   not something that all RenderNodes have
 - when a RenderNode was deparented, its relayoutSubtreeRoot wasn't removed, so
   the node ended up in an inconsistent state regarding its parent tree

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1151573020
2015-06-04 10:39:34 -07:00
Eric Seidel
8d52fb51dc Make Icon work using space-aged base-url technology.
I also moved Icon back to using int, since double doesn't
actually make sense for an icon pixel size.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1164023005
2015-06-03 17:16:12 -07:00
Eric Seidel
8078665688 Make the Icon component use Image
Even though Image doesn't yet know how to handle
relative urls.

TBR=jackson@google.com

Review URL: https://codereview.chromium.org/1157163009
2015-06-03 15:42:34 -07:00
Adam Barth
6d5227ea0c Make Drawer in components2 work
This CL introduces RenderStack and fixes a number of bugs to make the Drawer in
components2 work.

R=ianh@google.com, eseidel@chromium.org

Review URL: https://codereview.chromium.org/1147143005
2015-06-03 14:52:13 -07:00
Hixie
926eafbf47 Fix scaffold to work for the toolbar.
Also, make the scaffold code more generic (with slots in a map,
instead of dedicated members for each slot).

This may eventually benefit from being split into a general
"multislot" superclass and a scaffold-specific subclass, but for now
it'll do.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1152163007
2015-06-03 14:50:32 -07:00
Matt Perry
8c097b0892 Update BoxDecoration and RenderParagraph to use sky.Color instead of int.
Also add operator==, hashCode, toString, and some basic Color constants to
Color.

R=abarth@chromium.org, ianh@google.com

Review URL: https://codereview.chromium.org/1162023004
2015-06-03 16:57:04 -04:00
Eric Seidel
d9ed864cc9 Give the Stocks2 App a new improved toolbar.
Looks horrible.  But it's a start.

R=abarth@chromium.org, ianh@google.com
BUG=

Review URL: https://codereview.chromium.org/1146913005
2015-06-02 16:13:31 -07:00
Adam Barth
898273c7b2 Implement Container in fn2
This CL is a first pass at implementing container in fn2. In this approach,
Container is a Component that builds a number of RenderNodeWrappers depending
on what is needed.

R=ianh@google.com

Review URL: https://codereview.chromium.org/1158983005
2015-06-02 15:07:02 -07:00
Hixie
e8cafd9d71 Rename rendering/render_*.dart to rendering/*.dart
R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1166773003
2015-06-02 13:55:20 -07:00