animated_svg
2.1.0, released 2 years ago by bbkdevelopment.com
Flutter widget that animates a smooth transition between two SVG assets.
WASM-ready
What it does
Provides an AnimatedSvg widget controlled by an SvgController. It cross‑fades or morphs between two SVGs over a configurable duration.
AI-written summary of version 2.1.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need animated icons or buttons that switch between SVG states
- You want a simple, declarative way to animate SVG transitions without writing custom animation code
Skip it when
- Complex vector animations requiring path morphing beyond simple cross‑fade
- Performance‑critical scenes where a full‑featured animation engine is required
Strengths
- Very easy to integrate – just add the widget and controller
- Works on all Flutter platforms supported by flutter_svg
- Highly customizable (duration, direction, tap callback)
Weaknesses
- Limited to transitioning between two static SVGs
- Relies on flutter_svg, so any limitations of that package apply
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 1
import 'package:animated_svg/animated_svg.dart';
import 'package:flutter_svg/flutter_svg.dart';
late final SvgController controller;
@override
void initState(){
controller = AnimatedSvgController();
super.initState();
}
@override
Widget build(BuildContext context){
return AnimatedSvg(
controller: controller,
duration: const Duration(milliseconds:600),
children:[
SvgPicture.asset('assets/play.svg'),
SvgPicture.asset('assets/pause.svg'),
],
);
}Alternatives
Packages that do the same job and could replace animated_svg.
- vector_graphics
Offers a compiled SVG format with potentially better performance for static graphics
94Compare
Works with
Packages commonly used together with animated_svg: ones it builds on, ones built on it, and its own family.