Unverified Commit 68841469 authored by Todd Volkert's avatar Todd Volkert Committed by GitHub

Add loading support to Image (#33369)

This adds two new builders to the `Image` class:

* `frameBuilder`, which allows callers to control the widget
  created by an [Image].
* `loadingBuilder`, which allows callers fine-grained control
  over how to display loading progress of an image to the user.

`FadeInImage` can be simplified by migrating to the new API.
This is done in a follow-on commit.

https://github.com/flutter/flutter/issues/32374
parent 925f5f1c
......@@ -86,8 +86,3 @@ follows:
- [`stateless_widget_scaffold`](stateless_widget_scaffold.tmpl) : Similar to
`stateless_widget_material`, except that it wraps the stateless widget with a
Scaffold.
- [`stateful_widget_animation`](stateful_widget_animation.tmpl) : Similar to
`stateful_widget`, except that it declares an `AnimationController` instance
variable called `_controller`, and it properly initializes the controller
in `initState()` and properly disposes of the controller in `dispose()`.
// Flutter code sample for {{id}}
{{description}}
import 'package:flutter/widgets.dart';
{{code-imports}}
void main() => runApp(new MyApp());
/// This Widget is the main application widget.
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return WidgetsApp(
title: 'Flutter Code Sample',
home: MyStatefulWidget(),
color: const Color(0xffffffff),
);
}
}
{{code-preamble}}
/// This is the stateful widget that the main application instantiates.
class MyStatefulWidget extends StatefulWidget {
MyStatefulWidget({Key key}) : super(key: key);
@override
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
}
// This is the private State class that goes with MyStatefulWidget.
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
AnimationController _controller;
@override
void initState() {
super.initState();
_controller = AnimationController(
vsync: this,
duration: const Duration(seconds: 1),
);
}
@override
void dispose() {
_controller.dispose();
super.dispose();
}
{{code}}
}
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment