Commit Graph

242 Commits

Author SHA1 Message Date
Collin Jackson
cd95d51c70 Example of setting the content type of a POST request 2016-01-26 12:24:33 -08:00
Hans Muller
8218ff683f Change Block children to be a named parameter 2016-01-22 08:04:21 -08:00
Adam Barth
b988a875ad Remove Performance and AnimatedValue
This patch removes Performance and AnimationValue now that we've ported the
framework over to AnimationController and Tween. This patch also cleans up the
names of the AnimationController classes now that they don't have to avoid
conflicts with the old animation API. Specifically, I've made the following
renames:

 * Animated -> Animation
 * Evaluatable -> Animatable
 * PerformanceStatus -> AnimationStatus

This patch is just renames and moving code around. There aren't any changes in
behavior.
2016-01-20 13:49:35 -08:00
Adam Barth
d25951c517 AnimatedBuilder should have a child
Providing a pre-built child is more efficient because we don't need to rebuild
the child every tick of the animation.
2016-01-20 09:10:34 -08:00
Adam Barth
0b098ee2e5 Move Scaffold over to using AnimationController
Also, clean up the class hierarchy for AnimationController now that
we've renamed progress to value. That means everything in the hierarchy
now has a value, include Watchable. This patch renames Watchable to
Animated<T>, which lets us use that type almost everywhere.

I've added some ducktape to modal bottom sheets to avoid having to
refactor all of Navigator to use AnimationController. I'll remove the
ducktape in the next patch.
2016-01-20 08:43:04 -08:00
Hans Muller
3f0cca02cb Revised Material Gallery demo 2016-01-19 17:02:32 -08:00
Adam Barth
fc978c1aa8 Port examples to the new animation API
These now use Animation and AnimationController instead of PerformanceView and
Performance.
2016-01-19 16:03:31 -08:00
Adam Barth
bc20871cb9 Introduce Tween and the new animation API
This patch removes state from the animation system, which was causing problems
as we were scaling the use of animated values.

Now the "tween" objects are stateless and can watch animations, which creates a
new object that holds both the tween and the animation instead of mutating the
tween every tick of the animation.

This patch ports one client as a proof-of-concept.

Fixes #215
2016-01-19 14:26:05 -08:00
Hans Muller
179ca8164e Upgrade progress_indicator demo defend against null color in updateTaskDescription 2016-01-15 08:41:57 -08:00
Hans Muller
cafea7f51f Floating Action Button transitions 2016-01-12 11:42:20 -08:00
Ian Hickson
867bbcc9bd Provide a safe time to update a WidgetToRenderBoxAdapter
If you change the RenderObject tree between frames, you'll assert if
you subsequently hit test. So e.g. if you get two button presses back
to back, and you mutate the tree synchronously in response to the
first one, the second will assert.

This adds an onBuild callback to WidgetToRenderBoxAdapter to make it
easier to do the updates at the right time, i.e., during widget build.
It'll be called whenever you rebuild the WidgetToRenderBoxAdapter
itself, so all you have to do to use it is call setState() on whoever
is building the WidgetToRenderBoxAdapter.
2016-01-11 23:14:37 -08:00
Adam Barth
82bb3bd40d ShaderMask needs to play nicely with compositing
This patch adds ShaderLayer and makes ShaderMask use it.

Fixes #1155
2016-01-11 21:57:54 -08:00
Alex Fandrianto
9bf16fbd6a Also update piano.dart 2016-01-11 18:53:32 -08:00
Adam Barth
056766414c Use a named argument for Widget children
Previously we used a positional argument for widgets that had multiple
children. Now we use a named argument that defaults to an empty list.

Fixes #241
2016-01-11 13:17:09 -08:00
Adam Barth
b2cef9f2b2 Rename ScrollDirection to Axis
We use the ScrollDirection for more than just scrolling.

