Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 07b00a6

Browse files
Add animation to contact page
1 parent ab8676a commit 07b00a6

File tree

2 files changed

+92
-1
lines changed

2 files changed

+92
-1
lines changed

‎lib/pages/contact.dart

Lines changed: 91 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import 'package:align_positioned/align_positioned.dart';
12
import 'package:animate_do/animate_do.dart';
23
import 'package:day40/pages/send_money.dart';
34
import 'package:flutter/material.dart';
@@ -76,7 +77,50 @@ class _ContactPageState extends State<ContactPage> {
7677
child: Column(
7778
crossAxisAlignment: CrossAxisAlignment.start,
7879
children: <Widget>[
79-
SizedBox(height: 20,),
80+
SizedBox(height: 50,),
81+
FadeInUp(
82+
duration: Duration(milliseconds: 500),
83+
child: Container(
84+
width: double.infinity,
85+
height: 300,
86+
padding: EdgeInsets.all(90.0),
87+
decoration: BoxDecoration(
88+
shape: BoxShape.circle,
89+
border: Border.all(color: Colors.grey.shade200, width: 1.0),
90+
),
91+
child: Stack(
92+
children: [
93+
for (double i = 0; i < 360; i += 60)
94+
AnimChain(
95+
initialDelay: Duration(milliseconds: i.toInt())
96+
)
97+
.next(
98+
wait: Duration(milliseconds: 1000),
99+
widget: AnimatedAlignPositioned(
100+
dx: 0,
101+
dy: 150,
102+
duration: Duration(seconds: 1),
103+
rotateDegrees: 0,
104+
touch: Touch.middle,
105+
child: user(0, i),
106+
),
107+
)
108+
.next(
109+
wait: Duration(seconds: 2),
110+
widget: AnimatedAlignPositioned(
111+
dx: i / 360,
112+
dy: 150,
113+
duration: Duration(seconds: 1),
114+
rotateDegrees: i,
115+
touch: Touch.middle,
116+
child: user(0, i),
117+
),
118+
),
119+
],
120+
),
121+
),
122+
),
123+
SizedBox(height: 80,),
80124
FadeInRight(
81125
duration: Duration(milliseconds: 500),
82126
child: Padding(
@@ -173,4 +217,50 @@ class _ContactPageState extends State<ContactPage> {
173217
)
174218
);
175219
}
220+
221+
user(int index, double number) {
222+
index = number ~/ 60;
223+
return FadeInRight(
224+
delay: Duration(seconds: 1),
225+
duration: Duration(milliseconds: (index * 100) + 500),
226+
child: GestureDetector(
227+
onTap: () {
228+
Navigator.push(context,
229+
MaterialPageRoute(
230+
builder: (context) => SendMoney(
231+
name: _contacts[index]['name'],
232+
avatar: _contacts[index]['avatar']
233+
)
234+
)
235+
);
236+
},
237+
child: Container(
238+
margin: EdgeInsets.only(right: 20),
239+
child: Column(
240+
mainAxisAlignment: MainAxisAlignment.center,
241+
children: <Widget>[
242+
Transform.rotate(
243+
angle: number / 60 * 5.2,
244+
child: CircleAvatar(
245+
radius: 30,
246+
backgroundColor: Colors.green.shade100,
247+
backgroundImage: AssetImage(_contacts[index]['avatar']),
248+
),
249+
),
250+
],
251+
),
252+
),
253+
),
254+
);
255+
}
256+
257+
Container circle(Color color, [double diameter = 50.0]) {
258+
return Container(
259+
width: diameter,
260+
height: diameter,
261+
decoration: BoxDecoration(
262+
color: color,
263+
shape: BoxShape.circle,
264+
));
265+
}
176266
}

‎pubspec.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ dependencies:
3737
iconsax: ^0.0.8
3838
animate_do: ^2.0.0
3939
pattern_formatter: ^2.0.0
40+
align_positioned: ^3.0.0
4041

4142
dev_dependencies:
4243
flutter_test:

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /