Unverified Commit 608f0606 authored by Nan Kim's avatar Nan Kim Committed by GitHub

SizeTransition sample code (#63833)

parent cb819504
...@@ -436,6 +436,51 @@ class RotationTransition extends AnimatedWidget { ...@@ -436,6 +436,51 @@ class RotationTransition extends AnimatedWidget {
/// animated by a [CurvedAnimation] set to [Curves.fastOutSlowIn]: /// animated by a [CurvedAnimation] set to [Curves.fastOutSlowIn]:
/// {@animation 300 378 https://flutter.github.io/assets-for-api-docs/assets/widgets/size_transition.mp4} /// {@animation 300 378 https://flutter.github.io/assets-for-api-docs/assets/widgets/size_transition.mp4}
/// ///
/// {@tool dartpad --template=stateful_widget_material_ticker}
///
/// This code defines a widget that uses [SizeTransition] to change the size
/// of [FlutterLogo] continually. It is built with a [Scaffold]
/// where the internal widget has space to change its size.
///
/// ```dart
/// AnimationController _controller;
/// Animation<double> _animation;
///
/// @override
/// void initState() {
/// super.initState();
/// _controller = AnimationController(
/// duration: const Duration(seconds: 3),
/// vsync: this,
/// )..repeat();
/// _animation = CurvedAnimation(
/// parent: _controller,
/// curve: Curves.fastOutSlowIn,
/// );
/// }
///
/// @override
/// void dispose() {
/// super.dispose();
/// _controller.dispose();
/// }
///
/// @override
/// Widget build(BuildContext context) {
/// return Scaffold(
/// body: SizeTransition(
/// sizeFactor: _animation,
/// axis: Axis.horizontal,
/// axisAlignment: -1,
/// child: Center(
/// child: FlutterLogo(size: 200.0),
/// ),
/// ),
/// );
/// }
/// ```
/// {@end-tool}
///
/// See also: /// See also:
/// ///
/// * [AnimatedCrossFade], for a widget that automatically animates between /// * [AnimatedCrossFade], for a widget that automatically animates between
......
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