Fixes #151
2016-01-11 11:28:42 -08:00
Adam Barth
e64d93a520 Switch PageableList over to using RenderList
This patch moves PageableList off HomogeneousViewport and onto RenderList and
friends, making it match the new ScrollableList.
2016-01-06 15:28:01 -08:00
Adam Barth
627c1ffb5c Replace ScrollableList with ScrollableList2
ScrollableList2 is complete and subsumes all the use cases for the original
ScrollableList.
2016-01-06 11:16:57 -08:00
Adam Barth
b1f9138f52 Switch clients of ScrollableList to ScrollableList2
This patch also changed ScrollableList2 to use an Iterable instead of an
List for its children. This change lets clients map their underlying
data lazily. If the clients actually have a concrete list, we skip the
extra copy and grab the child list directly.
2016-01-05 16:21:00 -08:00
Adam Barth
99bca282c9 Introduce ScrollableList2
ScrollableList2 uses the same pattern as ScrollableGrid, which requires the
client to allocate widgets for every list item but doesn't inflate them unless
they're actually needed for the view. It improves on the original
ScrollableList by not requiring a rebuild of the whole visible portion of the
list when scrolling. In fact, small scrolls can often be handled entirely by
repainting.
2016-01-04 16:34:39 -08:00
Adam Barth
6106fa9d6d Add support for scrollable grids
We now support (vertically) scrollable grids with viewporting. If the
scroll doesn't reveal any new rows, we execute the scroll with a repaint
(i.e., no layout). If the scroll reveals a new row, we trigger a layout
to change the set of materialized children in the viewport.
2016-01-04 11:23:42 -08:00
Adam Barth
46a178dce6 Generalize grid layout
This patch make grid layout much more flexible. The behavior is factored
out into a GridDelegate that's modeled after the custom layout
delegates. The patch includes a MaxTileWidthGridDelegate that implements
the old behavior and a FixedColumnCountGridDelegate that implements a
grid layout with a fixed number of columns.

Fixes #1048
2016-01-02 14:30:45 -08:00
Ian Hickson
ade93651ac Refactor bindings. 2015-12-13 23:34:41 -08:00
Jim Beveridge
8bb09dbcf8 Added rotation test for new PageableList code. 2015-12-10 11:19:01 -08:00
Adam Barth
ab89d2e499 Update to the new TextDecoration API
Now with fewer lists.
2015-12-09 15:11:34 -08:00
Hans Muller
c1d42a2fde Revised PageableList 2015-12-09 14:10:14 -08:00
Adam Barth
13f9e91f63 Cleanup the global scope a bit:
- Remove unused FocusChanged typedef.
- Remove unused centerOfAttentionHeroTag.
- Modernize static functions for interacting with Scrollable by moving them
  into the Scrollable class.
2015-12-09 11:12:12 -08:00
Ian Hickson
2afa87dfcd Make BoxDecoration replaceable.
Factor out a reusable interface called Decoration from BoxDecoration.

Make all the consumers of BoxDecoration and the erstwhile BoxPainter
into consumers of Decoration.

Make a BoxPainter be something you get from a Decoration, rather than
something to which you pass a BoxDecoration.

Rename Shape to BoxShape now that it's documented specifically as
applying to boxes.

Move EdgeDims to its own file.

Move FractionalOffset up so that it's with the other helper classes in
its file rather than alone at the end.

Minor change to RenderClipOval's hit testing to avoid taking an
unnecessary square root.

Rename BoxDecorationPosition to DecorationPosition since
RenderDecoratedBox now takes any Decoration.

Implement hit testing for rounded rects.

Rename AnimatedBoxDecorationValue to AnimatedDecorationValue, and make
it support lerping across any Decoration (by deferring to the objects
involved).
2015-12-07 19:24:25 -08:00
Ian Hickson
f162555648 PointerInput refactor
Instead of PointerInputEvent having a "type" field, we now have a
different class for each pointer type.

This has ripple effects throughout the system.

I also did code cleanup in affected files while I was there.
2015-12-04 22:42:38 -08:00
Adam Barth
abf0359569 Remove PaintingCanvas
We can just use Canvas now.  The two are the same thing.
2015-12-04 20:26:08 -08:00
Collin Jackson
c253ca627b Support for hero transitions underneath a PageRoute 2015-12-04 14:26:31 -08:00
Adam Barth
e17c3eccf6 Automatically fill in the menu button when there's a drawer
Also, fill in a back arrow when we can go back.

Fixes #699
2015-12-03 16:30:06 -08:00
Adam Barth
1d195cb995 Fix a large number of Drawer bugs
This patch restructures how we handle drawer. The drawer is now a child of the
Scaffold, which wraps the Drawer in a DrawerController. The DrawerController
manages the interaction with the navigator as well as the edge swiping. The
DrawerController's state machine is driven almost entirely off its Performance,
which it now owns completely.

Fixes #90
Fixes #187
Fixes #192
Fixes #194
Fixes #604
2015-12-03 10:12:56 -08:00
Adam Barth
f538d3b750 Add liftToOverlay to Mimicable
This patch integrates Mimicable with Overlay such that you can tell a Mimicable
to lift up into the overlay and animate towards another widget identified by a
global key.
2015-12-02 14:20:56 -08:00
Florian Loitsch
018bcbf2d9 Remove animation scheduler. 2015-12-01 20:36:52 -08:00
Hixie
f9ea1ce815 NavigatorTransaction
To make it easier to avoid pushing twice in one frame, provide a
transaction mechanism for the navigator.
2015-11-30 15:24:36 -08:00
Hans Muller
9de4df1e8b TabNavigator animates selected TabView
The TabBar's selection is now represented by a TabBarSelection object which encapsulates both the previous and currently selected indices and the Performance used to animate the selection indicator.

