FormField is now a widget that can contain any type of field. Input no
longer has special code to handle form fields. Instead, there is a
helper widget InputFormField for using an Input inside a FormField.
Fixes https://github.com/flutter/flutter/issues/6097 and based on
feedback from the same.
Since we can change the theme's platform, we need to make sure we
propagate that throughout rather than having half the app use the native
platform and half the app use the selected platform.
Developers need to get the size of the BuildContext sufficiently often
that we should provide a convenient getter for the value. Having this
getter is also an opportunity to catch common mistakes and provide
useful error messages that guide developers towards better patterns.
Fixes#2321
These futures complete when the route is popped off the navigator. This
generalizes and simplifies a mechanism already in place for dialogs and
menus.
Fixes#5283
* Add a maxLines parameter for multiline Input.
If maxLines is 1, it's a single line Input that scrolls horizontally.
Otherwise, overflowed text wraps and scrolls vertically, taking up at
most `maxLines`.
Also fixed scrolling behavior so that the Input scrolls ensuring the
cursor is always visible.
Fixes https://github.com/flutter/flutter/issues/6271
* oops
* comments
* import
* test and RO.update fix
* constant
* fix.caretRect
We were trying to cram too much functionality in to the Dialog widget. Now we
have AlertDialog and SimpleDialog to cover to two different kinds of dialogs in
the spec.
This patch fixes the issue in two ways:
1. The content area is now scrollable, which means you can scroll to reveal any
parts that don't fit on screen.
2. The content area is now small enough to fit on screen in landscape on a
Nexus 5.
Fixes#6054
Rather than scrolling the entire contents of the dialog, we should instead
scroll only the part between the title and the button bar.
Also, polish up the padding in the simple dialog demo.
Fixes#6057
This requires all AnimationController objects to be given a
TickerProvider, a class that can create the Ticker.
It also provides some nice mixins for people who want to have their
State provide a TickerProvider. And a schedulerTickerProvider for those
cases where you just want to see your battery burn.
Also, we now enforce destruction order for elements.
* Changed Pesto logotype's position.
This commit changes Pesto's logotype position so that its curve
aligns with the curve of the image size.
* Added clamping to Pesto logo animation.
Removed Pesto logo's triggered animation in order to remove the
observable 'hop' when scrolling. The whole curve is now entirely
scroll dependent. Fixes#5907.
Due to a synchronization issue, a PR was merged with a green build
that was supposed to be rebuilt and to fail. This commit fixes the
issue by renaming the usage of a constant.
* Added OverscrollIndicatorEdge et al
* RefreshIndicator only clamps its scrollable edge
* added a test
* Updated the test
* fixed lint-os
* fixed a typo
* Scrollable should restore its viewport dimensions when it reappears
* removed an accidental commit
* updated per review feedback
Instead of a PNG, the Flutter gallery widget is now drawn in code.
There's now a FlutterLogoDecoration class that paints the flutter logo
anywhere you can use a Decoration (e.g. AnimatedContainer).
There's now a FlutterLogo class that honors the IconTheme.
The About dialog box API now takes a Widget for the applicationIcon,
instead of an ImageProvider. It uses IconTheme to make the icon the
right size instead of using an Image widget.
Add padding, duration, and curve properties to the DrawerHeader.
Make the child of a DrawerHeader optional.
Clean up UserAccuntsDrawerHeader a bit.
Add some useful properties and methods to EdgeInsets.
Add some debug logic to RenderDecoratedBox to catch unpaired
save/restore calls when possible.
Make GestureDetector fill its parent if it has no children. Fixes
https://github.com/flutter/flutter/issues/5380
This patch improves the Post and Shrine transitions by making the AppBar
into a Hero and changing the default MaterialPageTransition. Now the
AppBar transitions smoothly between screens and the
MaterialPageTransition doesn't involve a fade effect.
Also, rejigger the bounds of the image header in Pesto to avoid the
"pop" at the end of the animation by laying out the image header at its
final visual size instead of relying on occlusion to size the image
header.
Fixes#5202Fixes#5204
Previously we were resizing a paragraph of text during the animation. Now we
animate the text and the image separately. Also, add a default hero tag for
FloatingActionButton so that it animates as part of the hero transition as
well.
* Added custom radii to RRect.
This is the first commit towads an implementation of
MergeableMaterial. It adds custom radii to RRect.
* Renamed RRect constructors and added BorderRadius.
BorderRadius is a class similar to EdgeInsets that lets you define
all rounded corners of a rounded rectangle easily.
This patch includes a number of improvements:
* Material page routes now put a repaint boundary inside their transition so
they don't repaint during the transition.
* Heroes that are on a quest now get a repaint boundary so we repaint them
individually.
* I've hoisted the transparent material for the product items up in the widget
tree, which doesn't affect performance but makes the ink splashes reach the
edge of the product cards.
* I've changed the repaint rainbow visualization to make it easier to see
what's going on.
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.
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#4571Fixes#4673
* 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
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.
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.
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
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
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
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.
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.
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
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.
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
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.
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
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.
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.
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
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`.