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 14b49af

Browse files
Add contact page
1 parent 6e6f347 commit 14b49af

File tree

2 files changed

+184
-2
lines changed

2 files changed

+184
-2
lines changed

‎lib/main.dart‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'package:animate_do/animate_do.dart';
2+
import 'package:day40/pages/contact.dart';
23
import 'package:flutter/material.dart';
34
import 'package:iconsax/iconsax.dart';
45

@@ -178,7 +179,7 @@ class _HomePageState extends State<HomePage> {
178179
delegate: SliverChildListDelegate([
179180
SizedBox(height: 20,),
180181
Container(
181-
padding: EdgeInsets.only(left:20, top: 20),
182+
padding: EdgeInsets.only(top: 20),
182183
height: 115,
183184
width: double.infinity,
184185
child: ListView.builder(
@@ -189,7 +190,12 @@ class _HomePageState extends State<HomePage> {
189190
duration: Duration(milliseconds: (index + 1) * 100),
190191
child: AspectRatio(
191192
aspectRatio: 1,
192-
child: Container(
193+
child: GestureDetector(
194+
onTap: () {
195+
if (_services[index][0] == 'Transfer') {
196+
Navigator.push(context, MaterialPageRoute(builder: (context) => ContactPage()));
197+
}
198+
},
193199
child: Column(
194200
children: [
195201
Container(

‎lib/pages/contact.dart‎

Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
import 'package:animate_do/animate_do.dart';
2+
import 'package:day40/pages/send_money.dart';
3+
import 'package:flutter/material.dart';
4+
5+
class ContactPage extends StatefulWidget {
6+
const ContactPage({ Key? key }) : super(key: key);
7+
8+
@override
9+
_ContactPageState createState() => _ContactPageState();
10+
}
11+
12+
class _ContactPageState extends State<ContactPage> {
13+
List<dynamic> _contacts = [
14+
{
15+
'name': 'John',
16+
'avatar': 'assets/images/avatar-1.png',
17+
},
18+
{
19+
'name': 'Samantha',
20+
'avatar': 'assets/images/avatar-2.png',
21+
},
22+
{
23+
'name': 'Mary',
24+
'avatar': 'assets/images/avatar-3.png',
25+
},
26+
{
27+
'name': 'Julian',
28+
'avatar': 'assets/images/avatar-4.png',
29+
},
30+
{
31+
'name': 'Sara',
32+
'avatar': 'assets/images/avatar-5.png',
33+
},
34+
{
35+
'name': 'Kabir Singh',
36+
'avatar': 'assets/images/avatar-6.png',
37+
}
38+
];
39+
40+
@override
41+
Widget build(BuildContext context) {
42+
return Scaffold(
43+
appBar: AppBar(
44+
backgroundColor: Colors.transparent,
45+
elevation: 0,
46+
title: Text('Contacts', style: TextStyle(color: Colors.black),),
47+
leading: BackButton(color: Colors.black,),
48+
bottom: PreferredSize(
49+
preferredSize: Size.fromHeight(50),
50+
child: FadeInDown(
51+
duration: Duration(milliseconds: 500),
52+
child: Container(
53+
height: 40,
54+
margin: EdgeInsets.only(bottom: 10),
55+
padding: EdgeInsets.symmetric(horizontal: 20),
56+
child: TextField(
57+
cursorColor: Colors.black,
58+
decoration: InputDecoration(
59+
contentPadding: EdgeInsets.symmetric(vertical: 10),
60+
prefixIcon: Icon(Icons.search, color: Colors.grey,),
61+
hintText: 'Search contacts',
62+
hintStyle: TextStyle(color: Colors.grey),
63+
filled: true,
64+
fillColor: Colors.grey[200],
65+
border: OutlineInputBorder(
66+
borderRadius: BorderRadius.circular(10),
67+
borderSide: BorderSide.none,
68+
),
69+
),
70+
),
71+
),
72+
),
73+
),
74+
),
75+
body: SingleChildScrollView(
76+
child: Column(
77+
crossAxisAlignment: CrossAxisAlignment.start,
78+
children: <Widget>[
79+
SizedBox(height: 20,),
80+
FadeInRight(
81+
duration: Duration(milliseconds: 500),
82+
child: Padding(
83+
padding: const EdgeInsets.only(left: 20.0, bottom: 15.0, top: 10.0),
84+
child: Text('Most Recent', style: TextStyle(fontSize: 16, color: Colors.grey.shade900, fontWeight: FontWeight.w500),),
85+
),
86+
),
87+
Container(
88+
height: 90,
89+
padding: EdgeInsets.only(left: 20),
90+
child: ListView.builder(
91+
scrollDirection: Axis.horizontal,
92+
itemCount: _contacts.length,
93+
itemBuilder: (context, index) {
94+
return FadeInRight(
95+
duration: Duration(milliseconds: (index * 100) + 500),
96+
child: GestureDetector(
97+
onTap: () {
98+
Navigator.push(context,
99+
MaterialPageRoute(
100+
builder: (context) => SendMoney(
101+
name: _contacts[index]['name'],
102+
avatar: _contacts[index]['avatar']
103+
)
104+
)
105+
);
106+
},
107+
child: Container(
108+
margin: EdgeInsets.only(right: 20),
109+
child: Column(
110+
mainAxisAlignment: MainAxisAlignment.center,
111+
children: <Widget>[
112+
CircleAvatar(
113+
radius: 30,
114+
backgroundColor: Colors.blueGrey[100],
115+
backgroundImage: AssetImage(_contacts[index]['avatar']),
116+
),
117+
SizedBox(height: 10,),
118+
Text(_contacts[index]['name'], style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600),),
119+
],
120+
),
121+
),
122+
),
123+
);
124+
},
125+
),
126+
),
127+
SizedBox(height: 30,),
128+
FadeInRight(
129+
duration: Duration(milliseconds: 500),
130+
child: Padding(
131+
padding: const EdgeInsets.only(left: 20.0, bottom: 15.0, top: 10.0),
132+
child: Text('All Contacts', style: TextStyle(fontSize: 16, color: Colors.grey.shade900, fontWeight: FontWeight.w500),),
133+
),
134+
),
135+
Container(
136+
height: MediaQuery.of(context).size.height - 200,
137+
padding: EdgeInsets.only(left: 20),
138+
child: ListView.builder(
139+
physics: BouncingScrollPhysics(),
140+
itemCount: _contacts.length,
141+
itemBuilder: (context, index) {
142+
return FadeInRight(
143+
duration: Duration(milliseconds: (index * 100) + 500),
144+
child: Container(
145+
margin: EdgeInsets.only(bottom: 20),
146+
child: Row(
147+
children: <Widget>[
148+
Row(
149+
children: [
150+
CircleAvatar(
151+
radius: 30,
152+
backgroundColor: Colors.red[100],
153+
backgroundImage: AssetImage(_contacts[index]['avatar']),
154+
),
155+
SizedBox(width: 10,),
156+
Text(_contacts[index]['name'], style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600),),
157+
],
158+
),
159+
Spacer(),
160+
IconButton(
161+
icon: Icon(Icons.arrow_forward_ios, color: Colors.black, size: 15,),
162+
onPressed: () {},
163+
),
164+
],
165+
),
166+
),
167+
);
168+
},
169+
),
170+
),
171+
]
172+
)
173+
)
174+
);
175+
}
176+
}

0 commit comments

Comments
(0)

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