33 Commits

Author SHA1 Message Date
Hans Muller
0f7c0d6434 Example test for CardCollectionApp (Dismissable, VariableHeightScrollable)
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1238513003 .
2015-07-13 15:28:27 -07:00
Hixie
442c55b4c4 Make the drawer, popup menus, dialogs, and settings page scrollable.
Also, fixes the stocks list to work properly including hit testing at
the bottom of the screen.

New classes:

RenderViewport: a class that supports positioning a child inside
itself and offsetting it.

Viewport: a RenderObjectWrapper that wraps RenderViewport.

ScrollableViewport: a Component that hooks Viewport up to some
scrolling behaviour.

Code changes:

RenderBlock now only works when it has an unbounded height constraint.
I removed the clipping in there since it's no longer needed.

I made FixedHeightScrollable use Viewport instead of hand-rolling its
clipping with Transform and Clip. This is what fixes the stocks list
hit testing at the bottom of the screen.

I made anywhere that used to use Block now use ScrollableViewport.

RenderFlex now takes a list of children.

Justifications for test changes:

tests/examples/stocks: changing FixedHeightScrollable to use a
RenderViewport instead of a RenderClipRect/RenderTransform combination
removes the use of an actual transform.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1223153004 .
2015-07-10 16:54:19 -07:00
Matt Perry
c73f65312b Fix test failures from AnimatedContainer patch.
- Needed to move properties into AnimatedContainer to create a full BoxDecoration.
- Updated test expectations because backgroundColor animates now.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1224223004 .
2015-07-09 15:26:39 -04:00
Adam Barth
92132213f1 Rebaseline tests after f66984e72a2b5db0f7c4db4f05829118defe6640
TBR=mpcomplete@google.com

Review URL: https://codereview.chromium.org/1230893002 .
2015-07-09 12:11:16 -07:00
Ian Fischer
caafb616dc Change all child.paint calls to canvas.paintChild and update the test results.
R=abarth@chromium.org, abarth@google.com, ianh@google.com

Review URL: https://codereview.chromium.org/1208993020 .
2015-07-08 12:48:20 -07:00
Collin Jackson
fe8c1e6b52 Tab bar should have white indicator if primary and accent color are the same
R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1215313004 .
2015-07-07 15:35:19 -07:00
Collin Jackson
07d3108e86 Use red as floating action button color rather than accent color
R=ianh@google.com

Review URL: https://codereview.chromium.org/1222243007.
2015-07-06 16:04:42 -07:00
Adam Barth
3dd427d6f5 Update test expectations after view padding change
We no longer have view padding during testing so these values change a bit.

TBR=ianh@google.com

Review URL: https://codereview.chromium.org/1225703003.
2015-07-06 12:40:19 -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
Matt Perry
604c13d57f Fix test failures from my previous animation patch.
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1216923008.
2015-07-01 19:02:24 -04:00
Hans Muller
aecdef8ac2 Add a TabNavigator to the Stocks demo
Changed FixedHeightScrollable so that if the list shrinks past the current scrollOffset, the scrollOffset is adjusted so that the last/only page of the list remains visible.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1216323002.
2015-06-30 17:08:14 -07:00
Hans Muller
42490925a6 Fix tabs.dart test results
TBR=abarth

Review URL: https://codereview.chromium.org/1214413002.
2015-06-30 13:32: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
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
Ian Fischer
c4db2df60f Rename RenderCanvas to PaintingCanvas to avoid confusion with other classes that inherit from RenderObject.
R=ianh@google.com, abarth@google.com

Review URL: https://codereview.chromium.org/1217933002.
2015-06-29 14:19:30 -07:00
Hixie
6818693903 Fix tests which broke in https://codereview.chromium.org/1216013003.
Actually the tests broke in 136e0d4da5
...but I had reset the results because I had changed all the coordinates, and didn't realise some of the changes were bad.

TBR=abarth

Review URL: https://codereview.chromium.org/1212803003.
2015-06-29 14:04:58 -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
Hans Muller
dcabb54ad9 Make TabBar conform to the Material spec for icon/text tabs
When both icons and text are specified, the icon goes on top,
10 pixels of margin goes in between, and the TabBar's height
grows to 72.

R=ianh@google.com

Review URL: https://codereview.chromium.org/1213043002.
2015-06-26 16:16:00 -07:00
Hixie
fa70eb0982 Split Size into Size and Offset.
Added a OffsetBase class that Size now inherits from, and added a new
Offset class that also inherits from OffsetBase.

Offset has:
 - dx and dy members
 - zero and infinite static constants
 - a method that returns a new Offset that's the existing one scaled
   by a scalar
 - a unary minus operator
 - operators overloads such that subtracting or adding two Offsets
   gives another Offset
 - a toPoint() method

