Flutter仿钉钉打卡

这篇博客介绍了如何使用Flutter来仿制钉钉的打卡功能,特别是雷达扫描动画的实现。通过设置BoxShadow创建阴影效果,然后利用CustomPainter和AnimationController实现雷达扫描动画,并在点击事件中控制动画的显示和隐藏。最后,将动画组件与打卡按钮组合,确保按钮具备交互性。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

]
[
Color(0xFFFFB164),
Color(0xFFED6230),
]),
  1. 设置阴影,同样在在1中Container的BoxDecoration中添加boxShadow:

boxShadow: [
BoxShadow(
// 阴影偏移
offset: Offset(0, 40.0),
// 1为正常状态否则为异常状态
color: type == 1
? Color(0xFF1376EE)
: Color(0xFFED6230),
// 投影模糊程度
blurRadius: 36.0,
// 投影扩散程度,大于0时向外扩散,小于0时呈内聚
spreadRadius: -36.0),
]),

  1. 设置雷达扫描样式:

class RadarPainter extends CustomPainter {
final double angle;
Paint _paint = Paint()…style = PaintingStyle.fill;

RadarPainter(this.angle);

@override
void paint(Canvas canvas, Size size) {
var radius = min(size.width / 2, size.height / 2);
// 设置扫描线样式,白色,透明度从0.01过渡到0.5,角度为pi/9=20°
_paint.shader = ui.Gradient.sweep(
Offset(size.width / 2, size.height / 2),
[
Colors.white.withOpacity(0.01),
Colors.white.withOpacity(0.1),
Colors

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值