17 Commits

Author SHA1 Message Date
Eric Seidel
589290add1 Deploy TaskDescription to the rest of our demos
R=abarth@chromium.org, abarth@google.com

Review URL: https://codereview.chromium.org/1218293017 .
2015-07-07 14:31:52 -07:00
Hixie
3164520701 Fix spinning_mixed.dart, and resulting yak shave.
The initial fix was updating Image to NetworkImage, which is the new
name for the Widget that takes a URL to an image.

However, this exposed an underlying bug: slots given to
MultiChildRenderObjectWrapper children were not getting updated in the
initial build. Initially, we don't have a next sibling for any of the
children's roots, since we haven't yet synced anyone after the one
we're syncing. So we pass null. However, as soon as we build the next
one, the previous one now has an out of date slot: null means
"append", but it needs to be "insert before the newly inserted root of
the next child". So now we update the slot after each insertion.

This returned the spinning_mixed demo to its original state, but that
state was buggy: the image would expand to fit the button and push the
text out of the button. To resolve that, this patch changes how
RenderImage sizes an image that has no desired dimensions but has some
constraints that make it impossible to show the image at full size:
now, we try to maintain the aspect ratio and honour the constraints
all at the same time.

Also, if the constraints are tight we skip all that logic, because
it'd be a waste of time.

To help with the slot issue above, I needed to see the widget tree and
the render tree and compare them (to see where the nodes were getting
out of order), so I also extended Widget.toString() to dump a deep
tree of the widget hierarchy.

Also, while debugging all this I noticed we sometimes walk the tree
into nodes that are null, which causes crashes. So to avoid that I
added null-checks to certain walkChildren() functions.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1212943007.
2015-07-06 17:31:22 -07:00
Adam Barth
d94e1d6255 Move home.dart into example/demo_launcher
This CL makes home.dart less of a special snowflake and instead makes it a peer
to the other Sky examples. As a result, we can add a sky.yaml file and embed
the thumbnail assets it needs into demo_launcher.skyx.

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

Review URL: https://codereview.chromium.org/1215703010.
2015-07-06 14:49:03 -07:00
Hixie
00dd5d3e99 When syncing a child, we have to update the parent in all cases.
This:

- Adds asserts all over the place to make sure things are working
  right with respect to the parent pointer.

- Fixes the bugs those asserts uncovered. It turns out we were failing
  to update the parent pointer in a couple of cases: when the child
  hadn't changed (but the parent had), and when the node was replaced.

- Remove the operator[] nonsense in scaffold.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1218183009.
2015-07-06 14:16:17 -07:00
Hans Muller
c06fc9580a Scrollable TabBar Version 0
TODO:
- Make fling-scrolling work
- Tune scrolling performance
- When a tab is selected, snap it to the center if possible

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1221673006.
2015-07-06 10:23:31 -07:00
Collin Jackson
88b6042846 Refactoring to support dark theme better
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1218153005.
2015-07-06 08:05:29 -07:00
Adam Barth
7de453e634 Add skyx packages for all the Sky demos (except game)
This CL factors the skyx build logic out of sky/apk/rules.gni so that we can
build skyx bundles without building entire APKs. This change makes it possible
to build skyx bundles for all the examples (except game).

TBR=eseidel@google.com

Review URL: https://codereview.chromium.org/1222673003.
2015-07-02 17:07:44 -07:00
Adam Barth
70b8347fe1 Hoist knowledge of image_cache into widgets/basic.dart
Previously, RenderImage knew about image_cache and expected to work in terms of
URLs. Now RenderImage works directly with sky.Image and it's the job of the
widgets system to interact with the network cache.

At the widgets layer, I've factored this work into three parts:
1) A wrapper for RenderImage that works in terms of sky.Image.
2) A component that can deal with any sort of Future<sky.Image>.
3) A NetworkImage component that translates relative URLs into
   Future<sky.Image> using the image_cache.

A future CL will add a peer to NetworkImage that gets Future<sky.Image>s from
an asset bundle.

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

Review URL: https://codereview.chromium.org/1218023013.
2015-07-01 14:41:45 -07:00
Eric Seidel
834fb17258 Add a sky media service to make it possible to play a sound.
I didn't exactly follow the android API, but pretty close.

Also started a java/common implementation for things like
DataPipeUtils. I only needed the ability to copy from a data
pipe to a file, so that's the only function we have so far.

Fixes https://github.com/domokit/mojo/issues/270

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

Review URL: https://codereview.chromium.org/1211913005.
2015-07-01 12:29:40 -07:00
Hans Muller
28c753500a Gratuitous tabs example enhancement
Demo all three varieties of TabLabels in 3 different
TabNavigators. Use another TabNavigator to select
among the three Card-encapsulated demos.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1217243005.
2015-06-30 12:59:51 -07:00
Hixie
1351488a17 Remove Material's opinion about background colours, since in fact the background colour varies dramatically with the kind of material involved.
Also:
- give users of Material who previously relied on Material's defaults
  opinions about background colours
- reindent stock_row.dart
- import colors as colors in example/widgets/styled_text.dart, rather
  than in global scope, for consistency with other files
- import typography as typograpyh in example/widgets/tabs.dart, rather
  than in global scope, for consistency with other files
- make flat_button actually be transparent by not painting a
  background, rather than painting 0x00000000. This is the what I
  actually originally set out to do here.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1217293003.
2015-06-30 12:48:04 -07:00
Hixie
80d6a881ca Fix all the components to pick the right colours from the theme.
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1217573003.
2015-06-30 11:50:14 -07:00
Collin Jackson
ef6ebb7e76 Support for background images on cards, style demo home
R=ianh@google.com, abarth, hixie

Review URL: https://codereview.chromium.org/1217623002.
2015-06-29 16:22:22 -07:00
Hans Muller
ad3fae3931 Add TabNavigator
A simple container for a TabBar. It is defined by a list of
TabNavigatorViews, each of which is just a TabLabel and
the tab's content.

The content of each tab is represented by a function
that produces a Widget called "content". I couldn't
bring myself to call it buildTabContentCallback or something
else more specific.

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

Review URL: https://codereview.chromium.org/1212993003.
2015-06-29 10:03:28 -07:00
Hixie
6ed5b43877 Instead of applying a transform for every RenderObject, pass down an Offset for where to paint.
This should be a perf win, but I haven't tested it.

Also adds an operator overloading such that Offset + Size -> Rect.
Also adds Rect.fromLTWH().

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1209413004.
2015-06-29 09:07:13 -07:00
Adam Barth
46363355ba Cleanup sky/sdk/examples
* Remove all the DOM-based examples except for the old stocks app
* Rename stocks2 to stocks
* Promote hello_widgets.dart to a top-level hello_world example

TBR=ianh@google.com

Review URL: https://codereview.chromium.org/1219493003.
2015-06-27 00:00:18 -07:00
Adam Barth
06adbc9aa6 Move examples to //sky/sdk/example
We're trying to follow the pattern described in https://www.dartlang.org/tools/pub/package-layout.html

TBR=iansf@google.com

Review URL: https://codereview.chromium.org/1210173004.
2015-06-26 22:52:40 -07:00