forked from CarGuo/gsy_github_app_flutter
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathanimated_background.dart
More file actions
39 lines (36 loc) · 1.1 KB
/
Copy pathanimated_background.dart
File metadata and controls
39 lines (36 loc) · 1.1 KB
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
import 'package:flutter/material.dart';
import 'package:simple_animations/simple_animations.dart';
import 'package:supercharged/supercharged.dart';
enum _ColorTween { color1, color2 }
class AnimatedBackground extends StatelessWidget {
@override
Widget build(BuildContext context) {
final tween = MultiTween<_ColorTween>()
..add(
_ColorTween.color1,
Color(0xffD38312).tweenTo(Colors.lightBlue.shade900),
3.seconds,
)
..add(
_ColorTween.color2,
Color(0xffA83279).tweenTo(Colors.blue.shade600),
3.seconds,
);
return MirrorAnimation<MultiTweenValues<_ColorTween>>(
tween: tween,
duration: tween.duration,
builder: (context, child, value) {
return Container(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
value.get<Color>(_ColorTween.color1),
value.get<Color>(_ColorTween.color2)
])),
);
},
);
}
}