Commit graph

303 commits

Author SHA1 Message Date
Dragos Tiselice 65e77142e9 Updated DrawerHeader and added UserAccountDrawer.
Removed old Stack layout and added a simple-to-extend interface for the
new drawer header. Also added a specialized UserAccountsDrawerHeader
consistent with Material Design guidelines.
2016-07-20 16:16:08 -07:00
Adam Barth a33fc49659 Remove dangling reference to ViewController (#4841)
We want to use the FlutterViewController in this new project template.

Fixes #4840
2016-07-07 10:45:58 -07:00
Adam Barth 151750baa8 Update the ios projects for examples to HelloServices model (#4822)
We now use a different approach for ios projects where the developer controls
the Xcode project file. This patch removes the old ".generated" approach in
favor of the new approach.
2016-07-06 14:13:21 -07:00
Adam Barth 2fa6a709c9 Improve documentation for framework.dart (#4758) 2016-06-25 12:22:14 -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
pq f5a4e63237 Added asserts. 2016-06-14 15:19:14 -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
Todd Volkert 7ac0ce7938 Add API for specifying the system overlay style. (#4422)
Fixes 3544
2016-06-07 14:39:15 -07:00
Hans Muller bacd3d2cb0 Revised Drawer Header (#4160) 2016-05-24 12:31:42 -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
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
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
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
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
Ian Hickson 256adfcd46 Fix leaking animation in floating action button. (#3575) 2016-04-27 12:30:48 -07:00
Yegor 9ce995f65e [driver] refactor API to finder objects (#3365) 2016-04-15 16:57:35 -07:00
Yegor f3a4f722c4 [flutter_test] new WidgetTester API based on finder objects (#3288) 2016-04-13 23:40:15 -07:00
Adam Barth 7ab122e557 PopupMenuButton should lazily build menu items
Previously, the client of PopupMenuButton needed to build all the menu times

when building the PopupMenuButton. This can get expensive if, for example, each
item in a scrollable list has a popup menu associated with it.

Now the client passes a builder function to the PopupMenuButton that gets
invoked only when its time to show the menu items.
2016-04-06 13:28:09 -07:00
Yegor 19e624ccfe [driver] give the timeline data some structure
Fixes https://github.com/flutter/flutter/issues/2713
2016-04-04 17:07:16 -07:00
Yegor 055fd00dc1 Merge pull request #3058 from yjbanov/timeline-summary
[driver] utility for extracting and saving timeline summary
2016-04-01 17:48:25 -07:00
Devon Carew f7e6100b08 sort imports
* sort imports
2016-04-01 11:32:02 -07:00
Jason Simmons 03830d5676 Merge pull request #2896 from jason-simmons/yaml_schema
Validate flutter.yaml against a JSON schema
2016-03-25 10:14:58 -07:00
Ian Hickson 47e882a5a2 Merge pull request #2878 from Hixie/border-style-none
Support hairline borders
2016-03-25 09:29:57 -07:00
Jason Simmons c2b4ac9c3c Validate flutter.yaml against a JSON schema 2016-03-24 17:49:23 -07:00
Adam Barth c8c325d095 Replace EdgeInsets.TRBL with EdgeInsets.fromLTRB
This matches the pattern from Rect. I've left EdgeInsets.TRBL marked as
deprecated to give clients a chance to update.

Fixes #2860
2016-03-24 15:19:40 -07:00
Hixie 9fc29dbbb8 Support hairline borders
Previously, border with '0' was ambiguous. Sometimes we treated it as
hairline borders, sometimes as "don't show the border", though even in
the latter case we did some graphics work sometimes. Now we have an
explicit BorderStyle.none flag to not draw the border efficiently.
2016-03-24 14:05:38 -07:00
yjbanov 26c4177360 [driver] API for getting performance traces 2016-03-14 16:15:18 -07:00
Hixie 797e27edd3 Add @override annotations to flutter framework 2016-03-14 14:02:26 -07:00
Adam Barth d5b2e2a01c [rename fixit] Flex alignments
* justifyContent -> mainAxisAlignment
* alignItems -> crossAxisAlignment
* FlexJustifyContent -> MainAxisAlignment
* FlexAlignItems -> CrossAxisAlignment

Fixes #231
2016-03-12 18:33:47 -08:00
Adam Barth ede5dfce30 [rename fixit] ToolBar -> AppBar
* left -> leading (Removes an LTR bias)
* center -> title (Widget was actually centered)
* right -> actions (Removes an LTR bias, asymmetric with leading)

Fixes #2348
2016-03-12 18:33:47 -08:00
Adam Barth 9b9ad3db17 [rename fixit] RouteBuilder -> BuildContext
Fixes #2353
2016-03-12 17:18:31 -08:00
Adam Barth 95fc5ae070 [rename fixit] *Component* -> *Widget*
This patch renames StatelessComponent to StatelessWidget and
StatefulComponent to StatefulWidget.

Fixes #2308
2016-03-12 12:34:05 -08:00
Adam Barth e71bd77e4f [rename fixit] EdgeDims -> EdgeInsets
Fixes #1382
2016-03-12 12:33:38 -08:00
Adam Barth 7ba1960518 [rename fixit] ThemeData#text -> textTheme
Fixes #1278
2016-03-12 12:32:37 -08:00
Hixie 6795efacab Enable always_specify_types lint
And fix the zillion issues that uncovered.
2016-03-12 00:37:31 -08:00
Ian Hickson 43b0104114 Revert "Merge pull request #2639 from Hixie/always_specify_types"
This reverts commit f41b3411da, reversing
changes made to e33d8d9621.

This was a bad check-in due to my mangling uploading a new version of the branch from a different machine.

This reverts https://github.com/flutter/flutter/pull/2639 and will be replaced by https://github.com/flutter/flutter/pull/2640
2016-03-12 00:34:37 -08:00
Hixie d162d98c79 Enable always_specify_types lint
And fix the zillion issues that uncovered.
2016-03-11 18:27:32 -08:00
Devon Carew 94157c91e9 regenerate the i18n files 2016-03-11 10:58:30 -08:00
Devon Carew 625b5b51c7 Merge pull request #2604 from devoncarew/less_i18n_analysis
exclude the i18n files from analysis
2016-03-11 09:11:56 -08:00
Devon Carew f9855ca72b exclude the i18n files from analysis 2016-03-10 21:42:46 -08:00
Ian Hickson 7cf2dbdf37 Fix crash when dumping the app if it uses RichText
Specifically:

* Handle null styles in TextSpan without crashing in toString().

* Handle null children in TextSpan child lists without crashing in
  toString().

* Handle entirely empty TextSpans in toString() explicitly.

* Assert that TextSpans don't contain nulls in various places. This is
  done more often than one might think necessary, because it turns out
  that TextSpan takes a (mutable) List for one of its arguments, so
  who knows what it will contain at any given time. By asserting all
  over the place, hopefully we'll catch it near the change if they do
  change it.

* Add a RichText example to Stocks to exercise RichText and TextSpans.

See also: https://github.com/flutter/flutter/issues/2514, https://github.com/flutter/flutter/issues/2519
2016-03-10 20:48:50 -08:00
Devon Carew 780e4e6212 move the analysis_options to a file 2016-03-10 13:47:20 -08:00
Hixie c7339de6bc Enable always_declare_return_types lint
And fix a zillion omissions this uncovered.
2016-03-09 17:57:39 -08:00
Adam Barth 0d7b0f9ec1 Test harness should check for running Timers and AnimationControllers
After running a widget test, we now clear out the widget tree and check that we
didn't leak any timers or animations.

Also, fix several bugs that this addtional check revealed.

Fixes #2481
2016-03-09 13:37:24 -08:00
Hans Muller f1659e4f7a more type parameters 2016-03-03 10:18:53 -08:00
yjbanov ee184a7821 driver.scroll action; scroll perf test for Stocks 2016-03-02 17:13:49 -08:00
Adam Barth 870894fc68 Switch Material Design icons to using the iconfont
Rather than managing all the Material Design icons manually, we now
manage them using an icon font. The icon font contains glyphs for each
icon in an efficient vector format.

This patch updates the FLX tooling to include the MaterialIcons font and
updates the Icon widget to use the font instead of asset images.

Fixes #2313
Fixes #2218
Fixes #2009
Fixes #994
2016-03-02 09:32:02 -08:00
Hans Muller d8eaac42fb Added menu dividers 2016-03-02 08:45:26 -08:00
Adam Barth 19b9464e58 Merge pull request #2231 from abarth/fab_tooltips
Add tooltips to FloatingActionButtons
2016-02-26 14:38:36 -08:00
Adam Barth 61611d4715 Add tooltips to FloatingActionButtons
Fixes #1875
2016-02-26 13:59:35 -08:00
Hans Muller 3d377305f4 updated per review feedback 2016-02-26 13:13:46 -08:00
Hans Muller 179d41e68f Add CheckedPopupMenuitem, update the Stocks demo 2016-02-26 11:27:44 -08:00
Chinmay Garde f0d1dbc551 Re-run flutter create on examples to fill in icons and other assets 2016-02-25 13:39:34 -08:00
Adam Barth 1484add104 Add TestGesture
This helper makes it easier to write correct tests that involve
gestures.

Fixes #1855
2016-02-21 14:32:58 -08:00
Adam Barth 72fcbb7d36 SnackBar should have a single optional action
The example in the spec with multiple actions is an anti-example.

Fixes #1876
2016-02-20 16:54:10 -08:00
Chinmay Garde 23bbbcda2a Add iOS specific assets to the Stocks example 2016-02-16 15:58:06 -08:00
Adam Barth b672a3d436 Stocks input field for company name doesn't work
We weren't listening to the onChange handler.

Fixes #1850
2016-02-14 14:23:40 -08:00
Ian Hickson 3eb1b412e0 Fix color of icons in drawers in dark theme.
This makes it match the material spec more.
https://www.google.com/design/spec/style/icons.html

Fixes https://github.com/flutter/flutter/issues/1357
2016-02-13 17:10:10 -08:00
Collin Jackson 6c2ab9d352 Merge pull request #1847 from collinjackson/input_key
Don’t require global keys for Input, fixes #1828
2016-02-12 17:58:08 -08:00
Ian Hickson ca4d10d33a Merge pull request #1820 from Hixie/rainbox
Expose more debugging tools in Stocks
2016-02-12 17:21:16 -08:00
Collin Jackson d4533622e1 Don’t require global keys for Input, fixes #1828 2016-02-12 16:56:10 -08:00
Hans Muller 8c78bf47c1 updated flutter_gallery_assets version
rename example apk dirs to android
removed all BUILD.gn files
2016-02-12 15:03:14 -08:00
Hixie a95c866bf3 Expose more debugging tools in Stocks 2016-02-12 11:41:17 -08:00
Jason Simmons 52c55344d9 Change the text/selection value API of the input field
(see https://github.com/flutter/flutter/issues/1586)
2016-02-11 12:52:15 -08:00
Ian Hickson a94999ba50 Clean up imports and exports.
Each layer is supposed to reexport the parts of the previous layer
that are part of its API.

- In painting.dart, export from dart:ui all the Canvas-related APIs
  that make sense to be used at higher levels, e.g. PaintingStyle.

- Delete painting/shadows.dart. It was dead code.

- In rendering/object.dart, export all of painting.dart.

- In widgets/basic.dart, export all of painting.dart and
  animation.dart. Some classes in animation/ are renamed to make this
  less disruptive and confusing to the namespace.

- Split out Stocks back into an import model rather than a part model,
  so that it's easier to manage its dependencies on a per-file basis.

- Move Ticker to scheduler library.

- Remove as many redundant imports as possible now.

- Some minor nit picking cleanup in various files.
2016-02-11 00:06:23 -08:00
Hixie 28a1788371 Semantics 2016-01-27 10:04:49 -08:00
Ian Hickson 5494323db9 Move us to HashSet to avoid the overhead of tracking the order 2016-01-23 18:13:13 -08:00
Adam Barth 432bfb4729 Add material design features to Input
Properly support labels, hints, icons, and custom typography.
2016-01-23 00:21:18 -08:00
Adam Barth 82e30c8649 Simplify colorizing icons
Now you can colorize an Icon simply by proving a Color for the Icon.
2016-01-22 12:07:45 -08:00
Hans Muller 8218ff683f Change Block children to be a named parameter 2016-01-22 08:04:21 -08:00
Adam Barth f176ed27de Don't autofocus Input widgets by default
Instead, require the developer to opt-in to autofocusing because autofocusing
can be disruptive.

Fixes #1307
2016-01-21 14:11:50 -08:00
Hixie 24cab8999c Tooltips
Introduces a new Tooltip class.
Adds support for tooltips to IconButton and Scaffold.
Adds some tooltips to various demos.

Also some tweaks to stack.dart that I made before I decided not to go
down a "CustomPositioned" route.
2016-01-14 12:21:56 -08:00
Adam Barth 174164bc15 Switch back to GitHub hosting of stock data
The Firebase server seems to have changed behavior and is not giving us a List
instead of a Map. This patch switches us back to GitHub, which just serves the
same flat files all the time.
2016-01-14 09:37:43 -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
Ian Hickson 88c43c3f4e Rename StatisticsOverlay to PerformanceOverlay. 2016-01-10 23:47:42 -08:00
Ian Hickson 48e1350e73 Add more debugging options to the stocks app.
- Add an option to enable debugPaintSizeEnabled.
- Add an option to enable the StatisticsOverlay.
- Add support for the StatisticsOverlay in MaterialApp.
- Change the layout behaviour of RenderStatisticsBox:
   - Give it a zero intrinsic width.
   - Give it an accurate intrinsic height that depends on the flags
     set. (Also, move the enum to the rendering/ layer from the
     widgets/ layer to enable this.)
   - Make the box automatically size itself full-width and the correct
     height, so that you can actually embed it (though most of the
     time you'd just put it in a Stack so this doesn't matter as
     much, really).
- Some style nit fixes in statistics_box.dart.
2016-01-10 22:42:16 -08:00
Adam Barth dd08bf7973 Simplify TabView API
Instead of taking a builder and a generic type, we can just take a
List<Widget>.
2016-01-10 21:44:24 -08:00
Ian Hickson 34cfb6082a Refactor the Stocks app's settings
This will make it much easier to add more settings.
2016-01-10 00:36:01 -08:00
Ian Hickson d9d3114d14 Material baseline grid
See https://www.google.com/design/spec/layout/metrics-keylines.html#
2016-01-08 11:18:15 -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
Hans Muller 6494cd1f35 Make TabBarSelection a parameterized type 2016-01-06 10:54:16 -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
Hans Muller 6178fdff8a TabBarSelection is now expected to be an ancestor of its TabBar and TabBarView. 2015-12-22 14:12:26 -08:00
Devon Carew 6e324ef92d fix analysis errors and warnings in the stocks example 2015-12-21 13:39:28 -08:00
Eric Seidel d3eca1aa42 Add an icon for the Stocks app.
Not great.  Better than nothing.

@hixie
2015-12-17 10:06:16 -08:00
Hans Muller 65dca5b578 Correct the TabBarView swipe selection change animation
The TabBarSelection change animation needs to start where the fling's drag gesture ended rather than from zero.  The intial vlaue of progress for the TabBarSelection's performance is now converted from the range used during an interactive drag, to the range used when animating from the previously selected tab to the new one.

TabBarSelection now requires a maxIndex parameter.
2015-12-16 15:30:45 -08:00
Ian Hickson 7151fdd054 Move flutter tests from packages/unit to packages/flutter/test 2015-12-16 08:00:57 -08:00
Eric Seidel 520ceb5859 Rename stocks/tests to stocks/test
This matches the naming pattern expected from package:test
`flutter test` doesn't care, since it finds all _test.dart
files and runs them regardless of directory.

@Hixie
2015-12-14 14:56:22 -08:00
Ian Hickson e78d6cbc6b Merge pull request #857 from Hixie/hashCodes
Use hashValues instead of hard-coded hashCode getters
2015-12-11 21:46:32 -08:00
Hans Muller c4f52177cc demo updates 2015-12-10 12:25:59 -08:00
Ian Hickson d8a3ed3efc Use hashValues instead of hard-coded hashCode getters 2015-12-09 22:10:33 -08:00
Hans Muller 4eeddab959 Make the StockHome TabBar selection persistent 2015-12-09 09:17:40 -08:00
Eric Seidel 2f4864efbb Merge pull request #825 from eseidelGoogle/locale_test
Add a test to stocks for changing the locale
2015-12-08 16:34:53 -08:00
Eric Seidel 09894ec50b Add a test to stocks for changing the locale
I had to add a setLocale method to WidgetTester and
split the code in FlutterBinding which handled locale
changes to allow me to dispatch a locale change w/o actually
changing what the c++ code reports as the locale.

Also added the test to Travis.

@abarth @jason-simmons
2015-12-08 16:16:24 -08:00
Seth Ladd 2666628b12 use async / await 2015-12-08 14:16:14 -08:00
Collin Jackson d05c564cef Fix hero transition when using dynamic routes 2015-12-08 13:08:16 -08:00