Add sample code to FadeTransition (#64240)

This commit is contained in:
sehee Jeong 2020-09-13 06:42:02 +09:00 committed by GitHub
parent 2e643651a9
commit a39a893463
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -660,7 +660,49 @@ class SizeTransition extends AnimatedWidget {
/// Here's an illustration of the [FadeTransition] widget, with it's [opacity]
/// animated by a [CurvedAnimation] set to [Curves.fastOutSlowIn]:
///
/// {@animation 300 378 https://flutter.github.io/assets-for-api-docs/assets/widgets/fade_transition.mp4}
/// {@tool dartpad --template=stateful_widget_material_ticker}
///
/// The following code implements the [FadeTransition] using
/// the Flutter logo:
///
/// ```dart
/// AnimationController _controller;
/// Animation<double> _animation;
///
/// @override
/// void initState() {
/// super.initState();
/// _controller = AnimationController(
/// duration: const Duration(seconds: 2),
/// vsync: this,
/// )..repeat(reverse: true);
/// _animation = CurvedAnimation(
/// parent: _controller,
/// curve: Curves.easeIn,
/// );
/// }
///
/// @override
/// void dispose() {
/// _controller.dispose();
/// super.dispose();
/// }
///
/// @override
/// Widget build(BuildContext context) {
/// return Container(
/// color: Colors.white,
/// child: FadeTransition(
/// opacity: _animation,
/// child: const Padding(
/// padding: EdgeInsets.all(8),
/// child: FlutterLogo()
/// ),
/// ),
/// );
/// }
/// ```
/// {@end-tool}
///
/// See also:
///