Commit Graph

24 Commits

Author SHA1 Message Date
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
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
Adam Barth
b1a17cb0f8 Fix remaining analyzer warnings
Constructor tear-offs aren't supported by the analyzer yet.
2015-11-10 14:12:15 -08:00
Hixie
255ed0b951 Make Draggable use gestures
Draggable is now itself a gesture arena member. This means it won't
conflict with other gesture recognisers in the same path.

This also allows variants of Draggable that are triggered by other
gestures.

Also, some cleanup of DoubleTapGestureRecognizer, GestureDetector, and
PrimaryPointerGestureRecognizer.

Also, make MultiTapGestureRecognizer support a timeout for longpress.

Also, make Draggable data be typed.

Also, hide warnings about constructor warnings for now. Analyzer doesn't
support them yet. (Have to do this on a per-line basis)

Directions for future research:
 - animating the avatar (enter/exit transitions)
 - interaction with the navigator (canceling a drag on page navigation, etc)
 - double-tap draggable
2015-11-05 15:16:59 -08:00
Ian Hickson
8a900f9042 Track scroll position
- Change RouteArguments to pass the route's BuildContext rather than
  the Navigator. This caused the bulk of the examples/ and .../test/
  changes (those are mostly mechanical changes). It also meant I could
  simplify Navigator.of().

- Make initState() actually get called when the State's Element is in
  the tree, so you can use Foo.of() functions there. Added a test for
  this also.

- Provide a RouteWidget so that routes have a position in the Widget
  tree. The bulk of the route logic is still in a longer-lived Route
  object for now.

- Make Route.setState() only rebuild the actual route, not the whole
  navigator.

- Provided a Route.of().

- Provided a Route.writeState / Route.readState API that tries to
  identify the clients by their runtimeType, their key, and their
  ancestors keys, up to the nearest ancestor with a GlobalKey.

- Made scrollables hook into this API to track state. Added a test to
  make sure this works.

- Fix the debug output of GestureDetector and the hashCode of
  MixedViewport.

- Fixed ScrollableWidgetListState<T> to handle infinite lists.
2015-10-27 13:46:07 -07:00
Hixie
a6c473ea95 Strong modeify the examples
This makes skyanalyzer also check the examples, and fixes everything it
found there.
2015-10-23 18:13:25 -07:00
Adam Barth
27b5fc14a3 Scaffold should wrap its body in a Material
Fixes #1669
2015-10-19 12:11:10 -07:00
Adam Barth
65eba90843 Rename package:sky to package:flutter 2015-10-09 20:44:52 -07:00
Adam Barth
db3b9e8052 Rename App to MaterialApp
MaterialApp assumes that you're using material design.

Also move radial reaction and fix imports for stats box.
2015-10-09 10:27:22 -07:00
Adam Barth
cc809491ba Split material design widgets out of widgets.dart
These are now part of material.dart.
2015-10-09 10:07:06 -07:00
Adam Barth
89a09822bf Simplify Scaffold
Rather than using a custom render object, we can just use a Stack.
2015-10-06 10:06:17 -07:00
Hixie
90a0f6300f Simplify the usage of Navigator's routes argument
(These are changes cherry-picked from in-flight branches since they are
more independent and could be helpful even without those changes.)

- Change RouteBuilder's signature to take a single argument in which the
  other fields are placed, so that we can keep iterating on those
  arguments without having to break compatibility each time. Also, this
  makes defining route builders much simpler (only one argument to
  ignore rather than a variable number).

- Expose the next performance to RouteBuilders, since sometimes the
  route itself might not be where it's used.

- Allow BuildContext to be used to walk children, just like it can for
  ancestors

- Allow BuildContext to be used to get the Widget of the current
  BuildContext

- Allow StatefulComponentElement to be referenced with a type
  specialisation so that you don't have to cast when you know what the
  type you're dealing with actually is.
2015-10-05 13:59:30 -07:00
Adam Barth
e9aabcd5c6 Use }) : super consistently
Fixes #1372
2015-10-02 23:12:03 -07:00
Hixie
894a1ca09f Draggable offsets and fix default drag feedback
You can now set an offset that will be used for the hit testing for
drops. (It doesn't move the feedback by default; use a Transform for
that.) I also made the default feedback not be Opacity 0.5 always.
2015-10-01 17:13:03 -07:00
Adam Barth
45c906d2ad Make fn3 the default widget framework 2015-10-01 09:48:35 -07:00
Hixie
a91dd07cb3 Draggable
Introduce a Draggable class that wraps all the logic of dragging
something and dropping it on a DragTarget.

Update examples/widgets/drag_and_drop.dart accordingly.

Make the performance/transition part of routes optional.
2015-09-29 18:00:40 -07:00
Adam Barth
83b7459201 Port even more examples to fn3 2015-09-24 16:09:37 -07:00
Hixie
c3b3b71bed Rename ComponentState and use initState().
ComponentState becomes State, for brevity.
Instead of overriding its constructor, override initState().
This makes writing States much simpler.
2015-09-24 16:00:51 -07:00
Adam Barth
7dd26a7a5a Port some more examples to fn3 2015-09-24 15:43:40 -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
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
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
b61fe238f5 Rename syncFields to syncConstructorArguments 2015-08-21 17:21:42 -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