Commit graph

124 commits

Author SHA1 Message Date
Hans Muller 12764a0066 RefreshIndicatorState.show() (#4877) 2016-07-11 10:11:34 -07:00
Hans Muller 445f250c91 Gallery UI tweaks (#4861) 2016-07-11 07:26:36 -07:00
Adam Barth fc711a10cd Custom switch images are nutty (#4852)
Rather than requiring the developer to specify a full Decoration, we now
just take an ImageProvider for the thumb image. Also, fix
ImageFit.scaleDown to actually work.

Fixes #4571
Fixes #4673
2016-07-08 09:51:51 -07:00
Hans Muller 0f15263cea RefreshIndicator dismiss transition, remain visible during refresh, etc (#4844) 2016-07-07 16:30:10 -07:00
Hans Muller d9b9983e1a Refresh indicator (#4788) 2016-06-30 10:07:28 -07:00
Hans Muller 77cd8ee40e Reproduce the Shrine home page portrait grid layout (#4779) 2016-06-28 11:05:18 -07:00
Adam Barth 2af668f832 Change how navigator prevents redundant operations (#4769)
* Change how navigator prevents redundant operations

Instead of requiring transactions, we now cancel all active pointers that are
interacting with the navigator and absorb future pointers until we get a chance
to build. This approach isn't perfect (e.g., events that trigger off the
cancelled pointers could still interact with the navigator), but it should be
better than the current transaction-based approach.

Fixes #4716

* Remove openTransaction

* test

* fixup
2016-06-27 13:07:47 -07:00
Hans Muller 08bf1b6bce Scrollable dropdown, dropdown underline cosmetics (#4766) 2016-06-27 10:28:20 -07:00
Hans Muller 0a4f96e2b6 Gallery about box: state Flutter's status and link to our website (#4746) 2016-06-24 17:54:21 -07:00
Hans Muller bb2e7b5250 Add AppBar iconTheme parameter (#4693) 2016-06-22 15:19:31 -07:00
Ian Hickson cd89e867ef About box API (#4677)
This API is the front-end part of the work on showing licenses.

Future patches will:

* Provide an API for registering what licenses should be shown here,
  which will be used by this feature to shown licenses but could also be
  used by custom code for showing licenses (e.g. for people not using
  the Material widgets).

* Actually populate this license API from all the licenses we currently
  use in the engine, in the framework, and from any pub packages that
  are used (directly or indirectly) by the application.
2016-06-22 10:42:02 -07:00
Hans Muller 7c3a943548 Remove the gallery Live Demo buttons, etc (#4678) 2016-06-21 17:28:41 -07:00
Hans Muller 0e38cba95f Make the limit that defines Row/Column free space configurable (#4646) 2016-06-21 14:29:22 -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
Hans Muller c707b53f01 AppBar bottom widget, not necessarily a TabBar (#4631) 2016-06-20 12:45:20 -07:00
Hans Muller 327d974dc5 Added shopping cart and sorting to Shrine (#4616) 2016-06-20 09:47:58 -07:00
Hans Muller 2de2ce35bb It is not easy being green (#4606) 2016-06-16 17:33:12 -07:00
Hans Muller 69b4bcaff5 Use an ellipsis to clip wide cards_demo titles (#4604) 2016-06-16 17:20:54 -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 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
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
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
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 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
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
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
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
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 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
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
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
Hans Muller ac4ad3bc98 Flexible space bar demo needs to occupy more vertical space, etc (#3890) 2016-05-12 16:45:45 -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 74c3e74fba Call it Flutter Gallery (#3801) 2016-05-09 11:00:54 -07:00