animatedrotation
an implicitly animated version of ,which automatically transitions the rotat,ion over time when the provided angle changes.
install
get it from pub.
add the dependency to your pubspec.yaml
dependencies:
animated_rota,tion: ^1.0.0
run flutter pub get
in your root folder after saving the pubspec.yaml file
usage
here is an example of the counter app with text rotating based on the count
import 'package:animated_rota,tion/animated_rot,ation.dart';
import 'package:flutter/material.dart';
void main() => runapp(myhomepage());
class myhomepage extends statefulwidget {
@override
_myhomepagestate createstate() => _myhomepagestate();
}
class _myhomepagestate extends state<myhomepage> {
int _counter = 0;
@override
widget build(buildcontext context) {
return materialapp(
home: scaffold(
appbar: appbar(
title: text("animatedrotation example"),
),
body: center(
child: animatedrotation(
angle: _counter,
child: column(
mainaxisalignment: mainaxisalignment.center,
children: <widget>[
text(
'you have pushed the button this many times:',
),
text(
'$_counter',
style: theme.of(context).texttheme.display1,
),
],
),
),
),
floatingactionbutton: floatingactionbutton(
onpressed: () {
setstate(() {
_counter++;
});
},
tooltip: 'increment',
child: icon(icons.add),
),
),
);
}
}
example image
example gif
Comments are closed.