Commit graph

30 commits

Author SHA1 Message Date
Devon Carew e464a81998 remove the packages/flutter_tools/.analysis_options file (#3733) 2016-05-04 11:43:01 -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
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 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
Yegor f3a4f722c4 [flutter_test] new WidgetTester API based on finder objects (#3288) 2016-04-13 23:40:15 -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
Adam Barth 907215df27 Add more dartdoc to material.dart (#3167)
Also, clean up a few interfaces that looked awkward when writing docs.
2016-04-07 10:03:59 -07:00
Adam Barth f71d470154 Add Stocks to the Mozart manual test 2016-04-06 17:16:11 -07:00
Adam Barth 6fd6859793 LazyBlock docs and physics
This patch adds dartdoc to LazyBlock. Also, this patch fixes the scrolling
physics of LazyBlock. Previously, we updated a running simulation only when the
change in scroll behavior changed the current scroll offset. Now we update
running simulations every time the behavior changes because the simulation
might depend on quantities other than the current scroll offset.
2016-04-06 12:36:54 -07:00
Adam Barth 40899eb274 Port clients of ScrollableMixedWidgetList to LazyBlock
LazyBlock is going to replace ScrollableMixedWidgetList at some point.
2016-04-05 20:18:35 -07:00
Ian Hickson 6d58770499 Fix the fixed height card demo
Turns out card_collection had all kinds of bugs.
2016-04-01 16:10:22 -07:00
Ian Hickson b4e4c70375 Bring the hamburger menu back to card_collection 2016-04-01 14:55:20 -07:00
Adam Barth 1ba539a661 Add constants for FractionalOffsets
Adds some names for common FractionalOffset values.
2016-03-28 22:51:06 -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
Adam Barth 502a4ae078 Use FractionalOffset for gradients
These were using Offsets, but they're really FractionalOffsets.

Fixes #2318
2016-03-15 19:30:41 -07:00
Hixie 797e27edd3 Add @override annotations to flutter framework 2016-03-14 14:02:26 -07:00
Adam Barth e2744e9a30 Stop using a prebuilt APK
Instead, require an AndroidManifest.xml and always build an APK.

Fixes #2517
2016-03-14 13:32:00 -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 5e1af2f37e [rename fixit] DismissDirection left -> endToStart, right -> startToEnd
Removes an LTR bias in DismissDirection.

Fixes #2562
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
Ian Hickson 1b9cd52081 Enable ALL THE LINTS
Well, all the easy ones, anyway.

For some reason `// ignore:` isn't working for me so I've disabled
lints that need that. Also disabled those that require a ton of work
(which I'm doing, but not in this PR, to keep it reviewable).

This adds:
- avoid_init_to_null
- library_names
- package_api_docs
- package_names
- package_prefixed_library_names
- prefer_is_not_empty
- sort_constructors_first
- sort_unnamed_constructors_first
- unnecessary_getters_setters
2016-03-10 23:15:31 -08:00
Adam Barth e4b1eab854 Remove //examples/widgets
Most of the remaining widget examples are actually manual tests. This patch
moves them into //dev/manual_tests. A couple are examples of using services,
which I've moved to //examples/layers/services. The remainder are out-dated and
are removed by this patch.
2016-03-08 16:37:32 -08:00