ScaleTransition Widget
Project Preview
- Interested in seeing the live demo? Click here to explore.
- Want to view the source code? Visit the project on GitHub.
Code Snippet
import 'package:flutter/material.dart';
class ScaleTransitionWidget extends StatefulWidget {
const ScaleTransitionWidget({super.key});
@override
State<ScaleTransitionWidget> createState() => _ScaleTransitionWidgetState();
}
class _ScaleTransitionWidgetState extends State<ScaleTransitionWidget>
with TickerProviderStateMixin {
late final AnimationController _controller = AnimationController(
duration: const Duration(seconds: 1),
vsync: this,
)..repeat(reverse: true);
late final Animation<double> _animation = CurvedAnimation(
parent: _controller,
curve: Curves.fastOutSlowIn,
);
@override
void dispose() {
_controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text("ScaleTransition Widget"),
),
body: Center(
child: ScaleTransition(
scale: _animation,
child: const FlutterLogo(size: 150.0),
),
),
);
}
}