Added a TabBarView class which displays a tab's contents. It uses a shared TabBarSelection to stay in sync with a TabBar. The TabBarView scrolls in sync with the TabBar when the selection changes. Eventually it will allow one to fling the selection forward or backwards.

Added a tabBar property to ToolBar. Typically the corresponding TabBarView will be the body of the toolbar's Scaffold.

Removed TabNavigatorView and TabNavigator.

Added a widget gallery tabs demo page. Removed the old tabs demo.
2015-11-30 12:13:17 -08:00
Adam Barth
3f06da0eaa Improve Material selection controls
- These controls now have proper radial reactions.
 - You can drag the switch.
 - The radio button animates properly.
 - There's a demo in the Material Gallery
2015-11-26 01:54:34 -08:00
Adam Barth
1f1e050163 Add drop down buttons to Material Gallery 2015-11-23 16:17:29 -08:00
Adam Barth
b17fe3afb2 Integrate Date Picker into material_gallery 2015-11-23 15:55:03 -08:00
Hixie
6e371875e9 Route refactor
- Removed the concept of ephemeral routes.
- Renamed the two _MenuRoutes to _PopupMenuRoute and _DropDownRoute.
- Added type arguments in various places:
  - DropDownMenu
  - _DropDownRoute
  - _ModalBottomSheetRoute
  - PopupMenuItem
  - _PopupMenu
  - _PopupMenuRoute
- Made _ModalBottomSheetRoute, the two ex _MenuRoutes, and _DialogRoute
  all inherit from ModalRoute, via PopupRoute.
- Change "Dropdown" and "DropDown" to "DropDown" consistently.
- Made MaterialPageRoute inherit from PageRoute.
- Made ModalBarrier not create a box if it's always transparent.
- Exposed the Futures on TransitionRoutes.
- Fixed that menus were no longer dismissable by tapping the modal
  barrier.
2015-11-20 14:56:07 -08:00
Adam Barth
72329cf422 Callback identity is too fragile for CustomPaint
Many of the widgets that use CustomPaint were spamming repaints because
CustomPaint repaints when the identity of the onPaint callback changes, which
it does every build for StatelessComponents.

This patch changes CustomPaint to use a CustomPainter, similar to the new
custom layout widgets. The CustomPainter has a `shouldRepaint` function along
with its `paint` function. This function gives clients explicit control over
when the custom paint object repaints.
2015-11-20 08:20:59 -08:00
Hans Muller
0dc652bd66 Corrected Card resting elevation, tabs example toolbar 2015-11-18 14:33:08 -08:00
Hans Muller
d9153a13c6 Update shadow rendering
Shadows now render as three seprate MaskFilter.blur components per the most recent Material spec.

The shadows Map was replaced by a similar Map called elevationToShadow with entries that match the 10 elevations specifed by http://www.google.com/design/spec/what-is-material/elevation-shadows.html.

The "level" property (many classes) is now called "elevation", to match the Material spec.

BoxShadow now includes a spreadRadius parameter - as in CSS box-shadow. Renamed the BoxShadow blur property to blurRadius to further align BoxShadow with CSS box-shadow.
2015-11-18 07:58:28 -08:00
Ian Hickson
1d3f734a92 Merge pull request #414 from Hixie/fix-demos
Fix some examples.
2015-11-17 09:53:54 -08:00
Adam Barth
c769d120c4 Add a Positioned constructor from a Rect
A common pattern is to use a Positioned with a Sized box to give both an offset
from the edge as well as a fixed size to the child. This patch rolls into into
the Stack layout algorithm for simplicity.

Fixes #250
2015-11-16 23:23:54 -08:00
Hixie
5e221334fa Fix some examples.
- drag and drop was using the wrong draggables (long press vs short
  press).

- navigation.dart wasn't using material correctly and so was ending up
  with some red text.

- piano wasn't followig our style guide even a little.

- date picker was not scrollable.
2015-11-16 15:54:40 -08:00
Collin Jackson
e3b9094f2a Fix #104 Support for setting HTTP headers 2015-11-16 14:10:58 -08:00
Adam Barth
4cb0ae4901 Add an example for launching a URL 2015-11-13 14:16:25 -08:00
Ian Hickson
1aa2751ba8 Trivial whitespace fixes. 2015-11-12 22:10:16 -08:00
Devon Carew
49b7fee4c7 add a flutter.yaml file for the widgets project 2015-11-12 13:42:54 -08:00