Commit Graph

68 Commits

Author SHA1 Message Date
Hans Muller
d662f7e6d2 Handle changes to scrollDirection in ScrollableList et al
Changed the pageable_list.dart example: tapping on the toolbar changes
the scroll direction. This exposed some problems:

- Scrollable.syncFields() didn't update scrollDirection
- Viewport updated its RenderObject fields in the wrong order
- FixedHeightScrollable scrollDirection changes didn't update the scrollBehavior

There may be similar problems with VariableHeightList and ScrollableViewport.
I will fix those in a separate CL.
2015-08-20 08:24:16 -07:00
Hans Muller
cf164071c7 Dismissable: correct handling of a drag that ends with a fling 2015-08-19 10:48:26 -07:00
Hans Muller
7782a11534 Adds PageableList, other scrolling related changes and fixes
- PageableList extends ScrollableList
One fixed width or height item is visible and centered at a
time. Fling and drag gestures scroll to the next/previous item.

- Scrollable.scrollTo(), Scrollable.scrollBy(), ensureWidgetIsVisible() API changed
The named animation parameter for these methods was replaced by
duration and curve. All of the methods now return a Future. The Future
completes when the scroll does.

This change eliminates the need for Scrollable to temporarily take ownership
of a ValueAnimation object (see #645).

- Using Future.then() instead of an AnimationPerformance status listener
In ensure_visible.dart _handleTap() uses ensureWidgetIsVisible() to
center the card roughly as before and then. When the implicit scroll
animation is complete, it changes the centered card's label font. The
change is made when the Future returned by ensureWidgetIsVisible()
completes.

- FixedHeightScrollable's itemHeight parameter is now itemExtent
If scrollDirection is ScrollDirection.vertical (the default) then itemExtent should
be the height of each item; otherwise it should be the width of each item.

Replaced _velocityForFlingGesture() in scrollable.dart with Scrollable._eventVelocity()
The original version clamped pixels/ms against pixels/sec constants. The new version
also deals with scrollDirection.

- Plumbed scrollDirection though FixedHeightScrollable and ScrollableList

Both classes should now support horizontal scrolling.
2015-08-19 10:14:21 -07:00
Adam Barth
dea3a0922c Add package:sky/rendering.dart
Similar to widgets.dart, rendering.dart exports the entire rendering layer.
Also, update the examples to use rendering.dart and widgets.dart. Also clean up
some exports so that the examples have more sensible imports.
2015-08-18 21:39:51 -07:00
Adam Barth
50bfdedbf4 Split box.dart into many files
Sadly, box.dart has grown much longer than 1000 lines. This patch splits it up
into several files based on the class hierarchy. Fortunately, many of these
classes are loosely coupled to each other.
2015-08-18 20:55:32 -07:00
Eric Seidel
74a14d2aca Merge pull request #659 from eseidelGoogle/analyzer
Fix analyzer warnings
2015-08-17 14:34:54 -07:00
Eric Seidel
d5fe622a22 Fix analyzer warnings
We had a remarkable number of analyzer failures.

I'll fix the bots to analyze across the whole project
in a follow-up patch, that should prevent this
in the future.

@abarth
2015-08-17 14:32:29 -07:00
Adam Barth
91a783bf62 Rename Widget.root to Widget.renderObject
The name `root` is confusing because this value isn't the root of anything.
It's just the associated `RenderObject` instance.
2015-08-17 14:15:26 -07:00
Adam Barth
ac0ec3221b Add support for drag-and-drop
Widgets that want to receive drops should include a DropTarget in their build.
Currently there's no widget for initiating a drag. Components can use the
DragController directly. In the future, we'll probably want to add a Draggable
that knows how to do some of this work automatically.

Fixes #612
2015-08-17 14:06:19 -07:00
mpcomplete
0c05c97e20 Merge pull request #597 from mpcomplete/value.animation
Add a ValueAnimation helper class for AnimationPerfomance.
2015-08-14 12:03:27 -04:00
Hans Muller
babe380f0d Adds CicularProgressIndicator and LinearProgressIndicator
Setting a ProgressIndicator's value to null (the default) makes it an "indeterminate progress" or activity indicator.

The indeterminate animations for both kinds of progress bars are essentially the same and wrong vis the Material Design spec, http://www.google.com/design/spec/components/progress-activity.html. I'll improve conformity with the visual design in a future CL.
2015-08-13 16:15:21 -07:00
Matt Perry
82d84c766f Add a ValueAnimation helper class for AnimationPerfomance.
Used for AnimationPerformance with a single AnimatedValue<T> variable.
2015-08-13 17:29:32 -04:00
Hans Muller
9e9d845b1f Adds ensureWidgetIsVisible() function to scrollable.dart
Set the scrollOffset of a widget's Scrollable ancestor so that the
widget is centered within the scrollable. A future CL will add
support for specifying exactly where the widget appears. The scroll
can be animated by specifying the animation: parameter.

Changed the duration Scrollable.scrollTo() parameter from a Duration
to an AnimationPerformance so that one can configure all aspects of
the animation. The caller may also listen to the animation to schedule
other work while it updates or when its status changes.
complete
2015-08-11 16:49:48 -07:00
Hans Muller
d2d9ae134d The IgnorePointer class enables one to cut a widget subtree off from pointer events. This is useful when a sibling should not shield pointer events from overlapping siblings below it.
Added a ScrollListener listener to Scrollable. The ScrollListener runs each time the Scrollable's scrollOffset changes. This can be used to keep overlay widgets in sync with a Scrollable below them.

Removed the Scrollable ScrollClient API. It was no longer used and was clumsy to use as a ScrollListener.

Added global function findScrollableAncestor() to scrollable.dart.

Added examples/widgets/overlay_geometry.dart. The app's Scaffold is contained by a Stack. The Stack is used to display green overlay "Markers" at the corners of the most recently selected list item and where the corresponding tap occurred. The app uses widget.localToGlobal() to compute the global overlay positions of the markers. The ScrollListener is used to keep the markers' positions up to date.
2015-08-11 08:29:30 -07:00
Ian Fischer
6d19b7a425 pubspec.yaml files for the smaller demos. 2015-08-10 17:13:17 -07:00
Ian Fischer
d44ed7dfc3 Move example out of sky/packages to //examples 2015-08-07 17:04:50 -07:00
Ian Fischer
82404e030a 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
75f1c05b85 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
12b21997ca Let's hide double.INFINITY a bit more, by providing cleaner APIs for the cases where we're currently trying to use it.
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1209233002.
2015-06-25 17:27:43 -07:00
Hans Muller
ab246ebcef Version 0 of TabLabel, Tab, and TabBar components
There's is no support for animating the selected tab indicator, there isn't a TabNavigator container yet, overflow layout (tabs don't fit) isn't supported yet, etc.

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

Review URL: https://codereview.chromium.org/1205953002.
2015-06-25 14:25:33 -07:00
Hixie
a7f7e1e564 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
Collin Jackson
3616adbab3 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
Collin Jackson
6c38fc1b40 Add a new Theme widget to control color and text color of apps
R=abarth@chromium.org, abarth, hixie

Review URL: https://codereview.chromium.org/1194743003.
2015-06-22 12:10:30 -07:00
Hixie
5b594b7c7c Turn on wavy underlines. The waves aren't very pretty yet (they are too short somehow), I'll fix that in a subsequent CL.
I abstracted out the wavy underline code so that it doesn't duplicate the code for horizontal and vertical lines.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1201503003.
2015-06-19 16:11:18 -07:00
Hans Muller
0dd98719dc Adds TextStyle decoration, decorationColor, decorationStyle
Currently only the decoration property is actually translated to a CSS style.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1174213005.
2015-06-19 10:30:38 -07:00
Collin Jackson
dbb876b22b Make back button control drawer in stocks app
Currently you lose your scroll and drawer state when coming back from the settings pane.
I think we should solve this by having the Navigator maintain a Stack and
keeping the StockHome alive underneath it. But this is good enough for a first iteration.

R=abarth@chromium.org, abarth

Review URL: https://codereview.chromium.org/1191153002.
2015-06-18 15:36:04 -07:00
Hans Muller
59c4078a09 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
82fc647c12 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
Hixie
d2d11a04a1 Cleanup of SkyBinding, and resultant yak shaving.
Some files are moved by this:
  Copy framework/node.dart into types/ - preparing for framework/'s decomissioning.
  Move app/scheduler.dart into sky/scheduler.dart - "app" doesn't really make sense.

As part of the SkyBinding cleanup, I made the hit-testing less
RenderBox-specific, by having the HitTestEntry.target member be a
HitTestTarget, which is an interface with the handleEvent() function,
which is then implemented by RenderBox. In theory, someone could now
extend hit testing from the RenderBox world into their own tree of
nodes, and take part in all the same dispatch logic automatically.

This involved moving all the hit testing type definitions into a new
sky/hittest.dart file.

Renamed SkyBinding._app to SkyBinding._instance for clarity.

Moved code around in SkyBinding so that related things are together.

Made WidgetSkyBinding use the existing SkyBinding.instance singleton
logic rather than having its own copy.

I also added some stub README.md files that describe dependencies.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1187393002.
2015-06-17 19:54:11 -07:00
Hixie
5136d5209b 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
6bec75ad2b 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
Hixie
1133260198 Remove keys from the examples.
TBR=abarth

Review URL: https://codereview.chromium.org/1194473004.
2015-06-17 15:23:41 -07:00
Adam Barth
99e115d06c Settings menu item in stock2 doesn't work
The underlying problem is that we lacked a RenderObjectWrapper for the
RenderView, which meant we couldn't handle changing the RenderObject that was
the root of the RenderView. This CL introduces a RenderViewWrapper and uses it
in a new AppContainer widget root. This change allows us to make App a
non-magical Component that is inserted into the AppContainer in the newly
introduced runApp function.

R=ianh@google.com

Review URL: https://codereview.chromium.org/1184823006.
2015-06-17 12:36:56 -07:00
Collin Jackson
2460ce37b0 Refactor Navigator to put state in separate class, initial back button plumbing
R=abarth@chromium.org, abarth

Review URL: https://codereview.chromium.org/1195493002.
2015-06-17 12:21:08 -07:00
Collin Jackson
cc76b90450 Add back/forward history to navigation
R=abarth@chromium.org, abarth, hixie

Review URL: https://codereview.chromium.org/1181773006.
2015-06-16 16:14:55 -07:00
Hixie
db90d5f046 Rename UINode to Widget.
Also, move a widget example from examples/raw/ to examples/widgets/

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1190793002.
2015-06-16 11:09:16 -07:00
Hixie
249dc8aff5 Create an example app that demonstrates interactive coordination of an fn tree and a raw RenderObject tree.
Sector changes:
- implement the intrinsic sizing box API on RenderBoxToRenderSectorAdapter
- remove some debug print statements
- fix getIntrinsicDimensions() on RenderSolidColor to return true values
- factor out the default demo

RenderObject changes:
- BoxConstraints.isInfinite() now returns true only if both dimensions are infinite

fn changes:
- implement UINodeToRenderBoxAdapter
- rename RenderObjectToUINodeAdapter to RenderBoxToUINodeAdapter

Tests:
- add a test for sector layout
- make TestRenderView support being run without the unit test framework

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1175423007.
2015-06-16 09:28:59 -07:00
Adam Barth
395f92ba08 Make UINode's key a String
We need the key to be a String even though we claimed we could support any
Object. Also, clean up some style nits including shortening the |root| getters
on OneChildRenderNodeWrappers.

Fixes https://github.com/domokit/sky_sdk/issues/26.

TBR=ianh@google.com

Review URL: https://codereview.chromium.org/1173293005.
2015-06-15 21:39:09 -07:00
Adam Barth
4ca9ab2214 Give ParentDataNodes snappier names
FlexExpandingChild -> Flexible
StackPositionedChild -> Positioned

Also, name the child argument |child| for consistency.

TBR=ianh@google.com

Review URL: https://codereview.chromium.org/1179763009.
2015-06-15 21:03:28 -07:00
Hixie
bb683e03f6 Make RaisedButton support being disabled.
R=jackson@google.com

Review URL: https://codereview.chromium.org/1179943005.
2015-06-15 17:32:13 -07:00
Adam Barth
17d3b4957a Rename all the things
This CL moves the bulk of the SkyView code out of the |framework| directory
because the |framework| directory was redundant in Dart package import
declarations.

TBR=ianh@google.com

Review URL: https://codereview.chromium.org/1177383006.
2015-06-13 09:46:52 -07:00
Adam Barth
fe6fa66aab Rename widgets/wrappers.dart to widgets/basic.dart
Although the basic widgets are wrappers, that's an implementation detail and
shouldn't be encoded in the name of the library.

TBR=ianh@google.com

Review URL: https://codereview.chromium.org/1182983002.
2015-06-12 22:16:48 -07:00
Hixie
1f07f3355d Verify that callers correctly set parentUsesSize if they use the child's size (and fix a few cases that didn't).
This introduces a bunch of code that should only run in debug builds, but we don't have #ifdefs yet.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1182933003.
2015-06-12 17:09:57 -07:00
Hixie
d3f49f3111 Make it easier to debug examples/widgets/container.dart, since it is currently showing a crazy clipping/transform bug.
TBR=abarth

Review URL: https://codereview.chromium.org/1186653003.
2015-06-12 15:17:33 -07:00
Hixie
ef1b69d757 Material and RaisedButton.
Make Material actually create material, with opinions about what that
means.

Make FloatingActionButton use this.

Make Scrollable use this.

Make BoxDecoration support drawing a circle instead of a rectangle, so
that floating action button doesn't need a custom painter.

Implement RaisedButton (and remove button.dart, since there's no
"button" in Material Design).

Make InkWell have a "child" argument instead of "children", and not
have it introduce a Flex into the hierarchy.

Update container.dart example. Clean up some imports.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1179713004.
2015-06-12 11:46:08 -07:00
Hixie
34e7b69a79 Add an example of an app that manipulates both a RenderObject tree and has some fn logic in it.
Also:
 - Make RenderProxyBox non-abstract
 - Upgrade the old container.dart example
 - Minor fixes to ui_mode.dart to make this work

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1183503003.
2015-06-11 13:08:00 -07:00
Hixie
5d676f8549 Refactor fn2.dart, since it breached our 1000-line threshold.
This moves input.dart to editing2/, since that way we can define the layering as strictly unidirectional.
It also reorders a bunch of imports to fit the style guide.
I removed the old remnants of the widgets example, and put the fn2 examples into the examples/widgets/ directory, to parallel the framework directory names.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1177243002.
2015-06-11 10:26:11 -07:00
Collin Jackson
c6a1a066f2 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
Eric Seidel
d12f84c818 Add pubspec.yaml files for each of the examples/ directories
so that pub get will create a packages/ directory for each
and users of packages/sky/sky_tool can run these examples
from sky_sdk as the instructions say to.

TBR=ianh@google.com
https://github.com/domokit/mojo/issues/128

Review URL: https://codereview.chromium.org/1110283002
2015-04-28 16:26:38 -07:00
Eric Seidel
38472e4e87 Remove Widgets Demo, it's broken and doesn't provide any value over Stocks App
R=ianh@google.com, ojan@chromium.org

Review URL: https://codereview.chromium.org/1085933002
2015-04-14 14:47:21 -07:00