Added Offset and Size to the dart bindings, so they can be used from C++.

Changed the Canvas API to use Point, Size, and Offset where appropriate:
 - drawLine uses Points now
 - drawCircle uses a Point now
 - drawImage uses a Paint now
 - the constructor uses a Size

Changed Point as follows:
 - added a unary minus
 - Point difference now gives an Offset rather than a Size
 - You can add an Offset to a Point to get a new Point
 - toSize() has been replaced by toOffset()

Changed Rect as follows:
 - renamed upperLeft and lowerRight to topLeft and bottomRight for
   consistency with our other APIs
 - added bottomLeft and topRight for completeness

Changed Size as follows:
 - now inherits from OffsetBase
 - added *, /, ~/, and % operators for scaling sizes
 - subtracting a Size from a Size gives an Offset
 - subtracting an Offset from a Size gives a Size
 - changed the + operator to take an Offset instead of a Size
 - added topLeft, bottomLeft, topRight, bottomRight to match Rect
 - added center for the same reason
 - added shortestSide getter since that was a common pattern
 - removed toPoint()

Changed DrawLooperLayerInfo as follows:
 - setOffset member takes an Offset instead of a Point

Changed BoxConstraints as follows:
 - added biggest getter since it was a common pattern
 - added smallest getter for symmetry

Changed BoxShadow as follows:
 - offset member is an Offset rather than a Size

Changed ViewConstraints as follows:
 - replaced height and width members by a single size member

I did some minor code cleanup in nearby files while I was there,
including sorting sky/engine/core/core.gni alphabetically, and fixing
some warnings in the examples.

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

Review URL: https://codereview.chromium.org/1214833004.
2015-06-26 15:21:29 -07:00
Ian Fischer
6ae1de6c46 Move sky/examples to sky/sdk/lib/example, and code changes to support that change. Fixes T277.
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1218593002.
2015-06-26 15:06:40 -07:00
Hans Muller
ce7e8260c3 Use Theme to define the colors and TextStyles for Tab, TabBar
Also added a smoke test for examples/widgets/tabs.dart.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1213873002.
2015-06-26 09:30:53 -07:00
Hixie
a2ba25d0ba Add support for line-height in TextStyle.
Also, some minor cleanup in TextStyle to make it more readable.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1203253002.
2015-06-24 13:25:17 -07:00
Ian Fischer
1799eacef5 Decouple Canvas from DisplayList and map Picture and PictureRecorder more directly to their Skia counterparts.
Also changes the framework dart code to use the
refactored APIs and fixes the various examples and
tests.

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

Review URL: https://codereview.chromium.org/1190123003.
2015-06-24 10:21:45 -07:00
Collin Jackson
5ab01574f4 Add Material light and dark themes to Sky widgets
R=ianh@google.com, hixie

Review URL: https://codereview.chromium.org/1204523002.
2015-06-22 17:14:27 -07:00
Hans Muller
2b126efbc8 StyledText is just a convenient way to specify a
tree of InlineStyle and InlineText elements.
StyledText builds an Inline that renders the tree.

For example this StyledText object:

  new StyledText(["FOO", [boldLargerStyle, [greenStyle "BAR"], "BAZ"] BORF]);

Renders the same way the following HTML would,
assuming that TextStyles boldLargerStyle and
greenStyle were defined.

<style>
div {
  display: inline;
}
</style>
<p>
  <div>
    FOO
    <div style="font-weight:bold; font-size:larger">
      <div style="color:green">
        BAR
      </div>
      BAZ
    </div>
    BORF
  </div>
</p>

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1194693002.
2015-06-18 14:35:11 -07:00
Hixie
ee4a7bc925 Rename editing2/ and theme2/ to editing/ and theme/.
Flesh out a README.md file for the SDK.
Make the stocks app test wait for the app to be mounted, to catch some more errors, like typos in the mount callback.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1182053012.
2015-06-18 12:44:10 -07:00
Matt Perry
edff56d399 Add a Paint::toString() method to describe our Paint objects.
Add a test for RenderDecoratedBox sets up the Paint object correctly.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1185423003.
2015-06-18 13:47:28 -04:00
Hixie
0038e78ed6 Rename AppView to SkyBinding.
Move app/view.dart to rendering/sky_binding.dart since it's part of the RenderObject API, really (it knows about RenderView intimately).
The tests pass. I didn't check every last example.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1183913006.
2015-06-17 17:07:31 -07:00
Hixie
da3e55c837 Add a test for the sector app.
This also moves the test for stocks into a new tests/examples/
directory, where we can put tests that test the examples.

TBR=abarth

Review URL: https://codereview.chromium.org/1182223004.
2015-06-17 15:44:20 -07:00