Commit graph

141 commits

Author SHA1 Message Date
Ian Hickson 8b6bd844cf Merge pull request #1376 from Hixie/toggleable
Make the checkbox in the stocks popup menu work.
2015-09-29 17:08:36 -07:00
Hixie 4620b63226 fn3: toString() and toStringDeep() debugging aids 2015-09-28 17:09:26 -07:00
Hixie 066768f096 Make the checkbox in the stocks popup menu work.
Tapping on the menu item didn't animate the checkbox because the menu
takes 300ms to animate entirely away while the checkbox takes 200ms to
animate checked, and since the item with the checkbox was at the bottom,
we were only seeing about 60ms of the entire checkbox animation, which
isn't enough to notice it. So I moved it to the top of the menu.

Tapping on the checkbox didn't animate because nothing caused the menu
to rebuild when the callback was invoked. To trigger a rebuild, I now
call navigator.setState() explicitly, after changing out local state.

To make tapping the checkbox remove the menu, I also explicitly call
navigator.pop() in the code that handles the check. (I still explicitly
change the checkbox to show that that's possible. In principle one could
just treat the checkbox as an inert widget that happens to trigger pop,
and do all the checking/unchecking in the switch statement.)

I also made some minor style tweaks to files I was looking at while
dealing with this issue.
2015-09-28 11:15:05 -07:00
Hixie 56d4033423 Make the FAB move up when a Snack Bar slides in.
This changes how SnackBar works so you can use it anywhere, not just on
the bottom edge of the screen (it used to rely on overflowing its bounds
and having negative offsets... I'm not really sure how hit testing
worked on it before!).

To do this I introduced a new RenderBox, RenderOverflowBox, that lets
you set your child's size independent of your own. I needed this so that
the snack bar could use a SquashTransition to change its size, while not
affecting the layout of its child. This is exposed as OverflowBox in
fn3. I'm not sure if it's the best API. It doesn't let you position the
child (which is an issue if the size you give is smaller), it doesn't
let you give a loose constraint (which maybe you might want?). But it
handles this use case, so for now it's probably ok.

Making the FAB get repositioned out of the way of the Snack Bar is now
done in the Scaffold, which is in charge of positioning both of those
and is the place that knows that both exist.
2015-09-28 10:19:22 -07:00
Hixie 0a0a92eb45 Port stocks to fn3 and introduce an App component. 2015-09-25 17:52:33 -07:00
Adam Barth 051354ae1d Remove EventDisposition
All the use cases for EventDisposition are now addressed by the gesture
detection system.
2015-09-21 16:45:09 -07:00
Hixie a3ae46b97e Introduce a showPopupMenu() function
Instead of having to manage the popup menu from your app's build
function, you now just call showPopupMenu() with the menu's position and
it takes care of everything for you.

This solves the problem that the popup menu was trying to mutate the
state of the navigator from within its own initState() function.

Also, remove the "route" argument to RouteBase.build() since it equals
"this" by definition...

