Commit graph

79 commits

Author SHA1 Message Date
Ian Hickson 1bdf351818 Merge pubspec.yaml and flutter.yaml. (#7605) 2017-01-24 11:19:31 -08:00
Michael Thomsen 24f1b2ee09 Update IntelliJ template for new projects and existing samples (#7501)
* Disable 'Show Excluded' by default

* Move .iml file inside .idea dir

* Remove pub and build excludions as they are automatically set by the Dart plugin

* Exclude .idea folder (new users will edit it through the IJ UI, not the file)

* Move .iml files into .idea dir to be consistent with template changes

* Add workspace.xml from new template to existing samples

* Update current examples to match template changes for excluding folders

* Add missing flutter.yaml to make sure there are no analysis errors

* Add back .pub and build excludeFolder tags per https://github.com/flutter/flutter-intellij/issues/630#issuecomment-272887230

* Remove workspace.xml from example per review feedback
2017-01-23 16:33:18 +01:00
Ian Hickson 63aa1397a3 Increase the strictness of our requiring explicit types (#7585)
...now that we have generic methods, their types need to be specified too.
2017-01-23 01:04:31 -08:00
Phil Quitslund a8cd212575 Add example IntelliJ metadata (flutter-intellij#607). (#7428)
* Add example IntelliJ metadata (flutter-intellij#607).

Ensures example projects open cleanly out-of-the-box w/ the Flutter Plugin.

See: https://github.com/flutter/flutter-intellij/issues/607.

* Fixed IML files.
2017-01-11 17:37:30 -08:00
Adam Barth 27970bd82d Remove package:flutter/cassowary.dart (#7350)
We didn't end up using this mechanism.
2017-01-05 13:08:43 -08:00
Collin Jackson 211fefc217 rename Sky to Flutter and add clarifying comment to template (#7165)
* s/sky/flutter/ in Android templates

* update engine.version with a compatible engine version

* replace more SkyActivity references with FlutterActivity
2016-12-06 16:03:32 -08:00
Adam Barth 8ca4caa440 Rename Flexible to Expanded and improve docs (#6978)
This patch replaces uses of Flexible with Expanded where we're using
FlexFit.tight. We still need to think of a better name for the
FlexFit.loose variant.

Also, improve the docs for Row, Column, Flex, and RenderFlex to be more
problem-oriented and to give a complete account of the layout algorithn.

Fixes #6960
Fixes #5169
2016-11-21 23:16:43 -08:00
Adam Barth a4a783b64f Add support for pointer hover (#6884) 2016-11-15 21:13:37 -08:00
Dan Rubel 34e466f1fd Refactor flutter command exit code - part 3 of 3 (#6838)
* Remove the workaround that pinned args to v0.13.6
This reverts most of the changes in commit 6331b6c8b5
* throw exception if exit code is not an integer
* rework command infrastructure to throw ToolExit when non-zero exitCode
* convert commands to return Future<Null>
* cleanup remaining commands to use throwToolExit for non-zero exit code
* remove isUnusual exception message
* add type annotations for updated args package
2016-11-14 14:21:30 -05:00
Dan Rubel 6331b6c8b5 revert args to 0.13.6 (#6765) 2016-11-08 17:15:11 -05:00
Jason Simmons 617fa8c3a9 Engine roll with updates to the ParagraphBuilder constructor (#6528) 2016-10-25 12:20:02 -07:00
Adam Barth 6e5c192cef Remove use of activity.mojom (#6317)
Instead, we now interact with the system navigator via SystemNavigator.
2016-10-13 15:16:54 -07:00
Jason Simmons 5b292aabd2 Set windowSoftInputMode=adjustResize in example apps that were missing it (#6312)
This is needed to update an app's layout when a soft keyboard is shown
2016-10-13 14:45:27 -07:00
Adam Barth 0975d04972 Remove media service example (#6264)
This example is misleading because it relies on the old services model.
Let's remove it until #6263 is fixed.
2016-10-10 20:14:34 -07:00
Hans Muller e2ff169d5b Have the scale gesture callback uses details objects (#6204) 2016-10-04 12:44:36 -07:00
Adam Barth c9eda86b0e Switch to PointerData API (#6131)
Now dart:ui does the decoding of the pointer data itself, which means we don't
need to do it in the framework.
2016-09-29 21:25:20 -07:00
Ian Hickson e01592a0c0 Fix globalToLocal and update spinning_mixed (#6035)
* globalToLocal was just broken when there was a rotation and a
  translation at the same time. This fixes that and adds a test.

* update graphic used by spinning_mixed since the old one went 404.

* simplify some of the code in the demo.

* fix MatrixUtils.transformPoint to be consistent with how we transform
  points elsewhere.

* stop transforming points elsewhere, just use
  MatrixUtils.transformPoint.

* make the Widget binding handle not having a root element.

* make the spinning_mixed demo update its widget tree.
2016-09-28 01:06:32 -07:00
Ian Hickson 9e673853e5 Turn off AnimationControllers when not in use (#5902)
This requires all AnimationController objects to be given a
TickerProvider, a class that can create the Ticker.

It also provides some nice mixins for people who want to have their
State provide a TickerProvider. And a schedulerTickerProvider for those
cases where you just want to see your battery burn.

Also, we now enforce destruction order for elements.
2016-09-26 10:57:10 -07:00
Adam Barth c1a2967430 Use SDK sources to refer to our own packages (#6001)
Switch our pubspec.yamls to using SDK sources so that we can have consistent
source types when we depend on these packages from external packages using SDK
sources.
2016-09-22 20:39:35 -07:00
James Robinson a95c9fdb58 Isolate imports of generated Dart code from generated path (#5960)
This rewrites imports of various mojom.dart files from the Flutter
engine repo to instead import normal-looking dart files from the
(new) flutter_services package. This package handles exporting the
correct symbols from generated code wherever that may live.

Includes an engine roll to 3551e7a48e2e336777b15c7637af92fd7605b6c5
which contains the new flutter_services package.
2016-09-21 14:00:29 -07:00
Chinmay Garde 400585cb96 Update flutter/http.dart to use dart:io. (#5940) 2016-09-20 14:17:33 -07:00
Dragoș Tiselice 8ac14f8698 Replaced FlexDirection with Axis. (#5896)
Fixes #4618.
2016-09-15 15:23:37 -07:00
Adam Barth 179ea4a0a6 Update framework to account from engine API changes (#5887)
The engine now reports coordinates in physical pixels.
2016-09-15 13:13:42 -07:00
Adam Barth 22210c8baf Dispose AnimationController in examples (#5207)
These examples should show the best practices for working with
AnimationControllers.

Fixes #5206
2016-08-04 08:55:59 -07:00
Adam Barth c674b4a803 Rename Image.fromNetwork and Image.fromAssetBundle (#5149)
These now have sorter names to make the callers less verbose.
2016-07-29 13:28:08 -07:00
Adam Barth 534097ffb6 Use named Image constructors (#5129)
Some folks didn't realize these existed and asked us to add them. By
using them in examples, hopefully folks will discover them more easily.
2016-07-29 08:27:28 -07:00
Adam Barth a8f6f44a55 Update engine to include new version of Mojo (#4668)
This required switching from the Future-based bindings to the callback-based
bindings.
2016-06-21 15:53:47 -07:00
Ian Hickson e502e9c8f8 ImageIcon (#4649)
Anywhere that accepted IconData now accepts either an Icon or an
ImageIcon.

Places that used to take an IconData in an `icon` argument, notably
IconButton and DrawerItem, now take a Widget in that slot. You can wrap
the value that used to be passed in in an Icon constructor to get the
same result.

Icon itself now takes the icon as a positional argument, for brevity.

ThemeData now has an iconTheme as well as a primaryIconTheme, the same
way it has had a textTheme and primaryTextTheme for a while.

IconTheme.of() always returns a value now (though that value itself may
have nulls in it). It defaults to the ThemeData.iconTheme.

IconThemeData.fallback() is a new method that returns an icon theme data
structure with all fields filled in.

IconTheme.merge() is a new constructor that takes a context and creates
a widget that mixes in the new values with the inherited values.

Most places that introduced an IconTheme widget now use IconTheme.merge.

IconThemeData.merge and IconThemeData.copyWith act in a way analogous to
the similarly-named members of TextStyle.

ImageIcon is introduced. It acts like Icon but takes an ImageProvider
instead of an IconData.

Also: Fix the analyzer to actually check the stocks app.
2016-06-20 21:04:45 -07:00
Adam Barth ba4f1e02c2 Add an example of listening to app lifecycle events (#4623)
Fixes #4553
2016-06-18 10:43:38 -07:00
Ian Hickson 2dfdc840b1 Refactor everything to do with images (#4583)
Overview
========

This patch refactors images to achieve the following goals:

* it allows references to unresolved assets to be passed
  around (previously, almost every layer of the system had to know about
  whether an image came from an asset bundle or the network or
  elsewhere, and had to manually interact with the image cache).

* it allows decorations to use the same API for declaring images as the
  widget tree.

It requires some minor changes to call sites that use images, as
discussed below.

Widgets
-------

Change this:

```dart
      child: new AssetImage(
        name: 'my_asset.png',
        ...
      )
```

...to this:

```dart
      child: new Image(
        image: new AssetImage('my_asset.png'),
        ...
      )
```

Decorations
-----------

Change this:

```dart
      child: new DecoratedBox(
        decoration: new BoxDecoration(
          backgroundImage: new BackgroundImage(
            image: DefaultAssetBundle.of(context).loadImage('my_asset.png'),
            ...
          ),
          ...
        ),
        child: ...
      )
```

...to this:

```dart
      child: new DecoratedBox(
        decoration: new BoxDecoration(
          backgroundImage: new BackgroundImage(
            image: new AssetImage('my_asset.png'),
            ...
          ),
          ...
        ),
        child: ...
      )
```

DETAILED CHANGE LOG
===================

The following APIs have been replaced in this patch:

* The `AssetImage` and `NetworkImage` widgets have been split in two,
  with identically-named `ImageProvider` subclasses providing the
  image-loading logic, and a single `Image` widget providing all the
  widget tree logic.

* `ImageResource` is now `ImageStream`. Rather than configuring it with
  a `Future<ImageInfo>`, you complete it with an `ImageStreamCompleter`.

* `ImageCache.load` and `ImageCache.loadProvider` are replaced by
  `ImageCache.putIfAbsent`.

The following APIs have changed in this patch:

* `ImageCache` works in terms of arbitrary keys and caches
  `ImageStreamCompleter` objects using those keys. With the new model,
  you should never need to interact with the cache directly.

* `Decoration` can now be `const`. The state has moved to the
  `BoxPainter` class. Instead of a list of listeners, there's now just a
  single callback and a `dispose()` method on the painter. The callback
  is passed in to the `createBoxPainter()` method. When invoked, you
  should repaint the painter.

The following new APIs are introduced:

* `AssetBundle.loadStructuredData`.

* `SynchronousFuture`, a variant of `Future` that calls the `then`
  callback synchronously. This enables the asynchronous and
  synchronous (in-the-cache) code paths to look identical yet for the
  latter to avoid returning to the event loop mid-paint.

* `ExactAssetImage`, a variant of `AssetImage` that doesn't do anything clever.

* `ImageConfiguration`, a class that describes parameters that configure
  the `AssetImage` resolver.

The following APIs are entirely removed by this patch:

* `AssetBundle.loadImage` is gone. Use an `AssetImage` instead.

* `AssetVendor` is gone. `AssetImage` handles everything `AssetVendor`
  used to handle.

* `RawImageResource` and `AsyncImage` are gone.

The following code-level changes are performed:

* `Image`, which replaces `AsyncImage`, `NetworkImage`, `AssetImage`,
  and `RawResourceImage`, lives in `image.dart`.

* `DecoratedBox` and `Container` live in their own file now,
  `container.dart` (they reference `image.dart`).

DIRECTIONS FOR FUTURE RESEARCH
==============================

* The `ImageConfiguration` fields are mostly aspirational. Right now
  only `devicePixelRatio` and `bundle` are implemented. `locale` isn't
  even plumbed through, it will require work on the localisation logic.

* We should go through and make `BoxDecoration`, `AssetImage`, and
  `NetworkImage` objects `const` where possible.

* This patch makes supporting animated GIFs much easier.

* This patch makes it possible to create an abstract concept of an
  "Icon" that could be either an image or a font-based glyph (using
  `IconData` or similar). (see
  https://github.com/flutter/flutter/issues/4494)

RELATED ISSUES
==============

Fixes https://github.com/flutter/flutter/issues/4500
Fixes https://github.com/flutter/flutter/issues/4495
Obsoletes https://github.com/flutter/flutter/issues/4496
2016-06-16 09:49:48 -07:00
Adam Barth 1a3adae101 Use @required for onPressed and onChanged (#4534)
We now use the `@required` annotation to encourage developers to
explicitly set onPressed and onChanged callbacks to null when that would
disable the widget.

Fixes #287
2016-06-12 13:25:06 -07:00
Ian Hickson 007d0a2f39 Cache intrinsic dimensions (#4446)
Also, make sure that the parent is notified when they change.

Fixes #2298
2016-06-07 22:07:12 -07:00
Ian Hickson 787fb3be7d Simplify intrinsic dimension APIs (#4283) 2016-05-31 14:59:48 -07:00
Adam Barth d1cb026a65 Update engine and Mojo usage (#4258)
The new mojom.dart code makes mocking services a bit tricky. I've filed
https://github.com/domokit/mojo/issues/786 about improving that.
2016-05-28 18:28:21 -07:00
pq e54196d7fc Turn on avoid_return_types_on_setters and cleanup annotated setters.
It's safe to remove the unneeded `void`s from setters since the blocking issues in the
`always_declare_return_types` lint have been fixed (https://github.com/dart-lang/linter/).  We can also safely flip the bit on  `avoid_return_types_on_setters`.
2016-05-12 11:45:30 -07:00
Jason Simmons 09dde8718b Change the Android activity launch mode to singleTop (#3792) 2016-05-09 09:31:34 -07:00
pq 98ef58396a Last literals get their types.
Last fixes to get the repo running clean checking for annotations on list and map literals.
2016-05-04 13:37:23 -07:00
Adam Barth 5497ba182f Update engine (#3637)
Turns out there were more clients of the old paragraph API than I expected.
This patch migrates them to the new API.
2016-04-29 11:19:35 -07:00
Adam Barth 4aa3756835 Move cassowary into package:flutter (#3591)
Cassowary doesn't have any additional dependencies and this simplifies things.

Fixes #2442
2016-04-27 17:32:06 -07:00
Adam Barth 7ef1df4d5b Remove fetch.dart (#3584)
These uses cases are now address by http.dart via http.readDataPipe.
2016-04-27 13:09:37 -07:00
Ian Hickson e968d91ca4 Rename binding abstract classes (#3482)
The old names were getting silly and started stepping on valuable namespace.

The new names are consistent and clear.
2016-04-21 17:18:46 -07:00
Ian Hickson 0e11b0e6e3 Make the widgets binding reusable. (#3479)
Previously the widgets layer only provided a concrete binding, which
makes it awkward to extend it compared to other bindings. This moves
widgets to the same style as the other layers.

In a subsequent patch I'll use this to make the tests layer saner.
2016-04-21 16:06:51 -07:00
Ian Hickson 1b9476c4d9 Hide routes from the API when they're not needed. (#3431)
The 'routes' table is a point of confusion with new developers. By
providing a 'home' argument that sets the '/' route, we can delay the
point at which we teach developers about 'routes' until the point where
they want to have a second route.
2016-04-20 09:33:28 -07:00
krisgiesing 27715e1d41 Add an example demonstrating use of isolates (#3347) 2016-04-15 16:31:23 -07:00
Ian Hickson 7861d02943 Fix dependency skew. (#3306)
...by adding tests to our examples that don't import flutter_test, which
pins the relevant dependencies.

Also, provide more information when complaining about leaked transient
callbacks in tests.

Also, make tests display full information when they have an exception,
by bypassing the throttling we have for Android logging in tests.

Also, make the word wrapping not wrap stack traces if they happen to
be included in exception output.

Also, fix a leaked transient callback in the checkbox code.
2016-04-13 13:53:39 -07:00
Ian Hickson ecf1cce82c Provide details when reporting invalid constraints (#3281)
This also shrinks the width of the error messages a bit because now that
we use 'package:' URLs the stacks are a bit narrower.
2016-04-12 15:42:00 -07:00
Ian Hickson 47f5c6f2e0 Add even more careful checks around BoxConstraints (#3243)
I ran into a case where I was setting minHeight=∞ and then calling
layout() with that constraint, which is all kinds of bad. To try to
catch this earlier, this patch now provides a way to catch constraints
that are requiring infinite values.

We don't _always_ check this because there are valid uses for
BoxConstraints.biggest, e.g. as an additionalConstraint.
2016-04-11 11:10:11 -07:00
Kris Giesing ed03e96b68 Fix spinning_mixed widget example, plus minor style fix 2016-03-31 12:56:14 -07:00
Kris Giesing 9dfd5d4021 Part 2 of independent layout pipelines
Adds BuildOwner to manage the dirty list and build processing for
widgets/elements, and adds a widget unit test to make sure separation
is enforced.

Fixes #2723
2016-03-31 11:02:00 -07:00
Adam Barth 1ba539a661 Add constants for FractionalOffsets
Adds some names for common FractionalOffset values.
2016-03-28 22:51:06 -07:00