gpt4 book ai didi

android - 什么相当于 Flutter 中的圆形显示动画?

转载 作者:IT王子 更新时间:2023-10-29 06:55:17 26 4
gpt4 key购买 nike

我想知道如何在 Flutter 中实现 Android 的循环显示动画。还有关于 Flutter 动画示例的任何资源吗?

最佳答案

对于 Reveal Effect,您必须使用 CustomPainter 类。

class RevealProgressButtonPainter extends CustomPainter {
double _fraction = 0.0;
Size _screenSize;

RevealProgressButtonPainter(this._fraction, this._screenSize);

@override
void paint(Canvas canvas, Size size) {
var paint = Paint()
..color = Colors.green
..style = PaintingStyle.fill;

var finalRadius =
sqrt(pow(_screenSize.width / 2, 2) + pow(_screenSize.height / 2, 2));
var radius = 24.0 + finalRadius * _fraction;

canvas.drawCircle(Offset(size.width / 2, size.height / 2), radius, paint);
}

@override
bool shouldRepaint(RevealProgressButtonPainter oldDelegate) {
return oldDelegate._fraction != _fraction;
}
}

你可以阅读这个 awesome tutorial for Circular reveal effect.了解详细信息。

Github Code

在做reveal effect 的时候要顺利打开副屏。为此用途 Fluro用于路由和导航的库。这将为您提供过渡类型。

router.navigateTo(context, "/profile_screen",transition: TransitionType.fadeIn,);

关于android - 什么相当于 Flutter 中的圆形显示动画?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50226816/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com