Also, remove ModalOverlay, and instead put that logic in the navigator.
2015-09-18 16:57:15 -07:00
Hixie e73bbd949e Require that you pass transitions a performance.
This fixes #1103.
2015-09-18 10:30:47 -07:00
Adam Barth 4467a268ce Move theme into material.dart
Also, introduce Colors and Typography to hold the material colors and the
typography declarations. Previously we expected clients of these libraries to
import them into a namespace, but that doesn't play nice with re-exporting them
from material.dart.
2015-09-18 09:57:21 -07:00
Adam Barth 7064551a45 Move mojo frontend into services.dart
What's important about this code is that it's presenting services outside the
VM, not the particular technology used to present the services.
2015-09-16 19:13:50 -07:00
Adam Barth b356d14635 Introduce package:sky/animation.dart
Move the animation libraries into src/animation and change importers to use
package:sky/animation.dart. Also, move scheduler.dart into the animation
library so that the animation library can be self-contained.
2015-09-08 09:44:01 -07:00
Adam Barth 318b69be10 Fold package:sky/editing/* into package:sky/widgets.dart
The editing directory just defined two widgets. We might as well fold them into
the main widgets library.
2015-09-07 10:07:41 -07:00
Hixie ce28a7176e Replace Flex to Row and Column in tests and examples.
This still leaves Flex and FlexDirection available. At some point once
people have transitioned to Row/Column we should rename Flex to _Flex
and stop reexporting FlexDirection from basic.dart.
2015-08-26 09:05:14 -07:00
Adam Barth 627b049216 Address review comments from #767
Mostly formating and removing arguments with default values.
2015-08-22 11:25:53 -07:00
Adam Barth 18248543cb DrawerItem, DrawerHeader should take a child instead of children
These widgets were designed in CSS where you need to specify a layout model for
your children. This patch updates them to the modern style of just taking a
unique child.

Fixes #755
2015-08-22 08:19:38 -07:00
Adam Barth b61fe238f5 Rename syncFields to syncConstructorArguments 2015-08-21 17:21:42 -07:00
Adam Barth 010589be9e Rename all the scrollable classes
Block -> BlockBody
ScrollableBlock -> Block
FixedHeightScrollable -> ScrollableWidgetList
VariableHeightScrollable -> ScrollableMixedWidgetList
BlockViewport -> MixedViewport
2015-08-21 14:39:41 -07:00
Adam Barth 51c7194075 Add SetRequestedOrientation to Activity service
Fixes #743
2015-08-21 12:49:49 -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 cd5715bbf3 Attempt to make our splashes closer to other Android apps
And also Material Design of course.

@abarth
2015-08-11 14:56:36 -07:00
Matt Perry 3d9f523179 Scaffold: animate the FloatingActionButton with the SnackBar.
This introduces the concept of an Anchor, which you can use to link
transitions together. I've used this in the Fitness and Stocks apps to
link the FAB and SnackBar to animate together by sharing the
SlideTransition.

I also fixed the Scaffold hit testing code to apply sub-widget
transforms, so it works with Transformed nodes.
2015-08-11 17:21:20 -04: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
Eric Seidel 6b3840e384 Move image loading out of C++ into Dart
We already know how to talk to the network_service from Dart
via fetch.dart.  Might as well use that for Image loading
as well insetad of having ImageLoader do it.

As part of this I've renamed *ImageLoader to *ImageDecoder
and moved all the image loading logic into Dart.  This required
me to teach the idl system about mojo handles so that I could
pass the resulting MojoHandle from fetch.dart up through to
ImageDecoder.

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

Review URL: https://codereview.chromium.org/1173703002.
2015-06-09 12:14:13 -07:00
Hixie 9523283bb4 [Effen] Rename Action Bar to Tool Bar.
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1133353008
2015-05-19 15:52:12 -07:00
John McCutchan 204298278a Suppress unnamed library analyzer spam in shelldb
Revert "Add library names to many sky libraries"

This reverts commit 1337e0a803a54ee92d6dce7f8c4a6335f7cbb9fa.

BUG=
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1142893007
2015-05-19 10:25:43 -07:00
John McCutchan 5d3bfd6108 Add library names to many sky libraries
- Analyzer complains about libraries not having names. This adds names to many libraries.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1150433002
2015-05-19 10:19:11 -07:00
Hixie 4c15a9688f [Layout] Put in some guards to prevent us from reintroducing 'display' properties into the CSS.
R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1132983007
2015-05-15 15:16:25 -07:00
Hixie 2be9ca104b [Effen] Make the stock app use the radio button widget so that it's being tested.
Changes:
- adds a couple of radio buttons to the drawer menu list.
- makes menu items support being tapped and reporting the tap.
- hooks up the checkbox to actually support being checked.
- changes the drawer menu items to make more sense in a stock app.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1137373004
2015-05-14 13:16:35 -07:00
Hixie 156179769d [Effen] Make the drawer not be included in the build output when the drawer is not shown.
This is a prerequisite to dropping 'display:none'.
Included in this CL is making AnimatedValue able to animate more than one field.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1126333006
2015-05-14 09:44:22 -07:00
Hixie 09183a7fd1 [Effen] Use the checkbox widget in the stocks app.
- add a checkbox to the stock app, so that we're testing the checkbox widget
  (it's not currently wired up to anything, that can come later)
- make InkSplash use FlexContainer so that we can use flex in the popup menu items
- make effen's Text be more similar to Image and Container, so that it can be styled
- make layout.dart's RenderCSSText correctly support being styled
- also fixes a bug with the stock list where we were rendering one too few a row when scrolling
- check in the code to dump the DOM so I don't have to keep remembering how to do this

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1134163003
2015-05-12 14:39:43 -07:00
Eric Seidel f32b32343d Rename view-configuration to view_configuration to make analyzer happy.
Analyzer was complaining about '-' not being an allowed character
in dart file names.

R=jamesr@chromium.org
2015-05-04 14:18:19 -07:00
Hixie ab3b684f23 fix 'feeback' typo in stock app in menus
TBR=eseidel

Review URL: https://codereview.chromium.org/1065653009
2015-04-21 14:32:22 -07:00
Hixie 4398883334 [Effen] fix warnings
remove members that are never read
remove imports that are never used

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1099203002
2015-04-21 14:05:28 -07:00
Hixie ebc879babf [Effen] Prevent scrolling past the bottom of a scrollable list.
- make the ScrollBehavior instance long-lived, rather than recreating
  it each time we update the list contents.
- have OverscrollBehavior track the total height of the contents and
  the height of the scrollable region, so that it can determine when
  to stop scrolling down.
- teach OverscrollBehavior about how to determine when to stop
  scrolling down, and how to bounce when it's too far down.
- replace the 'energy' concept in Particles with a method that sets
  the energy and direction at the same time, instead of assuming that
  the direction is always positive when setting energy.
- make FixedHeightScrollable lists track the number of items in the
  list and have them update their ScrollBehavior regarding this
  information as it changes.
- track how many items are currently showing in the list stock list.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1097373002
2015-04-21 13:20:30 -07:00
Hixie 23283319bc [Effen] Only skip rows we're showing, when skipping past the rows that we've scrolled beyond in the stock list.
Currently, if you then scroll down N items with a filter set, we select which
stock to show by taking the entire list of stocks, skipping the first N, then
filtering the list, then selecting as many stocks as needed to fill the list.

So suppose the list is A, B, Cx, Dx, Ex, F, and the filter is "x", and you've
scrolled down 1 item.

Currently we'd show Cx, Dx, Ex.

Scroll down 1 again.

We still show Cx, Dx, Ex.

What we _should_ show is Dx, Ex if you've scrolled down 1, and just Ex if you've
scrolled two.

This patch fixes this. We now skip rows _after_ filtering. This fixes
the bug whereby if you set a filter then fling the list, we show the
same item over and over as if in a loop.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1057603006
2015-04-20 16:35:49 -07:00
Ojan Vafai a03a911e7c Remove all uses of display:block and display:inline-block.
-Make display:flex, flex-direction: column, flex-shrink: 1 the default.
-Simplify StyleAdjuster::adjustStyleForAlignment to remove special cases we
won't need as we make flex the default and remove absolute positioning.
-Fix a bug this exposed in column flexboxes where we'd apply the wrong edge
of border/padding/margin.
-For now leave the default of align-items:stretch. The main change here is
that iframe/img will do width:auto the same as blocks (i.e. the width of
the parent). I think this is a good change, but we'll have to see how it feels
in practice.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1061163002
2015-04-06 16:44:12 -07:00
Hixie fd14a1d0f2 [Effen] s/Node/UINode/, s/Element/WrapperNode/, s/EventTarget/EventListenerNode/
R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1043283003
2015-04-01 09:46:28 -07:00
Adam Barth 854f083f1b Clean up examples directory
1) Merge input example into widgets example
2) Move single-file, non-fn examples into a "raw" directory
3) Rename stocks-fn and widgets-fn to stocks and widgets

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/1005393006
2015-03-26 14:32:40 -07:00