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`.
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.
* 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
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.
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#1843Fixes#3184
* 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
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.
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.
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.
+ 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.
...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.
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.
* Added Scrollbar, removed ScrollbarPainter
* removed a dead import
* updated per review feedback
* Only call dispatch if the widgets State is still mounted
Fix some legit uses of GlobalKey to specify the type they want.
Fix some sketchy uses of GlobalKey in tests to fake it with "as
dynamic".
Remove some extraneous imports that made the build red.
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.
Using .of() to call mutating setters is not great practice since it ties
parts of the app together in ways that prevent reuse and composition.
Since people are now using the gallery app to copy from, let's use the
better practice of using callbacks.
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