Skip to content

Commit 4405d55

Browse files
committed
feat(Profile): done layout UI profile screen
1 parent b1f8275 commit 4405d55

File tree

14 files changed

+288
-139
lines changed

14 files changed

+288
-139
lines changed

lib/src/blocs/login_bloc.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

lib/src/ui/chats/widgets/message_card.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ class _MessageCardState extends State<MessageCard> {
4444
child: Row(
4545
children: [
4646
Container(
47-
height: 40.sp,
48-
width: 40.sp,
47+
height: 42.5.sp,
48+
width: 42.5.sp,
4949
child: ClipRRect(
50-
borderRadius: BorderRadius.circular(12.25.sp),
50+
borderRadius: BorderRadius.circular(250.sp),
5151
child: BlurHash(
5252
hash: widget.blurHash ?? '',
5353
image: widget.urlToImage,
@@ -76,7 +76,7 @@ class _MessageCardState extends State<MessageCard> {
7676
.withOpacity(.88),
7777
),
7878
),
79-
SizedBox(height: 4.sp),
79+
SizedBox(height: 4.5.sp),
8080
Text(
8181
widget.lastMessage!,
8282
overflow: TextOverflow.ellipsis,
Lines changed: 265 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,279 @@
11
import 'package:flutter/material.dart';
2+
import 'package:flutter_mobile_2school/src/resources/hard/hard_post.dart';
3+
import 'package:flutter_mobile_2school/src/themes/app_colors.dart';
4+
import 'package:flutter_mobile_2school/src/themes/app_decorations.dart';
5+
import 'package:flutter_mobile_2school/src/themes/font_family.dart';
6+
import 'package:flutter_mobile_2school/src/ui/classes/widgets/recommend_class_card.dart';
7+
import 'package:phosphor_flutter/phosphor_flutter.dart';
8+
import 'package:sizer/sizer.dart';
29

310
class ProfileScreen extends StatefulWidget {
411
@override
512
State<StatefulWidget> createState() => _ProfileScreenState();
613
}
714

815
class _ProfileScreenState extends State<ProfileScreen> {
16+
ScrollController scrollController = ScrollController();
17+
bool _showInfo = true;
18+
19+
@override
20+
void initState() {
21+
super.initState();
22+
scrollController.addListener(() {
23+
if (scrollController.offset < 8.0) {
24+
if (!_showInfo) {
25+
setState(() {
26+
_showInfo = true;
27+
});
28+
}
29+
} else {
30+
if (_showInfo) {
31+
setState(() {
32+
_showInfo = false;
33+
});
34+
}
35+
}
36+
});
37+
}
38+
939
@override
1040
Widget build(BuildContext context) {
1141
return Scaffold(
12-
body: Container(),
42+
appBar: AppBar(
43+
brightness: Theme.of(context).brightness,
44+
backgroundColor: Colors.transparent,
45+
elevation: .0,
46+
centerTitle: true,
47+
leading: IconButton(
48+
splashColor: colorPrimary,
49+
splashRadius: 5.0,
50+
icon: Icon(
51+
PhosphorIcons.slidersHorizontal,
52+
size: 22.5.sp,
53+
),
54+
onPressed: () => null,
55+
),
56+
title: Text(
57+
_showInfo ? '' : 'Đào Hồng Vinh',
58+
style: TextStyle(
59+
fontSize: 15.sp,
60+
fontWeight: FontWeight.w400,
61+
fontFamily: FontFamily.lato,
62+
color: Theme.of(context).textTheme.bodyText1!.color,
63+
),
64+
),
65+
actions: [
66+
IconButton(
67+
splashRadius: 10.0,
68+
icon: Icon(
69+
PhosphorIcons.rows,
70+
size: 22.5.sp,
71+
),
72+
onPressed: () => null,
73+
),
74+
],
75+
),
76+
body: Container(
77+
height: 100.h,
78+
width: 100.w,
79+
child: Column(
80+
children: [
81+
GestureDetector(
82+
onTap: () => null,
83+
child: Container(
84+
width: 100.w,
85+
alignment: Alignment.center,
86+
child: Container(
87+
height: 108.sp,
88+
width: 108.sp,
89+
decoration: BoxDecoration(
90+
shape: BoxShape.circle,
91+
border: Border.all(
92+
color: colorPrimary,
93+
width: 3.sp,
94+
),
95+
),
96+
alignment: Alignment.center,
97+
child: Container(
98+
height: 96.sp,
99+
width: 96.sp,
100+
decoration: BoxDecoration(
101+
shape: BoxShape.circle,
102+
image: DecorationImage(
103+
image: NetworkImage(
104+
'https://avatars.githubusercontent.com/u/60530946?v=4',
105+
),
106+
fit: BoxFit.cover,
107+
),
108+
),
109+
),
110+
),
111+
),
112+
),
113+
_showInfo
114+
? Column(
115+
children: [
116+
SizedBox(height: 10.sp),
117+
Text(
118+
'Đào Hồng Vinh',
119+
maxLines: 1,
120+
overflow: TextOverflow.ellipsis,
121+
style: TextStyle(
122+
fontSize: 14.sp,
123+
fontFamily: FontFamily.lato,
124+
fontWeight: FontWeight.w600,
125+
),
126+
),
127+
SizedBox(height: 6.sp),
128+
Container(
129+
padding: EdgeInsets.symmetric(horizontal: 10.w),
130+
alignment: Alignment.center,
131+
child: Text(
132+
'Mobile App Developer (lambiengcode)',
133+
maxLines: 2,
134+
overflow: TextOverflow.ellipsis,
135+
style: TextStyle(
136+
fontSize: 11.5.sp,
137+
fontFamily: FontFamily.lato,
138+
fontWeight: FontWeight.w500,
139+
),
140+
textAlign: TextAlign.center,
141+
),
142+
),
143+
SizedBox(height: 18.sp),
144+
_buildInfoBar(),
145+
],
146+
)
147+
: Container(),
148+
SizedBox(height: 12.sp),
149+
_buildTitle(
150+
'Archive',
151+
PhosphorIcons.starFill,
152+
Colors.amberAccent.shade700,
153+
),
154+
SizedBox(height: 4.sp),
155+
Expanded(
156+
child: ListView.builder(
157+
controller: scrollController,
158+
padding: EdgeInsets.only(bottom: 12.sp),
159+
physics: ClampingScrollPhysics(),
160+
itemCount: posts.length,
161+
itemBuilder: (context, index) {
162+
return RecommendClassCard(
163+
imageClass: posts[index].imageGroup,
164+
className: posts[index].groupName,
165+
star: '4.5 / 5.0',
166+
teacher: posts[index].authorName,
167+
);
168+
},
169+
),
170+
),
171+
],
172+
),
173+
),
174+
);
175+
}
176+
177+
Widget _buildInfoBar() {
178+
return Container(
179+
width: 100.w,
180+
margin: EdgeInsets.symmetric(horizontal: 20.sp),
181+
padding: EdgeInsets.symmetric(vertical: 14.sp),
182+
decoration: AppDecoration.buttonActionBorder(context, 6.sp).decoration,
183+
child: Row(
184+
children: [
185+
_buildInfo(context, 'Archive', '88'),
186+
_buildCustomDivider(),
187+
_buildInfo(context, 'Learning', '593'),
188+
_buildCustomDivider(),
189+
_buildInfo(context, 'Friend', '241'),
190+
],
191+
),
192+
);
193+
}
194+
195+
Widget _buildInfo(context, title, value) {
196+
return Expanded(
197+
child: GestureDetector(
198+
onTap: () => null,
199+
child: Container(
200+
color: Colors.transparent,
201+
child: Column(
202+
children: [
203+
Text(
204+
title,
205+
style: TextStyle(
206+
fontFamily: FontFamily.lato,
207+
fontSize: 10.75.sp,
208+
fontWeight: FontWeight.w400,
209+
color: Theme.of(context)
210+
.textTheme
211+
.bodyText1!
212+
.color!
213+
.withOpacity(.9),
214+
),
215+
),
216+
SizedBox(height: 6.5.sp),
217+
Text(
218+
value,
219+
style: TextStyle(
220+
fontSize: 13.5.sp,
221+
fontWeight: FontWeight.w500,
222+
color: Theme.of(context).textTheme.bodyText1!.color,
223+
),
224+
),
225+
],
226+
),
227+
),
228+
),
229+
);
230+
}
231+
232+
Widget _buildCustomDivider() {
233+
return Container(
234+
height: 40.sp,
235+
child: VerticalDivider(
236+
width: .25,
237+
thickness: .25,
238+
color: colorPrimary,
239+
),
240+
);
241+
}
242+
243+
_buildTitle(title, icon, color) {
244+
return Container(
245+
padding: EdgeInsets.only(left: 16.sp, right: 8.sp),
246+
child: Row(
247+
mainAxisAlignment: MainAxisAlignment.spaceBetween,
248+
children: [
249+
Row(
250+
children: [
251+
Icon(
252+
icon,
253+
size: 16.sp,
254+
color: color,
255+
),
256+
SizedBox(width: 6.sp),
257+
Text(
258+
title,
259+
style: TextStyle(
260+
fontSize: 14.sp,
261+
fontWeight: FontWeight.w600,
262+
fontFamily: FontFamily.lato,
263+
color: color,
264+
),
265+
),
266+
],
267+
),
268+
IconButton(
269+
onPressed: () => null,
270+
icon: Icon(
271+
PhosphorIcons.pushPinFill,
272+
size: 20.sp,
273+
),
274+
),
275+
],
276+
),
13277
);
14278
}
15279
}

run.sh

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,20 @@ flutter pub get
2626
clear
2727

2828
# Analyze before build
29-
flutter analyze
30-
if [ ! $? -eq 0 ]; then
31-
exit 1
32-
fi
29+
# flutter analyze
30+
# if [ ! $? -eq 0 ]; then
31+
# exit 1
32+
# fi
3333

3434
# Generate app icons & splash screen
35-
flutter pub run flutter_launcher_icons:main
35+
# flutter pub run flutter_launcher_icons:main
3636

3737
# Remove ununsed icons
38-
rm -f ./ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
39-
rm -f ./ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
40-
rm -f ./ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
41-
rm -f ./ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
42-
rm -f ./ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
43-
rm -f ./ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
44-
45-
flutter run -d all
38+
# rm -f ./ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
39+
# rm -f ./ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
40+
# rm -f ./ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
41+
# rm -f ./ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
42+
# rm -f ./ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
43+
# rm -f ./ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
44+
45+
flutter run

web/favicon.png

-917 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)