headShake static method
头部摇摆动画
Implementation
static AnimatedBuilder headShake(Animation<double> animation, Widget child) {
return AnimatedBuilder(
animation: animation,
builder: (context, child) {
final dx = sin(animation.value * pi * 4) * 10;
return Transform.translate(offset: Offset(dx, 0), child: child);
},
child: child,
);
}