123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- import 'package:flutter/material.dart';
- class RotateAlbum extends StatefulWidget {
- RotateAlbum({Key? key}) : super(key: key);
- _RotateAlbumState createState() => _RotateAlbumState();
- }
- class _RotateAlbumState extends State<RotateAlbum>
- with SingleTickerProviderStateMixin {
- late AnimationController _controller;
- var animation;
- @override
- void initState() {
- super.initState();
- _controller =
- AnimationController(vsync: this, duration: Duration(seconds: 4));
- animation = RotationTransition(
- turns: Tween(begin: 0.0, end: 1.0).animate(_controller)
- ..addStatusListener((status) {
- if (status == AnimationStatus.completed) {
- // _controller.forward(from: 0.0);
- }
- }),
- child: Container(
- child: CircleAvatar(
- backgroundImage: NetworkImage(
- "https://gss1.bdstatic.com/9vo3dSag_xI4khGkpoWK1HF6hhy/baike/s%3D500/sign=dde475320ee9390152028d3e4bec54f9/d009b3de9c82d1586d8294a38f0a19d8bc3e42a4.jpg"),
- )),
- );
- _controller.forward(from: 0.0);
- }
- @override
- void dispose() {
- _controller.dispose();
- super.dispose();
- }
- @override
- Widget build(BuildContext context) {
- return Container(
- padding: EdgeInsets.all(18),
- child: animation,
- );
- }
- }
|