动画Padding 点击之后 有动画过渡
class AnimatedPaddingWidget extends StatefulWidget { @override State<StatefulWidget> createState() => AnimatedPaddingWidgetState(); } class AnimatedPaddingWidgetState extends State<AnimatedPaddingWidget> { double AnimatedPaddingOffset = 120; @override Widget build(BuildContext context) { return AnimatedPadding( curve: Curves.linear, padding: EdgeInsets.all(AnimatedPaddingOffset), duration: Duration(seconds: 1), child: GestureDetector( child: Image.network( "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1584787666369&di=2595aefbc771e601d57cfc5102135d78&imgtype=0&src=http%3A%2F%2Fa3.att.hudong.com%2F68%2F61%2F300000839764127060614318218_950.jpg"), onTap: () { setState(() { AnimatedPaddingOffset = AnimatedPaddingOffset - 10; }); }, )); } }