제스처 감지
애니메이션 적용x
GestureDetector( //제스처 감지
onTap: () {
setState(() {
_selected = !_selected;
});
},
child: Container(
color: Colors.blueGrey,
width: _selected? 250 : 310,
height: _selected? 250: 310,
),
),
애니메이션 적용
GestureDetector( //제스처 감지
onTap: () {
setState(() {
_selected = !_selected;
});
},
child: AnimatedContainer(
color: Colors.blueGrey,
width: _selected? 250 : 310,
height: _selected? 250: 310,
duration: Duration(milliseconds: 500),
),
),
TwinAnimationBuilder
Center(
child: Center(
child: TweenAnimationBuilder(
tween: Tween<double>(begin: 0, end: sizeValue),
duration: Duration(seconds: 1),
builder:
(_, double size, __) {
return IconButton(
onPressed: () {
setState(() {
sizeValue = sizeValue == 100.0 ? 200.0 : 100.0;
});
},
icon: Icon(Icons.sentiment_satisfied),
iconSize: size,
color: Colors.blue,
);
},
),
),
)
RotationTransition
body:
RotationTransition(
turns: _animation,
alignment: Alignment.center,
child: Center(
child: IconButton(
icon: Icon(
Icons.sentiment_satisfied,
),
iconSize: 100,
onPressed: () {
if (_controller.duration?.inSeconds == 1) {
_controller.duration = const Duration(seconds: 3);
} else {
_controller.duration = const Duration(seconds: 1);
}
_controller.repeat();
},
),
),
)