RotationTransition widget can be used to Animate a rotation of a widget.
Here's an illustration of the RotationTransition widget and output of this example program.
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@
override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(title: 'RotationTransition Demo'),
);
}
}
class MyHomePage extends StatefulWidget {
final String? title;
const MyHomePage({Key? key, this.title}) : super(key: key);
@
override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage>
with SingleTickerProviderStateMixin {
late AnimationController _controller;
@
override
void initState() {
super.initState();
_controller =
AnimationController(duration: Duration(seconds: 15), vsync: this)
..repeat();
}
@
override
void dispose() {
super.dispose();
}
@
override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title as String),
),
body: Center(
child: RotationTransition(
alignment: Alignment.center,
turns: _controller,
child: FlutterLogo(
size: 100.0,
),
)));
}
}
Thanks,Srikanth