Я хочу анимировать AnimatedContainer
и ClipPath
, движущиеся по оси Y.
Это мой текущий код:
class Clip extends StatelessWidget {
final double height;
Clip(this.height);
@override
Widget build(BuildContext context) {
return Scaffold(
body: ClipPath(
clipper: RoundedClipper(height),
child: AnimatedContainer(
duration: Duration(seconds: 5),
height: height,
color: Colors.amber,
),
),
);
}
}
class RoundedClipper extends CustomClipper<Path> {
final double height;
RoundedClipper(this.height);
@override
Path getClip(Size size) {
var path = Path();
path.lineTo(0.0, height - 200);
path.quadraticBezierTo(
size.width / 2,
height,
size.width,
height - 200,
);
path.lineTo(size.width, 0.0);
path.close();
return path;
}
@override
bool shouldReclip(CustomClipper<Path> oldClipper) => true;
}
в зависимости от высоты, которую я передаю этому классу, AnimatedContainer будет переходить между ними с анимацией, а клипер не будет анимироваться.
Вот как это выглядит:
Я попытался обернуть машинку для стрижки AnimatedContainer и установить анимацию, но это не сработало.
Как сделать так, чтобы обтравочный контур анимировался вертикально вместе с AnimatedContainer?
Спасибо всем, кто захочет помочь