-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathanim_shadow_box.dart
60 lines (54 loc) · 1.45 KB
/
anim_shadow_box.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import 'package:flutter/material.dart';
class AnimShadowBox extends StatefulWidget {
static Map<String, WidgetBuilder> routeNameMap = {
"/AnimShadowBox": (context) => AnimShadowBox()
};
@override
_AnimShadowBoxState createState() => _AnimShadowBoxState();
}
class _AnimShadowBoxState extends State<AnimShadowBox>
with SingleTickerProviderStateMixin {
AnimationController animationController;
Animation<double> animation;
@override
void initState() {
super.initState();
animationController = AnimationController(
vsync: this,
duration: const Duration(seconds: 2),
);
animation = Tween(begin: 4.0, end: 36.0).animate(animationController);
animationController.addListener(() {
setState(() {});
});
animationController.repeat(reverse: true);
}
@override
void dispose() {
animationController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Container(
decoration: BoxDecoration(
color: Colors.white,
shape: BoxShape.circle,
border: Border.all(color: Colors.pinkAccent),
boxShadow: [
BoxShadow(
color: Colors.pinkAccent,
blurRadius: animation.value,
spreadRadius: 2.0,
),
],
),
width: 100,
height: 100,
),
),
);
}
}