Commit graph

1446 commits

Author SHA1 Message Date
Hans Muller 69b4bcaff5 Use an ellipsis to clip wide cards_demo titles (#4604) 2016-06-16 17:20:54 -07:00
Hans Muller 46a660f0d0 Removed obsolete flutter gallery assets (#4605) 2016-06-16 16:56:11 -07:00
Matt Perry 02a4483914 Pesto: Fix app bar height when returning from recipe page. (#4579)
The problem was that the Scaffold was getting a new key each time we
navigated to the main page. The key influences where page state is
stored, including the scroll offset. So for a single frame, the Scaffold
incorrectly thinks the scroll offset is 0 and the app bar should be
expanded.

BUG=https://github.com/flutter/flutter/issues/4400
2016-06-16 17:24:06 -04: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
Hans Muller 5766cdacd3 Define LayoutWidgetBuilder in terms of BoxConstraints instead of Size (#4578) 2016-06-15 14:11:58 -07:00
Phil Quitslund 0f1132f93a Merge pull request #4559 from pq/missing_returns
Add missing returns.
2016-06-14 15:41:49 -07:00
pq d3b4186744 Review nits. 2016-06-14 15:32:42 -07:00
pq d81212a387 Cleanup. 2016-06-14 15:21:42 -07:00
pq f5a4e63237 Added asserts. 2016-06-14 15:19:14 -07:00
Hans Muller 0e50ee6e7f Remove implicit dart:ui dependency (#4561) 2016-06-14 12:35:59 -07:00
Hans Muller 3f7dd71057 Shrine Tweaks (#4558) 2016-06-14 12:15:41 -07:00
pq 7a95548746 Add missing returns.
As of `1.18.0-dev-0`, these cases will get flagged.  In the meantime, the
2016-06-14 12:13:56 -07:00
Hans Muller f21b140115 One list of GalleryItems to rule them all (#4549) 2016-06-13 16:50:12 -07:00
Hans Muller ebaf9e29a0 Gallery shrine demo uses image assets (#4544) 2016-06-13 14:48:24 -07:00
Hans Muller 187ff00294 New gallery app bar background (#4539) 2016-06-13 12:41:29 -07:00
Adam Barth 1d5d7f4ad3 Reorganize the calculator demo (#4536)
This patch is a warmup to improving the visuals in the calculator demo.

Related to #4535
2016-06-13 11:44:46 -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
Adam Barth cc44696754 Remove leftover app.so references (#4531)
This file is now app.dylib.
2016-06-11 21:16:42 -07:00
Adam Barth 0b6df634af Polish HostMessages (#4515)
Cleans up a few style nits in hello_services and adds support for automatic
JSON encoding and decoding to the HostMessages interface.
2016-06-10 15:04:01 -07:00
Matt Perry 2315432d2f Pesto polish fixes. (#4514)
- Fix the background color and AppBar transparency on the Recipe page.
- Use a Hero animation for the recipe card.
- Draw the background image under the status bar on the recipe page.
- Added instructional text on favorites page when there are no favorites.

BUG=https://github.com/flutter/flutter/issues/4403
BUG=https://github.com/flutter/flutter/issues/4405
BUG=https://github.com/flutter/flutter/issues/4436
BUG=https://github.com/flutter/flutter/issues/4399
2016-06-10 16:33:50 -04:00
Matt Perry ffde6777fc Pull Flutter gallery assets from Google's git repo. (#4493)
This repo contains the final licensed images.
2016-06-09 16:03:10 -04:00
Ian Hickson f75fd5c389 Header for PaginatedDataTable (#4468)
Also renames ButtonTheme.footer to ButtonTheme.bar.
2016-06-08 17:29:26 -07:00
Ian Hickson 1fe57277cf Improve interactivity of the Contacts demo (#4479)
We're explicitly saying that making these icons do anything useful is
out of scope, so the best we'll do here is show a snackbar.
2016-06-08 17:27:24 -07:00
Matt Perry 479c7da9f1 Add a 'Return to Gallery' drawer option to Pesto. (#4472)
* Add a 'Return to Gallery' drawer option to Pesto.

BUG=https://github.com/flutter/flutter/issues/4402

* oops
2016-06-08 17:04:40 -04:00
Matt Perry 3e0e6b9997 Smoothly scale the Pesto logo as the app bar resizes. (#4465)
Also update the assets version to pull in better quality logo images.

BUG=https://github.com/flutter/flutter/issues/4407
2016-06-08 15:49:21 -04: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
Adam Barth 6e530ea862 Make pesto demo scroll fast (#4443)
We can viewport the content using a ScrollableGrid. Also, we can use the
padding mechanisms of the grid to avoid extra padding widgets.
2016-06-07 19:52:03 -07:00
Ian Hickson 68f92d4f34 Provide UI to paginate PaginatedDataTable (#4382)
Also:
* Make PaginatedDataTable able to scroll itself horizontally.
* Make drop down buttons support having an explicit text style and icon
  size given.
* Fix a bug with drop-down buttons asserting when opened partly
  off-screen.
* Make sure to pop the drop-down button's route if the drop-down button
  is discarded while the route is up.
* Remove extraneous padding on drop-down buttons. (Couldn't figure out
  why it was there, and it breaks alignment when a drop-down is mixed
  with other text.)
* Some docs improvements.
* Add Route.isActive
* Add a setState() method to ModalRoutes.
2016-06-07 16:11:30 -07:00
Ian Hickson 5e6baf4a26 Correct grammar in shrine demo (#4381)
I was also going to implement sorting and emptying the cart but the
current data model doesn't make that easy, so I gave up on that. That's
why the TODOs are moved around though.
2016-06-07 16:05:39 -07:00
Todd Volkert 7ac0ce7938 Add API for specifying the system overlay style. (#4422)
Fixes 3544
2016-06-07 14:39:15 -07:00
Adam Barth 5af67e1592 Add support for target to gradle build (#4420)
This lets you build something other than `lib/main.dart`.
2016-06-07 13:05:42 -07:00
Matt Perry 0783f9d633 Remove "Drop-down button" from the transtions perf test. (#4417)
It's no longer part of the gallery app.

BUG=https://github.com/flutter/flutter/issues/4390
2016-06-07 13:13:51 -04:00
Adam Barth 130f77177d Make Shrine scroll fast (#4408)
This fix isn't completely statisfying because it has a scaling limit. The ideal
fix would actually viewport the tiles in the grid. However, this fix is much
easier at the moment.

Fixes #4395
2016-06-06 20:23:40 -07:00
Adam Barth 4f4f24eac5 Loosen dependencies on string_scanner (#4412)
Now that there's a new string_scanner in town, we're having dependency
resolution conflict because of flutter_markdown's tight dependency. This
patch loosens the dependency and resolves the conflict.
2016-06-06 19:22:55 -07:00
Adam Barth 8f03ebe56b Teach FlutterPlugin.groovy about AOT builds (#4389)
The `flutter.buildMode` property now controls whether to build in debug,
profiling, or release.
2016-06-06 12:56:04 -07:00
Ian Hickson ed48c70aa0 Remove the redundant drop-down button demo (#4380)
Turns out we have the same demo in the "Buttons" section now.
We don't need both.
2016-06-04 09:31:32 -07:00
Adam Barth 423a31f473 Merge hello_android into hello_services (#4366)
The hello_services example can now be built both for Android and iOS.
2016-06-03 16:15:03 -07:00
Hans Muller df1c158e0b Updated calculator demo (#4363) 2016-06-03 14:10:50 -07:00
Matt Perry 60e7535b58 Pesto demo for the Flutter Gallery app. (#4328)
* Pesto demo for the Flutter Gallery app.

* pesto.special.case
2016-06-03 17:05:01 -04:00
Adam Barth 8171aa86f0 Document how to build hello_services for iOS (#4354)
This patch adds some sensible defaults to xcode_backend.sh and documents how to
build hello_services for iOS using Xcode.
2016-06-03 12:20:54 -07:00
Hans Muller 0b7e975e2c Updated fitness and weather manual tests, new asset locations (#4351) 2016-06-03 10:38:03 -07:00
Hans Muller 1d516f0e94 Update gallery demo list (again) (#4339) 2016-06-03 08:37:16 -07:00
Hans Muller dd27a489fa Update gallery demo list (#4335) 2016-06-02 16:12:54 -07:00
Hans Muller 309b9f8010 Version 0.0 of a gallery demo of the Material Design "Shrine" app (#4327) 2016-06-02 14:23:20 -07:00
Adam Barth 88d47d5705 Remove animation from Gallery header (#4322)
Although beautiful, having a continuous animation on the front page of the
gallery gives the impression that Flutter burns battery and makes phones hot.
This patch replaces the animation with solid purple. However, we might
eventually want to use a static image.
2016-06-02 09:57:47 -07:00
Adam Barth 0679da0a23 Remove fancy lines demo from Gallery (#4323)
This demo burns battery continuously even when there's no change to the visual
appearance. This patch removes this demo to avoid giving the impression that
Flutter burns battery.

Related to #4120
2016-06-02 09:54:03 -07:00
Ian Hickson 0618da7ca2 PaginatedDataTable (part 1) (#4306)
This introduces the key parts of a paginated data table, not including
the built-in pagination features.

* Provide more data for the data table demo, so there's data to page.

* Introduce a ChangeNotifier class which abstracts out
  addListener/removeListener/notifyListeners. We might be able to use
  this to simplify existing classes as well, though this patch doesn't
  do that.

* Introduce DataTableSource, a delegate for getting data for data
  tables. This will also be used by ScrollingDataTable in due course.

* Introduce PaginatedDataTable, a widget that wraps DataTable and only
  shows N rows at a time, fed by a DataTableSource.
2016-06-01 16:13:40 -07:00
Ian Hickson bf6ae3ee76 Reenable the gallery smoke test (#4303)
...and fix some grid and table intrinsic issues it uncovered.
2016-06-01 15:34:48 -07:00
Ian Hickson 787fb3be7d Simplify intrinsic dimension APIs (#4283) 2016-05-31 14:59:48 -07:00
Adam Barth 52cf289101 Switch to using real location data (#4282) 2016-05-31 14:12:07 -07:00
Adam Barth 8c805e234d Teach hello_services to provide a platform service (#4277)
Currently this service just returns mock data, but it exercises the plumbing.
2016-05-31 13:18:53 -07:00
Adam Barth 7de84709cf Address review comments on prior patch (#4270)
I pulled the trigger to land the previous patch too quickly and missed a
number of comments.
2016-05-30 14:47:49 -07:00
Adam Barth 26a4d7bbad Add an example of an extensible iOS app (#4252)
This example shows how to build a basic app using a custom Xcode project.
Future patches will bring the functionality up to par with hello_android.
2016-05-29 14:08:35 -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
Jason Simmons d6147fd7fa Update the Gradle plugin to use --local-engine instead of the deprecated --engine-src-path (#4255) 2016-05-27 17:12:52 -07:00
Adam Barth 36d01c3541 "Swipe items to dismiss" demo needs full-bleed dividers (#4231)
Remove spurious padding.

Fixes #3980
Fixes #3560
2016-05-26 17:06:10 -07:00
Adam Barth 474ff67556 Polish sliders (#4176)
Address feedback from material design team.

Fixes #4144
Fixes #4145
Fixes #4146
2016-05-24 17:53:23 -07:00
Hans Muller bacd3d2cb0 Revised Drawer Header (#4160) 2016-05-24 12:31:42 -07:00
Hans Muller 487234db02 TabPageSelector demo: use chevron icons instead of arrows (#4153) 2016-05-24 09:57:33 -07:00
Hans Muller cf83a81329 Correct layout (#4115) 2016-05-23 14:24:10 -07:00
Devon Carew 65bed96103 move the calculator files around (#4112) 2016-05-23 12:55:09 -07:00
Hans Muller 41d1a9f1da Skip gallery smoke test (#4108) 2016-05-23 12:04:33 -07:00
Ian Hickson d0bac85da4 Move the new calculator demo into the gallery. (#4092) 2016-05-21 10:56:02 -07:00
Hans Muller 5b8677d15d Allow tab bars in flexible app bars (#4086) 2016-05-20 18:07:15 -07:00
Hans Muller 1f06dc44cd ScrollConfiguration (#4026) 2016-05-20 16:59:09 -07:00
Ian Hickson 06d80f22f0 Identify the widgets you tap on in live tests (#4079) 2016-05-20 14:21:38 -07:00
Mitch Rudominer 719add8171 New Material Design calculator example. (#3999)
* New Material Design calculator example. (Attempt 2 after git fetch upstream).

* Responded to code review.

* Second round of code review.
2016-05-20 10:27:03 -07:00
Hans Muller b4ecaaa9f6 Enable the gallery smoke test (#4060) 2016-05-19 17:12:35 -07:00
Adam Barth 8283d05eb5 Tabs and scrolling has odd card text (#4019)
Looks like our intent here was to show the tab label rather than
"Instance of '_Page'".

Also, fix an issue where the scrollableKey wasn't being forwarded to the
actual scrollable.

Fixes #3090
2016-05-19 14:13:43 -07:00
Matt Perry 0628c64b79 Use KeyboardType.phone for the Gallery app's text demo. (#3983)
BUG=https://github.com/flutter/flutter/issues/3970
2016-05-17 15:36:59 -04:00
Hans Muller bec3fdefd1 Add a Scrollable builder, refactor ScrollableList, et al (#3950)
* Add a Scrollable builder, refactor ScrollableList, et al

* Add space between the dialog demo buttons

* removed vestigial code
2016-05-16 17:32:01 -07:00
Ian Hickson 3252701753 Make it possible to run tests live on a device (#3936)
This makes it possible to substitute 'flutter run' for 'flutter test'
and actually watch a test run on a device.

For any test that depends on flutter_test:

1. Remove any import of 'package:test/test.dart'.

2. Replace `testWidgets('...', (WidgetTester tester) {`
      with `testWidgets('...', (WidgetTester tester) async {`

3. Add an "await" in front of calls to any of the following:
    * tap()
    * tapAt()
    * fling()
    * flingFrom()
    * scroll()
    * scrollAt()
    * pump()
    * pumpWidget()

4. Replace any calls to `tester.flushMicrotasks()` with calls to
   `await tester.idle()`.

There's a guarding API that you can use, if you have particularly
complicated tests, to get better error messages. Search for
TestAsyncUtils.
2016-05-16 12:53:13 -07:00
Ian Hickson c5ff156f24 Revert "Rename DefaultTextStyle constructor to explicit (#3920)" (#3930)
This reverts commit 55f9145ef4.

Turns out that this commit breaks apps that use the material library,
because of the _errorTextStyle DefaultTextStyle which has inherit:true.
Just setting it to false doesn't work, unfortunately, because then you
hit some sort of issue with merging that text style with others that
have inherit:true.
2016-05-16 11:08:07 -07:00
Adam Barth 55f9145ef4 Rename DefaultTextStyle constructor to explicit (#3920)
To make it clear that this constructor requires an explicit style. Also
throw a descriptive error recommending the inherit constructor for
styles with the inherit bit set.

Fixes #3842
2016-05-16 10:35:35 -07:00
pq a9d5a7b30c Added space to ignore. 2016-05-13 15:35:27 -07:00
pq 4dd548578f Re-enable one_member_abstracts lint (#3608). 2016-05-13 14:28:21 -07:00
Devon Carew 2f642ce908 updates from the flutter gallery rename (#3898)
* updates from the flutter gallery rename

* rename ids to io.flutter.gallery
2016-05-13 12:46:50 -07:00
Hans Muller ac4ad3bc98 Flexible space bar demo needs to occupy more vertical space, etc (#3890) 2016-05-12 16:45:45 -07:00
Eric Seidel 1a1b89e5b3 Fix Flutter Gallery to use title case
@HansMuller
2016-05-12 12:51:10 -07:00
Phil Quitslund 616d9e2ea8 Merge pull request #3880 from pq/void_setters
Turn on `avoid_return_types_on_setters` and cleanup annotated setters.
2016-05-12 12:28:15 -07:00
Hans Muller 5bacc9f8e8 GridTileBar uses ellipsis, etc (#3881) 2016-05-12 12:27:49 -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
Hans Muller 2e8315e8f5 Generate a Gallery demo transition-durations performance histogram (#3859) 2016-05-11 14:52:34 -07:00
Todd Volkert 810b3e32a6 Fix regexp that strips invalid characters from the project identifier
Fixes #3835
2016-05-10 13:24:20 -07:00
Todd Volkert baa25c83fb Fix broken identifier in the hello world example 2016-05-10 13:15:14 -07:00
Jim Beveridge 321b338adb Upgrade gradle files for Android Studio 2.1
Fixes #3833
2016-05-10 11:11:31 -07:00
Hans Muller 770f8f1d0c rename TracingCategory to TimelineStream (#3822) 2016-05-09 17:00:49 -07:00
Hans Muller 475d5a457d remove spurious copy of the material_gallery directory (#3806) 2016-05-09 12:18:32 -07:00
Hans Muller 74c3e74fba Call it Flutter Gallery (#3801) 2016-05-09 11:00:54 -07:00
Jason Simmons 09dde8718b Change the Android activity launch mode to singleTop (#3792) 2016-05-09 09:31:34 -07:00
Adam Barth ee903af03f Move TextAlign out of TextStyle (#3789)
TextAlign applies to a whole paragraph instead of applying to an individual
text span. This patch moves the property out of TextStyle and into a separate
property on Text and RichText.
2016-05-06 17:33:27 -07:00
Viktor Lidholt 153e1bb918 Fixes to particle system API (#3762) 2016-05-05 17:31:16 -07:00
krisgiesing 01978d98a8 Move global analysis options file to the repo root (#3750)
* Move global analysis options file to the repo root

Also restore the analysis options file for stocks example, since
the global options trigger warnings on generated intl files.

* Remove obsolete analysis options file for Material Gallery example
2016-05-05 16:30:38 -07:00
Phil Quitslund 32bbbc6458 Merge pull request #3738 from pq/annotate_literals_3
Last literals get their types.
2016-05-04 13:59:09 -07:00
Adam Barth 8da98105b4 Skip the gallery smoke test (#3736)
This test hangs occationally on the bots and the bots aren't smart enough to
recover, which means the whole project gets blocked.

Filed #3735 about the hang.
2016-05-04 13:42:29 -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 a5eb4c04c7 Remove ModalPosition (#3734)
Clients of getPosition should just use a one-child custom layout delegate
instead.

Fixes #2484
2016-05-04 12:40:50 -07:00
krisgiesing 07b5f83e55 Add analysis options near the root of the repository (#3700)
This aligns the analysis options used by 'flutter analyze' with the
options used by Atom.
2016-05-04 10:15:15 -07:00
Hans Muller a9b965cb9b Gallery demo start-time performance test (#3655)
*  Gallery demo start-time performance test
2016-05-03 17:37:10 -07:00
Adam Barth b2fa6c250a Fix the padding and space for FlatButton and RaisedButton (#3650)
Instead of incorporating the margin into the button, introduce a ButtonBar
widget that supplies the proper spacing between the buttons. Also, make these
buttons more configurable via ButtonTheme so that dialogs can change the
minWidth and padding of the buttons as required by the spec.

Fixes #1843
Fixes #3184
2016-04-29 16:13:25 -07:00
Ian Hickson 91dd969966 Refactor the test framework (#3622)
* Refactor widget test framework

Instead of:

```dart
  test("Card Collection smoke test", () {
    testWidgets((WidgetTester tester) {
```

...you now say:

```dart
  testWidgets("Card Collection smoke test", (WidgetTester tester) {
```

Instead of:

```dart
  expect(tester, hasWidget(find.text('hello')));
```

...you now say:

```dart
  expect(find.text('hello'), findsOneWidget);
```

Instead of the previous API (exists, widgets, widget, stateOf,
elementOf, etc), you now have the following comprehensive API. All these
are functions that take a Finder, except the all* properties.

* `any()` - true if anything matches, c.f. `Iterable.any`
* `allWidgets` - all the widgets in the tree
* `widget()` - the one and only widget that matches the finder
* `firstWidget()` - the first widget that matches the finder
* `allElements` - all the elements in the tree
* `element()` - the one and only element that matches the finder
* `firstElement()` - the first element that matches the finder
* `allStates` - all the `State`s in the tree
* `state()` - the one and only state that matches the finder
* `firstState()` - the first state that matches the finder
* `allRenderObjects` - all the render objects in the tree
* `renderObject()` - the one and only render object that matches the finder
* `firstRenderObject()` - the first render object that matches the finder

There's also `layers' which returns the list of current layers.

`tap`, `fling`, getCenter, getSize, etc, take Finders, like the APIs
above, and expect there to only be one matching widget.

The finders are:

 * `find.text(String text)`
 * `find.widgetWithText(Type widgetType, String text)`
 * `find.byKey(Key key)`
 * `find.byType(Type type)`
 * `find.byElementType(Type type)`
 * `find.byConfig(Widget config)`
 * `find.byWidgetPredicate(WidgetPredicate predicate)`
 * `find.byElementPredicate(ElementPredicate predicate)`

The matchers (for `expect`) are:

 * `findsNothing`
 * `findsWidgets`
 * `findsOneWidget`
 * `findsNWidgets(n)`
 * `isOnStage`
 * `isOffStage`
 * `isInCard`
 * `isNotInCard`

Benchmarks now use benchmarkWidgets instead of testWidgets.

Also, for those of you using mockers, `serviceMocker` now automatically
handles the binding initialization.

This patch also:

* changes how tests are run so that we can more easily swap the logic
  out for a "real" mode instead of FakeAsync.

* introduces CachingIterable.

* changes how flutter_driver interacts with the widget tree to use the
  aforementioned new API rather than ElementTreeTester, which is gone.

* removes ElementTreeTester.

* changes the semantics of a test for scrollables because we couldn't
  convince ourselves that the old semantics made sense; it only worked
  before because flushing the microtasks after every event was broken.

* fixes the flushing of microtasks after every event.

* Reindent the tests

* Fix review comments
2016-04-29 13:23:27 -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
Hans Muller 620fb87567 Enable lining up the last tool bar action trailing list item elements (#3597) 2016-04-27 17:34:59 -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 256adfcd46 Fix leaking animation in floating action button. (#3575) 2016-04-27 12:30:48 -07:00
Devon Carew 1bf6841f56 move the material_gallery/demos.dart script (#3582)
* move the material_gallery/demos.dart script

* rename all_demos.dart to all.dart
2016-04-27 12:23:02 -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
Viktor Lidholt b314a7d9fa Adds NineSliceSprite and optimizes gallery front page (#3485)
* Adds NineSliceSprite and optimizes gallery front page
2016-04-21 17:16:16 -07:00
Ian Hickson c167efca17 Minor widget_tester refactoring and docs (#3472)
This reorders some classes so that this file makes more sense, and adds
a bunch of docs. It also makes the following changes:

* Move allElements from Instrumentation to TestWidgets. (Instrumentation
  is going away.)

* Remove findElements.

* Rename byElement to byElementPredicate

* Rename byPredicate to byWidgetPredicate

* Implement _WidgetPredicateFinder so that byWidgetPredicate has good
  messages

* Fix one use of byElementPredicate to use byWidgetPredicate.
2016-04-21 16:35: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 20eefbf576 Remove stray print from material gallery. (#3463)
Makes the tests noisy.
2016-04-21 14:57:37 -07:00
Adam Barth 248960a734 Add a route table to Material Gallery (#3457)
Use the route table to generate the list of screens to test in the smoke test.
2016-04-21 10:24:22 -07:00
Hans Muller 986b017445 Gallery Smoke Test (#3446)
* Gallery Smoke Test
2016-04-21 08:54:43 -07:00
Viktor Lidholt 9aeeb15849 Minor fixes to code parser test in gallery (#3439) 2016-04-20 12:45:54 -07:00
Adam Barth 140bf64a9d Update examples readme (#3434)
Previously this readme had some broken links.

Fixes #3428
2016-04-20 10:58:06 -07:00
Hans Muller 25164e1089 Make IconButton gesture targets as big as possible (#3423)
* Make IconButtons as big as possible
2016-04-20 10:00:14 -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
Viktor Lidholt f7360126b8 Gallery code snippets now analyzed (#3391)
* Gallery code snippets now analyzed
2016-04-20 09:29:01 -07:00
Hans Muller c7e2e8ae81 Remove Scaffold scrollableKey use in gallery demos (#3406)
* Remove Scaffold scrollable_key demo usage
2016-04-19 16:31:11 -07:00
Hans Muller a2ce9483c1 Replace Block with ScrollableList in Cards demo (#3380) 2016-04-19 09:45:53 -07:00
Devon Carew 4678c12098 find all repo packages (#3368)
* find all repo packages

* .dartignore
2016-04-15 20:25:57 -07:00
Hans Muller c4ae13ed22 Refresh indicator (#3354) 2016-04-15 18:39:18 -07:00
Yegor 9ce995f65e [driver] refactor API to finder objects (#3365) 2016-04-15 16:57:35 -07:00
Ian Hickson a91bc0ba9c Material Data Tables (#3337)
+ Add new demo to gallery to show data tables. (This currently doesn't
use a Card; I'll create a Card version in a subsequent patch.)

+ Fix checkbox alignment. It now centers in its box regardless.

+ Add Colors.black54.

+ Some minor fixes to dartdocs.

+ DataTable, DataColumn, DataRow, DataCell

+ RowInkWell

+ Augment dartdocs of materia/debug.dart.

+ DropDownButtonHideUnderline to hide the underline in a drop-down when
  used in a DataTable.

+ Add new capabilities to InkResponse to support RowInkWell.

+ Augment dartdocs of materia/material.dart.

+ Add an assert to catch nested Blocks.

+ Fix a crash in RenderBox when you remove an object and an ancestor
  used its baseline. (https://github.com/flutter/flutter/issues/2874)

+ Fix (and redocument) RenderBaseline/Baseline.

+ Add flex support to IntrinsicColumnWidth.

+ Document more stuff on the RenderTable side.

+ Fix a bug with parentData handling on RenderTable children.

+ Completely rewrite the column width computations. The old logic made
  no sense at all.

+ Add dartdocs to widgets/debug.dart.

+ Add a toString for TableRow.
2016-04-15 16:51:03 -07:00
krisgiesing 27715e1d41 Add an example demonstrating use of isolates (#3347) 2016-04-15 16:31:23 -07:00
Hans Muller f7cf0d97ca Fix the progress indicator demo (#3367) 2016-04-15 16:21:38 -07:00
Eric Seidel 347831bf7f Merge pull request #3358 from eseidelGoogle/perf_overlay_gallery
Add a Performance Overlay toggle to the Gallery app
2016-04-15 13:25:08 -07:00
Eric Seidel a2b704b82c Merge pull request #3313 from eseidelGoogle/gallery_drive_perf
Add a basic scrolling test for the Gallery home page.
2016-04-14 09:05:02 -07:00
Yegor f3a4f722c4 [flutter_test] new WidgetTester API based on finder objects (#3288) 2016-04-13 23:40:15 -07:00
Viktor Lidholt ec85af59b4 Improvements to the Grid list demo (#3315)
* Improvements to the Grid list demo

* More nits and fixes to grid demo in gallery
2016-04-13 15:25:27 -07:00
Eric Seidel 7ee0ee7291 Per review comments 2016-04-13 14:46:42 -07:00
Eric Seidel 237f1ac263 Add a basic scrolling test for the Gallery home page.
Current numbers from my Nexus 5:
  "average_frame_build_time_millis": 22.6854,
  "missed_frame_build_budget_count": 15,
  "frame_count": 15

Filed https://github.com/flutter/flutter/issues/3296

@yjbanov @hansmuller @vlidholt
2016-04-13 14:21:51 -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
Eric Seidel 7ecc698c9c wip 2016-04-12 16:08:29 -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
Jason Simmons 3525aa1b0a Use the flutter.jar in the artifact cache by default (#3278)
See https://github.com/flutter/flutter/issues/3233
2016-04-12 14:26:22 -07:00
Adam Barth ec4a6a96f2 Add more dartdocs to material.dart (#3279) 2016-04-12 14:18:58 -07:00
Adam Barth 69f994446b Add more dartdoc to material.dart (#3261)
Now past halfway though material.dart by files.
2016-04-12 12:41:59 -07:00
Viktor Lidholt 2f60932df9 Adds nice photos and hero animations to the Grid gallery demo (#3258) 2016-04-12 12:12:00 -07:00
Hans Muller ba5a04e85a ClampOverscrolls Inherited Widget (#3267)
* ClampOverscrolls Inherited Widget
2016-04-12 10:12:44 -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
Viktor Lidholt 83ef964ac6 Updates selection controls gallery demo (#3225) 2016-04-08 14:33:34 -07:00
Hans Muller 34f23cc456 Added OverscrollIndicator, removed OverscrollIndicatorPainter (#3220)
* Added OverscrollIndicator, removed OverscrollIndicatorPainter
2016-04-08 14:21:00 -07:00
Viktor Lidholt 9b5361acab Moves and renames gallery demos (#3217) 2016-04-08 11:08:21 -07:00
Adam Barth 1251f01ec7 Convert some Columns into Blocks (#3210)
These columns were secretly re-creating Block in a more complex way. Now we
just use Block directly.
2016-04-08 10:42:48 -07:00
Adam Barth e456d86327 Update engine (#3214)
Also, update hello_android to use the new Java class names.
2016-04-08 10:25:41 -07:00
Viktor Lidholt f8c1d619a6 Fixes spelling in gallery button demo (#3209) 2016-04-08 10:24:09 -07:00
Hans Muller 6335872802 Added Scrollbar, removed ScrollbarPainter (#3203)
* Added Scrollbar, removed ScrollbarPainter

* removed a dead import

* updated per review feedback

* Only call dispatch if the widgets State is still mounted
2016-04-07 16:59:51 -07:00
Jason Simmons 4bcef2a340 Some documentation for running "flutter refresh" in the Gradle sample (#3201) 2016-04-07 16:16:22 -07:00