'Flutter package to create circle instagram story animation
Solution 1:[1]
You can you this package from pubdev
dashed_circle: ^0.0.1
class _MyPageState extends State<MyPage> with SingleTickerProviderStateMixin {
Variables
Animation gap;
Animation base;
Animation reverse;
AnimationController controller;
@override
void initState() {
super.initState();
controller = AnimationController(vsync: this, duration: Duration(seconds: 4));
base = CurvedAnimation(parent: controller, curve: Curves.easeOut);
reverse = Tween<double>(begin: 0.0, end: -1.0).animate(base);
gap = Tween<double>(begin: 3.0, end: 0.0).animate(base)
..addListener(() {
setState(() {});
});
controller.forward();
}
@override
void dispose() {
controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
body: Container(
alignment: Alignment.center,
child: RotationTransition(
turns: base,
child: DashedCircle(
gapSize: gap.value,
dashes: 40,
color: Color(0XFFED4634),
child: RotationTransition(
turns: reverse,
child: Padding(
padding: const EdgeInsets.all(5.0),
child: CircleAvatar(
radius: 80.0,
backgroundImage: NetworkImage(
"https://images.unsplash.com/photo-1564564295391-7f24f26f568b"
),
),
),
),
),
),
),
);
}
}
Solution 2:[2]
I think the best way would be to export the animation and use lottie package to render it on screen.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | ᴅ ᴇ ʙ ᴊ ᴇᴇ ᴛ |
| Solution 2 | AmirHossein Mohammadzadeh |

