forked from firka/flutter
SizeTransition sample code (#63833)
This commit is contained in:
@@ -436,6 +436,51 @@ class RotationTransition extends AnimatedWidget {
|
||||
/// animated by a [CurvedAnimation] set to [Curves.fastOutSlowIn]:
|
||||
/// {@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:
|
||||
///
|
||||
/// * [AnimatedCrossFade], for a widget that automatically animates between
|
||||
|
||||
Reference in New Issue
Block a user