动画

下面这个示例, 点击将放大或缩小

double sideLength = 50;
Widget build(BuildContext context) {
  return Center(
    child: AnimatedContainer(
      height: sideLength,
      width: sideLength,
      duration: Duration(seconds: 2),
      curve: Curves.easeIn,
      child: Material(
        color: Colors.yellow,
        child: InkWell(
          child: Text(
            'hello',
            style: TextStyle(
              fontSize: 16,
              color: const Color(0xFFCCCCCC),
            ),
          ),
          onTap: () {
            setState(() {
              sideLength == 50 ? sideLength = 100 : sideLength = 50;
            });
          },
        ),
      ),
    ),
  );
}

MIT Licensed | Copyright © 2018-present 滇ICP备16006294号

Design by Quanzaiyu | Power by VuePress